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

Diego Ongaro ongardie at xfce.org
Tue Sep 25 01:54:16 CEST 2007


Author: ongardie
Date: 2007-09-24 23:54:16 +0000 (Mon, 24 Sep 2007)
New Revision: 3244

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

* view.c, model.h: Added primary action to bookmarks


Modified: xfce4-places-plugin/trunk/ChangeLog
===================================================================
--- xfce4-places-plugin/trunk/ChangeLog	2007-09-24 23:43:15 UTC (rev 3243)
+++ xfce4-places-plugin/trunk/ChangeLog	2007-09-24 23:54:16 UTC (rev 3244)
@@ -4,8 +4,8 @@
 	of places that didn't belong.
 	* view.c, support.{c,h}: Moved "Open" and "Open Terminal Here"
 	action creation into support.
+	* view.c, model.h: Added primary action to bookmarks
 
-
 2007-09-20	Diego Ongaro <ongardie at gmail.com>
 
 	* view.c: Adopt notes plugin menu position function (better

Modified: xfce4-places-plugin/trunk/panel-plugin/model.h
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/model.h	2007-09-24 23:43:15 UTC (rev 3243)
+++ xfce4-places-plugin/trunk/panel-plugin/model.h	2007-09-24 23:54:16 UTC (rev 3244)
@@ -53,14 +53,15 @@
 typedef struct _PlacesBookmark PlacesBookmark;
 struct _PlacesBookmark
 {
-    gchar               *label;         /* must not be NULL */
-    gchar               *uri;           /* may be NULL */
-    places_uri_scheme    uri_scheme;    
-    gchar               *icon;          /* may be NULL */
-    GList               *actions;       /* may be NULL (empty) */
+    gchar                 *label;          /* must not be NULL */
+    gchar                 *uri;            /* may be NULL */
+    places_uri_scheme      uri_scheme;    
+    gchar                 *icon;           /* may be NULL */
+    PlacesBookmarkAction  *primary_action; /* may be NULL */
+    GList                 *actions;        /* may be NULL (empty) */
 
-    gpointer             priv;          /* private data */
-    void               (*free) (PlacesBookmark *self);
+    gpointer               priv;           /* private data */
+    void                 (*free) (PlacesBookmark *self);
 };
 
 inline void

Modified: xfce4-places-plugin/trunk/panel-plugin/view.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/view.c	2007-09-24 23:43:15 UTC (rev 3243)
+++ xfce4-places-plugin/trunk/panel-plugin/view.c	2007-09-24 23:54:16 UTC (rev 3244)
@@ -426,18 +426,6 @@
 }
 
 static gboolean
-pview_cb_menu_item_do_main(PlacesView *pd, GtkWidget *menu_item)
-{
-        const gchar *uri = (const gchar*) g_object_get_data(G_OBJECT(menu_item), "uri");
-        if(uri != NULL){
-            places_load_thunar(uri);
-            return FALSE;
-        }
-        return TRUE;
-}
-
-
-static gboolean
 pview_cb_menu_item_press(GtkWidget *menu_item, GdkEventButton *event, PlacesView *pd)
 {
 
@@ -517,8 +505,6 @@
 
     if(bookmark->uri != NULL){
         
-        g_object_set_data(G_OBJECT(item), "uri", (gchar*) bookmark->uri);
-
         if(bookmark->uri_scheme != PLACES_URI_SCHEME_TRASH){
             terminal            = places_create_open_terminal_action(bookmark);
             bookmark->actions   = g_list_prepend(bookmark->actions, terminal);
@@ -526,20 +512,33 @@
 
         open                = places_create_open_action(bookmark);
         bookmark->actions   = g_list_prepend(bookmark->actions, open);
+        bookmark->primary_action = open;
 
-    }else{
-        /* Probably an unmounted volume. Gray it out. */
-        gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(item)), FALSE);
     }
 
-    if(bookmark->actions != NULL)
+    if(bookmark->actions != NULL){
+
         g_object_set_data(G_OBJECT(item), "actions", bookmark->actions);
+        
+        g_signal_connect(item, "button-release-event",
+                     G_CALLBACK(pview_cb_menu_item_press), view);
 
+    }
 
-    g_signal_connect(item, "button-release-event",
-                     G_CALLBACK(pview_cb_menu_item_press), view);
-    g_signal_connect_swapped(item, "activate",
-                     G_CALLBACK(pview_cb_menu_item_do_main), view);
+    if(bookmark->primary_action != NULL){
+
+        g_signal_connect_swapped(item, "activate",
+                                 G_CALLBACK(places_bookmark_action_call), 
+                                 bookmark->primary_action);
+
+    }else{
+
+        /* Gray it out. */
+        gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(item)),
+                                 FALSE);
+
+    }
+
     g_signal_connect_swapped(item, "destroy",
                      G_CALLBACK(places_bookmark_free), bookmark);
 




More information about the Goodies-commits mailing list