@@ -26,6 +26,8 @@ public class DateTime.Widgets.PanelLabel : Gtk.Box {
2626 public bool clock_show_seconds { get ; set ; }
2727 public bool clock_show_weekday { get ; set ; }
2828
29+ private Gtk . GestureMultiPress gesture_click;
30+
2931 construct {
3032 date_label = new Gtk .Label (null ) {
3133 margin_end = 12
@@ -57,6 +59,11 @@ public class DateTime.Widgets.PanelLabel : Gtk.Box {
5759 time_manager = Services . TimeManager . get_default ();
5860 time_manager. minute_changed. connect (update_labels);
5961 time_manager. notify[" is-12h" ]. connect (update_labels);
62+
63+ gesture_click = new Gtk .GestureMultiPress (this ) {
64+ button = Gdk . BUTTON_MIDDLE
65+ };
66+ gesture_click. pressed. connect (on_pressed);
6067 }
6168
6269 private void update_labels () {
@@ -72,4 +79,20 @@ public class DateTime.Widgets.PanelLabel : Gtk.Box {
7279 string time_format = Granite . DateTime . get_default_time_format (time_manager. is_12h, clock_show_seconds);
7380 time_label. label = GLib . Markup . printf_escaped (" <span font_features='tnum'>%s </span>" , time_manager. format (time_format));
7481 }
82+
83+ private void on_pressed () {
84+ var command = " io.elementary.calendar --show-day %s " . printf (new GLib .DateTime .now_local (). format (" %F " ));
85+ try {
86+ var appinfo = AppInfo . create_from_commandline (command, null , AppInfoCreateFlags . NONE );
87+ appinfo. launch_uris (null , null );
88+ } catch (GLib . Error e) {
89+ var dialog = new Granite .MessageDialog .with_image_from_icon_name (
90+ _(" Unable To Launch Calendar" ),
91+ _(" The program \" io.elementary.calendar\" may not be installed" ),
92+ " dialog-error"
93+ );
94+ dialog. show_error_details (e. message);
95+ dialog. present ();
96+ }
97+ }
7598}
0 commit comments