Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install Dependencies
run: |
apt update
apt install -y gobject-introspection libecal2.0-dev libhandy-1-dev libedataserver1.2-dev libical-dev libgranite-dev libwingpanel-dev meson valac
apt install -y gobject-introspection libecal2.0-dev libadwaita-1-dev libedataserver1.2-dev libical-dev libgranite-7-dev libwingpanel-8-dev meson valac
- name: Build
env:
DESTDIR: out
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
You'll need the following dependencies:

* gobject-introspection
* libadwaita-1-dev
* libecal1.2-dev
* libedataserver1.2-dev
* libical-dev
* libgranite-dev >= 6.0.0
* libwingpanel-dev
* libgranite-7-dev >= 7.6.0
* libwingpanel-8-dev
* meson (>= 0.57.0)
* valac >= 0.40.3

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions data/datetime.metainfo.xml.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2019-2022 elementary, Inc. <contact@elementary.io> -->
<component type="addon">
<id>io.elementary.wingpanel.datetime</id>
<id>io.elementary.panel.datetime</id>
<extends>io.elementary.wingpanel</extends>
<translation type="gettext">datetime-indicator</translation>
<translation type="gettext">io.elementary.panel.datetime</translation>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>

Expand Down
7 changes: 4 additions & 3 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
i18n.merge_file(
input: 'datetime.metainfo.xml.in',
output: 'io.elementary.wingpanel.datetime.metainfo.xml',
output: gettext_name + '.metainfo.xml',
po_dir: meson.project_source_root() / 'po' / 'extra',
type: 'xml',
install: true,
install_dir: get_option('datadir') / 'metainfo',
)

install_data(
'io.elementary.desktop.wingpanel.datetime.gschema.xml',
install_dir: get_option('datadir') / 'glib-2.0' / 'schemas'
'datetime.gschema.xml',
install_dir: get_option('datadir') / 'glib-2.0' / 'schemas',
rename: gettext_name + '.gschema.xml'
)
12 changes: 6 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ project(
i18n = import('i18n')
gnome = import('gnome')

gettext_name = meson.project_name() + '-indicator'
gettext_name = 'io.elementary.panel.' + meson.project_name()

prefix = get_option('prefix')
libdir = prefix / get_option('libdir')

add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(gettext_name), language:'c')
add_project_arguments(['--vapidir', meson.current_source_dir() / 'vapi'], language: 'vala')
add_project_arguments('-DG_LOG_DOMAIN="io.elementary.wingpanel.datetime"', language:'c')
add_project_arguments('-DG_LOG_DOMAIN="io.elementary.panel.datetime"', language:'c')

gresource = gnome.compile_resources(
'gresource',
'data' / 'datetime.gresource.xml',
source_dir: 'data'
)

wingpanel_dep = dependency('wingpanel')
wingpanel_dep = dependency('wingpanel-8')
wingpanel_indicatorsdir = wingpanel_dep.get_variable('indicatorsdir', pkgconfig_define: ['libdir', libdir])

libecal_dep = dependency('libecal-2.0', required: false)
Expand Down Expand Up @@ -64,11 +64,11 @@ shared_module(
dependencies: [
dependency('glib-2.0'),
dependency('gobject-2.0'),
dependency('granite', version: '>=6.0.0'),
dependency('gtk+-3.0'),
dependency('granite-7', version: '>=7.6.0'),
dependency('gtk4'),
libecal_dep,
dependency('libedataserver-1.2'),
dependency('libhandy-1'),
dependency('libadwaita-1'),
libical_dep,
wingpanel_dep,
],
Expand Down
File renamed without changes.
18 changes: 6 additions & 12 deletions src/Indicator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ public class DateTime.Indicator : Wingpanel.Indicator {
max_width_chars = 20,
justify = Gtk.Justification.CENTER
};
placeholder_label.show_all ();

var placeholder_style_context = placeholder_label.get_style_context ();
placeholder_style_context.add_class (Gtk.STYLE_CLASS_DIM_LABEL);
placeholder_style_context.add_class (Granite.STYLE_CLASS_DIM_LABEL);
placeholder_style_context.add_class (Granite.STYLE_CLASS_H3_LABEL);

component_listbox = new Gtk.ListBox () {
Expand All @@ -84,14 +83,12 @@ public class DateTime.Indicator : Wingpanel.Indicator {
component_listbox.set_placeholder (placeholder_label);
component_listbox.set_sort_func (sort_function);

var scrolled_window = new Gtk.ScrolledWindow (null, null) {
var scrolled_window = new Gtk.ScrolledWindow () {
hscrollbar_policy = Gtk.PolicyType.NEVER,
child = component_listbox
};

var settings_button = new Gtk.ModelButton () {
text = _("Date & Time Settings…")
};
var settings_button = new Wingpanel.PopoverMenuItem.with_text (_("Date & Time Settings…"));

var sep = new Gtk.Separator (Gtk.Orientation.HORIZONTAL) {
margin_bottom = 3,
Expand Down Expand Up @@ -213,9 +210,7 @@ public class DateTime.Indicator : Wingpanel.Indicator {
}

private bool update_components () {
foreach (unowned Gtk.Widget widget in component_listbox.get_children ()) {
widget.destroy ();
}
component_listbox.remove_all ();

if (calendar.selected_date == null) {
update_components_idle_source = 0;
Expand All @@ -237,7 +232,7 @@ public class DateTime.Indicator : Wingpanel.Indicator {
if (!components_on_day.has_key (component_uid)) {
components_on_day[component_uid] = new DateTime.ComponentRow (date, ical, source);

component_listbox.add (components_on_day[component_uid]);
component_listbox.append (components_on_day[component_uid]);
}
}
}
Expand All @@ -251,13 +246,12 @@ public class DateTime.Indicator : Wingpanel.Indicator {
if (!components_on_day.has_key (component_uid)) {
components_on_day[component_uid] = new DateTime.ComponentRow (date, ical, source);

component_listbox.add (components_on_day[component_uid]);
component_listbox.append (components_on_day[component_uid]);
}
}
}
});

component_listbox.show_all ();
update_components_idle_source = 0;
return GLib.Source.REMOVE;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Widgets/ComponentRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class DateTime.ComponentRow : Gtk.ListBoxRow {
icon_name = "alarm-symbolic";
}

component_image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.MENU) {
component_image = new Gtk.Image.from_icon_name (icon_name) {
valign = Gtk.Align.START
};

Expand All @@ -112,7 +112,7 @@ public class DateTime.ComponentRow : Gtk.ListBoxRow {
use_markup = true,
xalign = 0,
};
time_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL);
time_label.get_style_context ().add_class (Granite.STYLE_CLASS_DIM_LABEL);

grid = new Gtk.Grid () {
column_spacing = 6,
Expand All @@ -131,7 +131,7 @@ public class DateTime.ComponentRow : Gtk.ListBoxRow {
grid_context.add_class ("event");
grid_context.add_provider (css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);

add (grid);
child = grid;

set_color ();
source_selectable.notify["color"].connect (set_color);
Expand Down
13 changes: 6 additions & 7 deletions src/Widgets/PanelLabel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,23 @@ public class DateTime.Widgets.PanelLabel : Gtk.Box {
public bool clock_show_seconds { get; set; }
public bool clock_show_weekday { get; set; }

private Gtk.GestureMultiPress gesture_click;

construct {
date_label = new Gtk.Label (null) {
margin_end = 12
};

var date_revealer = new Gtk.Revealer () {
transition_type = Gtk.RevealerTransitionType.SLIDE_LEFT
transition_type = Gtk.RevealerTransitionType.SLIDE_LEFT,
child = date_label
};
date_revealer.add (date_label);

time_label = new Gtk.Label (null) {
use_markup = true
};

valign = Gtk.Align.CENTER;
add (date_revealer);
add (time_label);
append (date_revealer);
append (time_label);

var clock_settings = new GLib.Settings ("io.elementary.desktop.wingpanel.datetime");
clock_settings.bind ("clock-format", this, "clock-format", SettingsBindFlags.DEFAULT);
Expand All @@ -60,10 +58,11 @@ public class DateTime.Widgets.PanelLabel : Gtk.Box {
time_manager.minute_changed.connect (update_labels);
time_manager.notify["is-12h"].connect (update_labels);

gesture_click = new Gtk.GestureMultiPress (this) {
var gesture_click = new Gtk.GestureClick () {
button = Gdk.BUTTON_MIDDLE
};
gesture_click.pressed.connect (on_pressed);
add_controller (gesture_click);
}

private void update_labels () {
Expand Down
50 changes: 22 additions & 28 deletions src/Widgets/calendar/CalendarView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class DateTime.Widgets.CalendarView : Gtk.Grid {

public GLib.DateTime? selected_date { get; private set; }

private Hdy.Carousel carousel;
private Adw.Carousel carousel;
private uint position;
private int rel_postion;
private CalendarModel events_model;
Expand Down Expand Up @@ -61,10 +61,10 @@ public class DateTime.Widgets.CalendarView : Gtk.Grid {
margin_end = 6,
valign = Gtk.Align.CENTER
};
box_buttons.get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED);
box_buttons.add (left_button);
box_buttons.add (center_button);
box_buttons.add (right_button);
box_buttons.get_style_context ().add_class (Granite.STYLE_CLASS_LINKED);
box_buttons.append (left_button);
box_buttons.append (center_button);
box_buttons.append (right_button);

events_model = CalendarModel.get_default (ECal.ClientSourceType.EVENTS);
tasks_model = CalendarModel.get_default (ECal.ClientSourceType.TASKS);
Expand All @@ -88,24 +88,22 @@ public class DateTime.Widgets.CalendarView : Gtk.Grid {
events_model.change_month (-1);
tasks_model.change_month (-1);

carousel = new Hdy.Carousel () {
carousel = new Adw.Carousel () {
interactive = true,
hexpand = true,
vexpand = true,
spacing = 15
};

carousel.add (left_grid);
carousel.add (start_month_grid);
carousel.add (right_grid);
carousel.scroll_to (start_month_grid);
carousel.append (left_grid);
carousel.append (start_month_grid);
carousel.append (right_grid);
carousel.scroll_to (start_month_grid, false);

position = 1;
rel_postion = 0;
showtoday = false;

carousel.show_all ();

column_spacing = 6;
row_spacing = 6;
margin_start = margin_end = 10;
Expand All @@ -114,11 +112,11 @@ public class DateTime.Widgets.CalendarView : Gtk.Grid {
attach (carousel, 0, 1, 2);

left_button.clicked.connect (() => {
carousel.switch_child ((int) carousel.get_position () - 1, carousel.get_animation_duration ());
carousel.scroll_to (carousel.get_nth_page ((uint) Math.round (carousel.position) - 1), true);
});

right_button.clicked.connect (() => {
carousel.switch_child ((int) carousel.get_position () + 1, carousel.get_animation_duration ());
carousel.scroll_to (carousel.get_nth_page ((uint) Math.round (carousel.position) + 1), true);
});

center_button.clicked.connect (() => {
Expand Down Expand Up @@ -158,7 +156,7 @@ public class DateTime.Widgets.CalendarView : Gtk.Grid {
var grid = create_grid ();
grid.set_range (events_model.data_range, events_model.month_start);
grid.update_weeks (events_model.data_range.first_dt, events_model.num_weeks);
carousel.add (grid);
carousel.append (grid);
events_model.change_month (-1);
tasks_model.change_month (-1);

Expand All @@ -179,7 +177,6 @@ public class DateTime.Widgets.CalendarView : Gtk.Grid {

private DateTime.Widgets.Grid create_grid () {
var grid = new DateTime.Widgets.Grid ();
grid.show_all ();

grid.on_event_add.connect ((date) => {
show_date_in_maya (date);
Expand All @@ -201,12 +198,11 @@ public class DateTime.Widgets.CalendarView : Gtk.Grid {
selected_date = today;
if (start.equal (start_month) && !refresh) {
position -= rel_postion;
carousel.switch_child (position, carousel.get_animation_duration ());
carousel.scroll_to (carousel.get_nth_page (position), true);
} else {
/*reset Carousel if center_child != the grid of the month of today*/
carousel.no_show_all = true;
foreach (unowned Gtk.Widget grid in carousel.get_children ()) {
carousel.remove (grid);
for (var child = carousel.get_first_child (); child != null; child = carousel.get_first_child ()) {
carousel.remove (child);
}

start_month = Util.get_start_of_month ();
Expand All @@ -230,17 +226,15 @@ public class DateTime.Widgets.CalendarView : Gtk.Grid {
events_model.change_month (-1);
tasks_model.change_month (-1);

carousel.add (left_grid);
carousel.add (start_month_grid);
carousel.add (right_grid);
carousel.scroll_to (start_month_grid);
carousel.append (left_grid);
carousel.append (start_month_grid);
carousel.append (right_grid);
carousel.scroll_to (start_month_grid, false);
label.label = events_model.month_start.format (_("%OB, %Y"));

position = 1;
rel_postion = 0;
}

carousel.no_show_all = false;
}

// TODO: As far as maya supports it use the Dbus Activation feature to run the calendar-app.
Expand All @@ -257,8 +251,8 @@ public class DateTime.Widgets.CalendarView : Gtk.Grid {
"dialog-error"
);
dialog.show_error_details (e.message);
dialog.run ();
dialog.destroy ();
dialog.response.connect (dialog.destroy);
dialog.present ();
}
}

Expand Down
Loading
Loading