[gnome-calendar] application: Add 'open-event' action



commit 1aecd1043dadb94f40aa677dd3e59d1ff4aaf719
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Apr 29 17:05:19 2019 -0300

    application: Add 'open-event' action
    
    This will be used by the search engine to open
    events.

 src/gcal-application.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/src/gcal-application.c b/src/gcal-application.c
index 64c7e8a7..d4a9c37f 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -165,6 +165,24 @@ load_css_provider (GcalApplication *self)
  * Callbacks
  */
 
+static void
+gcal_application_open_event (GSimpleAction *sync,
+                             GVariant      *parameter,
+                             gpointer       app)
+{
+  GcalApplication *self;
+  const gchar *event_uuid;
+
+  self = GCAL_APPLICATION (app);
+  event_uuid = g_variant_get_string (parameter, NULL);
+  g_assert (event_uuid != NULL);
+
+  g_debug ("Opening event %s", event_uuid);
+
+  gcal_window_open_event_by_uuid (GCAL_WINDOW (self->window), event_uuid);
+  gtk_window_present (GTK_WINDOW (self->window));
+}
+
 static void
 gcal_application_sync (GSimpleAction *sync,
                        GVariant      *parameter,
@@ -397,6 +415,7 @@ gcal_application_startup (GApplication *app)
   GcalApplication *self;
 
   static const GActionEntry gcal_app_entries[] = {
+    { "open-event", gcal_application_open_event, "s" },
     { "sync",   gcal_application_sync },
     { "search", gcal_application_launch_search },
     { "about",  gcal_application_show_about },


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]