[Goodies-commits] r2683 - in xfce4-places-plugin/trunk: . panel-plugin

Diego Ongaro ongardie at xfce.org
Tue Apr 10 06:15:56 CEST 2007


Author: ongardie
Date: 2007-04-10 04:15:56 +0000 (Tue, 10 Apr 2007)
New Revision: 2683

Modified:
   xfce4-places-plugin/trunk/ChangeLog
   xfce4-places-plugin/trunk/panel-plugin/model.c
   xfce4-places-plugin/trunk/panel-plugin/places.c
   xfce4-places-plugin/trunk/panel-plugin/places.h
Log:
2007-04-09	Diego Ongaro <ongardie at gmail.com>

* Accidentally had the menu always rebuilding
* Made some callbacks listen on more appropriate listeners
* Added double quotes to paths/URIs sent to Thunar


Modified: xfce4-places-plugin/trunk/ChangeLog
===================================================================
--- xfce4-places-plugin/trunk/ChangeLog	2007-04-09 04:21:49 UTC (rev 2682)
+++ xfce4-places-plugin/trunk/ChangeLog	2007-04-10 04:15:56 UTC (rev 2683)
@@ -1,6 +1,9 @@
 2007-04-09	Diego Ongaro <ongardie at gmail.com>
 
 	* Added menu item to clear Recent Documents
+	* Accidentally had the menu always rebuilding
+	* Made some callbacks listen on more appropriate listeners
+	* Added double quotes to paths/URIs sent to Thunar
 
 2007-04-08	Diego Ongaro <ongardie at gmail.com>
 

Modified: xfce4-places-plugin/trunk/panel-plugin/model.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/model.c	2007-04-09 04:21:49 UTC (rev 2682)
+++ xfce4-places-plugin/trunk/panel-plugin/model.c	2007-04-10 04:15:56 UTC (rev 2683)
@@ -65,7 +65,7 @@
     changed = places_bookmarks_system_changed(b->system)    || changed;
     changed = places_bookmarks_volumes_changed(b->volumes)  || changed;
     changed = places_bookmarks_user_changed(b->user)        || changed;
-    return changed || TRUE;
+    return changed;
 }
 
 void

Modified: xfce4-places-plugin/trunk/panel-plugin/places.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/places.c	2007-04-09 04:21:49 UTC (rev 2682)
+++ xfce4-places-plugin/trunk/panel-plugin/places.c	2007-04-10 04:15:56 UTC (rev 2683)
@@ -54,13 +54,13 @@
     
     places_init_ui(pd);
 
-    g_signal_connect (pd->panel_button, "button-release-event",
-                      G_CALLBACK (places_cb_button_act), NULL);
+    g_signal_connect (pd->panel_button, "clicked",
+                      G_CALLBACK (places_cb_button_clicked), NULL);
    
     g_signal_connect (pd->panel_menu, "deactivate", 
                       G_CALLBACK(places_cb_menu_close), pd);
    
-    g_signal_connect (pd->panel_arrow, "button-press-event",
+    g_signal_connect (pd->panel_arrow, "clicked",
                       G_CALLBACK (places_cb_menu_open), pd);
 
     g_signal_connect (pd->plugin, "free-data", 
@@ -140,7 +140,7 @@
         }
     }
 
-    g_signal_connect(item, "button-release-event",
+    g_signal_connect(item, "activate",
                      G_CALLBACK(places_cb_menu_item_act), (gchar*) uri);
     gtk_menu_shell_append(GTK_MENU_SHELL(pd->panel_menu), item);
 }
@@ -183,7 +183,7 @@
                           gtk_separator_menu_item_new());
     GtkWidget *clear_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLEAR, NULL);
     gtk_menu_shell_append(GTK_MENU_SHELL(recent_menu), clear_item);
-    g_signal_connect(clear_item, "button-release-event",
+    g_signal_connect(clear_item, "activate",
                      G_CALLBACK(places_cb_recent_clear), NULL);
     
     GtkWidget *recent_item = gtk_image_menu_item_new_with_label(_("Recent Documents"));
@@ -207,9 +207,17 @@
 static void
 places_load_thunar(const gchar *path)
 {
-    gchar *cmd = g_strconcat("thunar ", path, NULL);
-    xfce_exec(cmd, FALSE, TRUE, NULL);
-    g_free(cmd);
+    if(path != NULL && *path != '\0'){
+
+        gchar *cmd = g_strconcat("thunar \"", path, "\"", NULL);
+        xfce_exec(cmd, FALSE, TRUE, NULL);
+        g_free(cmd);
+
+    }else{
+
+        xfce_exec("thunar", FALSE, TRUE, NULL);
+
+    }
 }
 
 /********** UI Helpers **********/
@@ -360,13 +368,10 @@
     places_close_menu(pd);
 }
 
-static gboolean
-places_cb_menu_open(GtkButton *arrow, GdkEventButton *event, PlacesData *pd){
+static void
+places_cb_menu_open(GtkButton *arrow, PlacesData *pd){
     g_assert(pd != NULL);
 
-    if(event->button == 3)
-        return FALSE;
-
     DBG("opening menu");
 
     if(pd->panel_menu_open){
@@ -396,29 +401,20 @@
                        0, gtk_get_current_event_time());
         pd->panel_menu_open = TRUE;
     }
-    return TRUE;
 }
 
-static gboolean
-places_cb_menu_item_act(GtkWidget *widget, GdkEventButton *event, const gchar* uri)
+static void
+places_cb_menu_item_act(GtkWidget *widget, const gchar* uri)
 {
     DBG("load thunar for item");
-
     places_load_thunar(uri);
-    
-    return FALSE;
 }
 
-static gboolean
-places_cb_button_act(GtkWidget *button, GdkEventButton *event, gpointer nu)
+static void
+places_cb_button_clicked(GtkWidget *button)
 {
-    if(event->button == 3) // Let the right-click menu come up
-        return FALSE;
-    
     DBG("load thunar at home directory");
-    
     places_load_thunar(NULL);
-    return FALSE;
 }
 
 static void 

Modified: xfce4-places-plugin/trunk/panel-plugin/places.h
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/places.h	2007-04-09 04:21:49 UTC (rev 2682)
+++ xfce4-places-plugin/trunk/panel-plugin/places.h	2007-04-10 04:15:56 UTC (rev 2683)
@@ -57,9 +57,9 @@
 static gboolean places_cb_size_changed(XfcePanelPlugin*, int, PlacesData*);
 static void places_cb_menu_position(GtkMenu*, int*, int*, gboolean*, PlacesData*);
 static void places_cb_menu_close(GtkMenuShell*, PlacesData*);
-static gboolean places_cb_menu_open(GtkButton*, GdkEventButton*, PlacesData*);
-static gboolean places_cb_menu_item_act(GtkWidget*, GdkEventButton*, const gchar*);
-static gboolean places_cb_button_act(GtkWidget*, GdkEventButton*, gpointer);
+static void places_cb_menu_open(GtkButton*, PlacesData*);
+static void places_cb_menu_item_act(GtkWidget*, const gchar*);
+static void places_cb_button_clicked(GtkWidget*);
 static void places_cb_free_data(XfcePanelPlugin*, PlacesData*);
 
 #endif




More information about the Goodies-commits mailing list