[Xfce4-commits] [xfce/garcon] 11/12: Add options to the test-display-menu

noreply at xfce.org noreply at xfce.org
Fri Jun 3 07:52:08 CEST 2016


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository xfce/garcon.

commit 22dd867d7d0c87d7386c565aa1158d48b5442422
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Thu Jun 2 12:36:00 2016 +0300

    Add options to the test-display-menu
    
    Allow us to easily test the different garcon-gtk options in the
    test-display-menu -gtk2 && -gtk3 to easily verify changes.
---
 tests/test-display-menu.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 82 insertions(+), 1 deletion(-)

diff --git a/tests/test-display-menu.c b/tests/test-display-menu.c
index ce7c615..fcfb094 100644
--- a/tests/test-display-menu.c
+++ b/tests/test-display-menu.c
@@ -63,10 +63,47 @@ main_window_destroy (GtkWidget *window)
 
 
 static void
+generic_names_toggled (GtkToggleButton *togglebutton,
+                       gpointer         user_data)
+{
+  garcon_gtk_menu_set_show_generic_names (GARCON_GTK_MENU (gtk_root),
+                                          gtk_toggle_button_get_active (togglebutton));
+}
+
+static void
+menu_icons_toggled (GtkToggleButton *togglebutton,
+                    gpointer         user_data)
+{
+  garcon_gtk_menu_set_show_menu_icons (GARCON_GTK_MENU (gtk_root),
+                                       gtk_toggle_button_get_active (togglebutton));
+}
+
+static void
+tooltips_toggled (GtkToggleButton *togglebutton,
+                  gpointer         user_data)
+{
+  garcon_gtk_menu_set_show_tooltips (GARCON_GTK_MENU (gtk_root),
+                                     gtk_toggle_button_get_active (togglebutton));
+}
+
+static void
+desktop_actions_toggled (GtkToggleButton *togglebutton,
+                         gpointer         user_data)
+{
+  garcon_gtk_menu_set_show_desktop_actions (GARCON_GTK_MENU (gtk_root),
+                                            gtk_toggle_button_get_active (togglebutton));
+}
+
+
+
+
+static void
 create_main_window (void)
 {
   GtkWidget *window;
+  GtkWidget *box;
   GtkWidget *button;
+  GtkWidget *chk_generic_names, *chk_menu_icons, *chk_tooltips, *chk_desktop_actions;
 
   /* Create main window */
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -78,9 +115,18 @@ create_main_window (void)
   /* Exit main loop when when the window is closed */
   g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (main_window_destroy), NULL);
 
+  /* Create the box to hold all the stuff */
+#if GTK_CHECK_VERSION (3, 0, 0)
+  box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+#else
+  box = gtk_vbox_new (FALSE, 0);
+#endif
+  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_widget_show (box);
+
   /* Create button */
   button = gtk_button_new_with_mnemonic ("_Show menu");
-  gtk_container_add (GTK_CONTAINER (window), button);
+  gtk_container_add (GTK_CONTAINER (box), button);
   gtk_widget_show (button);
 
   /* Create Garcon's root menu to show the applications */
@@ -89,6 +135,41 @@ create_main_window (void)
 
   /* Display root menu when the button is clicked */
   g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (show_menu), gtk_root);
+
+  /* Create checkbuttons for the garcon-gtk options */
+
+  /* generic names */
+  chk_generic_names = gtk_check_button_new_with_mnemonic ("Show _generic names");
+  gtk_container_add (GTK_CONTAINER (box), chk_generic_names);
+  gtk_widget_show (chk_generic_names);
+  /* have check button match garcon-gtk's default */
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_generic_names), FALSE);
+  g_signal_connect (G_OBJECT (chk_generic_names), "toggled", G_CALLBACK (generic_names_toggled), NULL);
+
+  /* menu icons */
+  chk_menu_icons = gtk_check_button_new_with_mnemonic ("Show menu _icons");
+  gtk_container_add (GTK_CONTAINER (box), chk_menu_icons);
+  gtk_widget_show (chk_menu_icons);
+  /* have check button match garcon-gtk's default */
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_menu_icons), TRUE);
+  g_signal_connect (G_OBJECT (chk_menu_icons), "toggled", G_CALLBACK (menu_icons_toggled), NULL);
+
+  /* tooltips */
+  chk_tooltips = gtk_check_button_new_with_mnemonic ("Show _tooltips");
+  gtk_container_add (GTK_CONTAINER (box), chk_tooltips);
+  gtk_widget_show (chk_tooltips);
+  /* have check button match garcon-gtk's default */
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_tooltips), FALSE);
+  g_signal_connect (G_OBJECT (chk_tooltips), "toggled", G_CALLBACK (tooltips_toggled), NULL);
+
+  /* desktop actions */
+  chk_desktop_actions = gtk_check_button_new_with_mnemonic ("Show _desktop actions");
+  gtk_container_add (GTK_CONTAINER (box), chk_desktop_actions);
+  gtk_widget_show (chk_desktop_actions);
+  /* have check button match garcon-gtk's default */
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_desktop_actions), FALSE);
+  g_signal_connect (G_OBJECT (chk_desktop_actions), "toggled", G_CALLBACK (desktop_actions_toggled), NULL);
+
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list