[Goodies-commits] r3334 - xfce4-notes-plugin/trunk/panel-plugin

Mike Massonnet mmassonnet at xfce.org
Wed Oct 10 23:58:51 CEST 2007


Author: mmassonnet
Date: 2007-10-10 21:58:51 +0000 (Wed, 10 Oct 2007)
New Revision: 3334

Modified:
   xfce4-notes-plugin/trunk/panel-plugin/notes.c
   xfce4-notes-plugin/trunk/panel-plugin/panel-plugin.c
Log:
Replace the buttons for the menus with toggle buttons


Modified: xfce4-notes-plugin/trunk/panel-plugin/notes.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/notes.c	2007-10-10 21:58:38 UTC (rev 3333)
+++ xfce4-notes-plugin/trunk/panel-plugin/notes.c	2007-10-10 21:58:51 UTC (rev 3334)
@@ -205,7 +205,9 @@
   gtk_widget_show (notes_window->title);
 
   /* Menu button */
-  notes_window->btn_menu = xfce_create_panel_button ();
+  notes_window->btn_menu = xfce_create_panel_toggle_button ();//gtk_toggle_button_new ();
+  //gtk_button_set_relief (GTK_BUTTON (notes_window->btn_menu), GTK_RELIEF_NONE);
+  //GTK_WIDGET_UNSET_FLAGS (notes_window->btn_menu, GTK_CAN_FOCUS);
   gtk_widget_set_size_request (notes_window->btn_menu, 22, 22);
   arrow_menu = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
   gtk_container_add (GTK_CONTAINER (notes_window->btn_menu),
@@ -597,8 +599,11 @@
 notes_window_menu_popup (NotesWindow *notes_window,
                          GdkEvent *event)
 {
-  if (event->type == GDK_BUTTON_PRESS)
+  gboolean state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (notes_window->btn_menu));
+
+  if (state == FALSE && event->type == GDK_BUTTON_PRESS && event->button.button == 1)
     {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (notes_window->btn_menu), TRUE);
       notes_window_menu_new (notes_window);
       gtk_menu_popup (GTK_MENU (notes_window->menu),
                       NULL,
@@ -608,6 +613,7 @@
                       event->button.button,
                       event->button.time);
     }
+
   return FALSE;
 }
 
@@ -655,6 +661,7 @@
 {
   DBG ("Dettach window menu");
   gtk_menu_detach (GTK_MENU (notes_window->menu));
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (notes_window->btn_menu), FALSE);
 }
 
 static void

Modified: xfce4-notes-plugin/trunk/panel-plugin/panel-plugin.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/panel-plugin.c	2007-10-10 21:58:38 UTC (rev 3333)
+++ xfce4-notes-plugin/trunk/panel-plugin/panel-plugin.c	2007-10-10 21:58:51 UTC (rev 3334)
@@ -92,7 +92,7 @@
   notes_plugin->windows = NULL;
   /* notes_plugin->timeout_id = 0; FIXME */
 
-  notes_plugin->btn_panel = xfce_create_panel_button ();
+  notes_plugin->btn_panel = xfce_create_panel_toggle_button ();
   notes_plugin->icon_panel = gtk_image_new ();
   notes_plugin->tooltips = gtk_tooltips_new ();
 
@@ -232,8 +232,11 @@
 notes_plugin_menu_popup (NotesPlugin *notes_plugin,
                          GdkEvent *event)
 {
-  if (event->type == GDK_BUTTON_PRESS && event->button.button == 1)
+  gboolean state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (notes_plugin->btn_panel));
+
+  if (state == FALSE && event->type == GDK_BUTTON_PRESS && event->button.button == 1)
     {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (notes_plugin->btn_panel), TRUE);
       notes_plugin_menu_new (notes_plugin);
       gtk_menu_popup (GTK_MENU (notes_plugin->menu),
                       NULL,
@@ -283,6 +286,7 @@
 {
   DBG ("Dettach window menu");
   gtk_menu_detach (GTK_MENU (notes_plugin->menu));
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (notes_plugin->btn_panel), FALSE);
 }
 
 




More information about the Goodies-commits mailing list