[Goodies-commits] r2907 - in xfce4-places-plugin/branches/umount: . panel-plugin

Diego Ongaro ongardie at xfce.org
Fri Jul 13 06:10:33 CEST 2007


Author: ongardie
Date: 2007-07-13 04:10:33 +0000 (Fri, 13 Jul 2007)
New Revision: 2907

Modified:
   xfce4-places-plugin/branches/umount/ChangeLog
   xfce4-places-plugin/branches/umount/panel-plugin/model.c
   xfce4-places-plugin/branches/umount/panel-plugin/model.h
   xfce4-places-plugin/branches/umount/panel-plugin/model_volumes.c
   xfce4-places-plugin/branches/umount/panel-plugin/view.c
Log:
2007-07-12	Diego Ongaro <ongardie at gmail.com>

* unmount branch: Cleaned up view.c



Modified: xfce4-places-plugin/branches/umount/ChangeLog
===================================================================
--- xfce4-places-plugin/branches/umount/ChangeLog	2007-07-13 03:14:19 UTC (rev 2906)
+++ xfce4-places-plugin/branches/umount/ChangeLog	2007-07-13 04:10:33 UTC (rev 2907)
@@ -1,6 +1,6 @@
 2007-07-12	Diego Ongaro <ongardie at gmail.com>
 
-	* unmount branch: Cleaned up places.c, model_volumes.c
+	* unmount branch: Cleaned up places.c, view.c, model_volumes.c
 
 2007-06-04	Diego Ongaro <ongardie at gmail.com>
 

Modified: xfce4-places-plugin/branches/umount/panel-plugin/model.c
===================================================================
--- xfce4-places-plugin/branches/umount/panel-plugin/model.c	2007-07-13 03:14:19 UTC (rev 2906)
+++ xfce4-places-plugin/branches/umount/panel-plugin/model.c	2007-07-13 04:10:33 UTC (rev 2907)
@@ -118,4 +118,13 @@
     g_free(b);
 }
 
+void
+places_bookmark_actions_list_destroy(GSList *actions)
+{
+    if(actions != NULL){
+        g_slist_foreach(actions, (GFunc) g_free, NULL);
+        g_slist_free(actions);
+    }
+}
+
 // vim: ai et tabstop=4

Modified: xfce4-places-plugin/branches/umount/panel-plugin/model.h
===================================================================
--- xfce4-places-plugin/branches/umount/panel-plugin/model.h	2007-07-13 03:14:19 UTC (rev 2906)
+++ xfce4-places-plugin/branches/umount/panel-plugin/model.h	2007-07-13 04:10:33 UTC (rev 2907)
@@ -37,8 +37,11 @@
     gpointer    pass_thru;
     void        (*action)   (gpointer);
 } BookmarkAction;
+
 #define places_bookmark_action_call(act)   (act->action(act->pass_thru))
 
+void places_bookmark_actions_list_destroy(GSList *actions);
+
 typedef struct
 {
     gpointer   pass_thru;

Modified: xfce4-places-plugin/branches/umount/panel-plugin/model_volumes.c
===================================================================
--- xfce4-places-plugin/branches/umount/panel-plugin/model_volumes.c	2007-07-13 03:14:19 UTC (rev 2906)
+++ xfce4-places-plugin/branches/umount/panel-plugin/model_volumes.c	2007-07-13 04:10:33 UTC (rev 2907)
@@ -148,6 +148,7 @@
 static void
 places_bookmarks_volumes_unmount(gpointer _volume)
 {
+    DBG("Unmount");
     ThunarVfsVolume *volume = THUNAR_VFS_VOLUME(_volume);
     if(thunar_vfs_volume_is_mounted(volume))
         thunar_vfs_volume_unmount(volume, NULL, NULL);
@@ -156,6 +157,7 @@
 static void
 places_bookmarks_volumes_mount(gpointer _volume)
 {
+    DBG("Mount");
     ThunarVfsVolume *volume = THUNAR_VFS_VOLUME(_volume);
     if(!thunar_vfs_volume_is_mounted(volume))
         thunar_vfs_volume_mount(volume, NULL, NULL);

Modified: xfce4-places-plugin/branches/umount/panel-plugin/view.c
===================================================================
--- xfce4-places-plugin/branches/umount/panel-plugin/view.c	2007-07-13 03:14:19 UTC (rev 2906)
+++ xfce4-places-plugin/branches/umount/panel-plugin/view.c	2007-07-13 04:10:33 UTC (rev 2907)
@@ -498,31 +498,9 @@
     return FALSE;
 }
 
-// Recent Documents
-
-#if USE_RECENT_DOCUMENTS
-static void
-places_view_cb_recent_item_open(GtkRecentChooser *chooser, PlacesData *pd)
-{
-    gchar *uri = gtk_recent_chooser_get_current_uri(chooser);
-    places_load_file(uri);
-    g_free(uri);
-}
-
-static void
-places_view_cb_recent_items_clear(GtkWidget *clear_item)
-{
-    GtkRecentManager *manager = gtk_recent_manager_get_default();
-    gint removed = gtk_recent_manager_purge_items(manager, NULL);
-    DBG("Cleared %d recent items", removed);
-}
-#endif
-
-/********** Model Visitor Callbacks **********/
-
 void
 places_view_cb_menu_item_context_act(GtkWidget *item, PlacesData *pd)
-{ // TODO: move this
+{
     // we want the menu gone - now - since it prevents mouse grabs
     places_view_destroy_menu(pd);
     g_main_context_iteration(NULL, FALSE);
@@ -533,21 +511,22 @@
 
 gboolean
 places_view_cb_menu_item_press(GtkWidget *menu_item, GdkEventButton *event, PlacesData *pd)
-{ // TODO: move this
+{
 
-    if(event->button == 1){
+    gboolean ctrl =  (event->state & GDK_CONTROL_MASK) && 
+                    !(event->state & (GDK_MOD1_MASK|GDK_SHIFT_MASK|GDK_MOD4_MASK));
+
+    if(event->button == 1 && !ctrl){
         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;
-    }
 
-    if(event->button == 3){
+    }else if(event->button == 3 || (event->button == 1 && ctrl)){
     
-        DBG("menu item pressed");
-        GSList *actions = (GSList*) g_object_get_data(G_OBJECT(menu_item), "actions");
+        const GSList *actions = (const GSList*) g_object_get_data(G_OBJECT(menu_item), "actions");
         if(actions != NULL){
     
             GtkWidget *context = gtk_menu_new();
@@ -575,8 +554,29 @@
     return TRUE;
 }
 
+// Recent Documents
 
+#if USE_RECENT_DOCUMENTS
 static void
+places_view_cb_recent_item_open(GtkRecentChooser *chooser, PlacesData *pd)
+{
+    gchar *uri = gtk_recent_chooser_get_current_uri(chooser);
+    places_load_file(uri);
+    g_free(uri);
+}
+
+static void
+places_view_cb_recent_items_clear(GtkWidget *clear_item)
+{
+    GtkRecentManager *manager = gtk_recent_manager_get_default();
+    gint removed = gtk_recent_manager_purge_items(manager, NULL);
+    DBG("Cleared %d recent items", removed);
+}
+#endif
+
+/********** Model Visitor Callbacks **********/
+
+static void
 places_view_load_terminal_wrapper(gpointer path)
 {
     places_load_terminal((gchar*) path);
@@ -610,7 +610,7 @@
 
     if(uri != NULL){
         
-        if(strstr(uri, "trash://") == NULL){
+        if(strncmp(uri, "trash://", 8) != 0){
             g_object_set_data(G_OBJECT(item), "uri", (gchar*) uri);
             BookmarkAction *terminal = g_new0(BookmarkAction, 1);
             terminal->label = "Open Terminal Here";
@@ -623,8 +623,8 @@
  
 
     if(actions != NULL)
-        g_object_set_data_full(G_OBJECT(item), "actions", actions, (GDestroyNotify) g_slist_free);
-
+        g_object_set_data_full(G_OBJECT(item), "actions", actions, (GDestroyNotify) places_bookmark_actions_list_destroy);
+        
     g_signal_connect(item, "button-release-event",
                      G_CALLBACK(places_view_cb_menu_item_press), pd);
 




More information about the Goodies-commits mailing list