[gedit/wip/panels-as-stacks] Add a test action.



commit 419f857b6f25c1668041cd5af8f805b61199eff5
Author: Steve Frécinaux <code istique net>
Date:   Thu Jan 16 17:34:35 2014 +0100

    Add a test action.

 gedit/gedit-menu-stack-switcher.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-menu-stack-switcher.c b/gedit/gedit-menu-stack-switcher.c
index 783618a..f49404e 100644
--- a/gedit/gedit-menu-stack-switcher.c
+++ b/gedit/gedit-menu-stack-switcher.c
@@ -133,6 +133,8 @@ gedit_menu_stack_switcher_toggled (GtkToggleButton *button)
     {
       priv->menu = g_menu_new ();
       gtk_container_foreach (GTK_CONTAINER (priv->stack), (GtkCallback) add_menu_entry, switcher);
+      g_menu_append (priv->menu, "Test", "switcher.test");
+
       gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (switcher), G_MENU_MODEL (priv->menu));
     }
 
@@ -220,12 +222,19 @@ on_visible_child_changed (GtkWidget              *widget,
   update_label (switcher);
 }
 
+static void
+test (void)
+{
+  g_print ("This is a test\n");
+}
+
 void
 gedit_menu_stack_switcher_set_stack (GeditMenuStackSwitcher *switcher,
                                      GtkStack               *stack)
 {
   GeditMenuStackSwitcherPrivate *priv;
   GPropertyAction *action;
+  GSimpleAction *saction;
 
   g_return_if_fail (GEDIT_IS_MENU_STACK_SWITCHER (switcher));
   g_return_if_fail (stack == NULL || GTK_IS_STACK (stack));
@@ -257,6 +266,11 @@ gedit_menu_stack_switcher_set_stack (GeditMenuStackSwitcher *switcher,
       action = g_property_action_new ("set-visible-child", priv->stack, "visible-child-name");
       g_action_map_add_action (G_ACTION_MAP (priv->action_group), G_ACTION (action));
       g_object_unref (action);
+
+      saction = g_simple_action_new ("test", NULL);
+      g_signal_connect (saction, "activate", G_CALLBACK (test), NULL);
+      g_action_map_add_action (G_ACTION_MAP (priv->action_group), G_ACTION (saction));
+      g_object_unref (saction);
     }
 
   update_label (switcher);


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