[gnome-shell/wip/gtkmenutrackeritem: 2/9] gtkactionmuxer: Reintroduce the passing of event timestamps



commit af3ef19991e4c99294c8105aa73a0921767c43be
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu May 9 15:10:29 2013 -0400

    gtkactionmuxer: Reintroduce the passing of event timestamps
    
    This is a hack we have in our local fork as compared to upstream;
    work on a generic "hook" system in here is ongoing, but until then,
    this is the easiest way to do it.

 src/gtkactionmuxer.c |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/src/gtkactionmuxer.c b/src/gtkactionmuxer.c
index 4618564..be66965 100644
--- a/src/gtkactionmuxer.c
+++ b/src/gtkactionmuxer.c
@@ -24,6 +24,8 @@
 #include "gtkactionobservable.h"
 #include "gtkactionobserver.h"
 
+#include <clutter/clutter.h>
+
 #include <string.h>
 
 /**
@@ -377,6 +379,26 @@ gtk_action_muxer_activate_action (GActionGroup *action_group,
     g_action_group_activate_action (G_ACTION_GROUP (muxer->parent), action_name, parameter);
 }
 
+static GVariant *
+get_platform_data (void)
+{
+  gchar time[32];
+  GVariantBuilder *builder;
+  GVariant *result;
+
+  g_snprintf (time, 32, "_TIME%d", clutter_get_current_event_time ());
+
+  builder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
+
+  g_variant_builder_add (builder, "{sv}", "desktop-startup-id",
+                         g_variant_new_string (time));
+
+  result = g_variant_builder_end (builder);
+  g_variant_builder_unref (builder);
+
+  return result;
+}
+
 static void
 gtk_action_muxer_change_action_state (GActionGroup *action_group,
                                       const gchar  *action_name,
@@ -389,7 +411,15 @@ gtk_action_muxer_change_action_state (GActionGroup *action_group,
   group = gtk_action_muxer_find_group (muxer, action_name, &unprefixed_name);
 
   if (group)
-    g_action_group_change_action_state (group->group, unprefixed_name, state);
+    {
+      if (G_IS_REMOTE_ACTION_GROUP (group->group))
+        g_remote_action_group_change_action_state_full (G_REMOTE_ACTION_GROUP (group->group),
+                                                        unprefixed_name,
+                                                        state,
+                                                        get_platform_data ());
+      else
+        g_action_group_change_action_state (group->group, unprefixed_name, state);
+    }
   else if (muxer->parent)
     g_action_group_change_action_state (G_ACTION_GROUP (muxer->parent), action_name, state);
 }


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