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

Diego Ongaro ongardie at xfce.org
Mon Jun 4 09:29:50 CEST 2007


Author: ongardie
Date: 2007-06-04 07:29:50 +0000 (Mon, 04 Jun 2007)
New Revision: 2812

Modified:
   xfce4-places-plugin/branches/umount/ChangeLog
   xfce4-places-plugin/branches/umount/configure.ac
   xfce4-places-plugin/branches/umount/panel-plugin/places.c
   xfce4-places-plugin/branches/umount/panel-plugin/places.h
   xfce4-places-plugin/branches/umount/panel-plugin/view.c
Log:
2007-06-04	Diego Ongaro <ongardie at gmail.com>

* unmount branch: added Open Terminal Here



Modified: xfce4-places-plugin/branches/umount/ChangeLog
===================================================================
--- xfce4-places-plugin/branches/umount/ChangeLog	2007-06-04 07:15:04 UTC (rev 2811)
+++ xfce4-places-plugin/branches/umount/ChangeLog	2007-06-04 07:29:50 UTC (rev 2812)
@@ -1,3 +1,7 @@
+2007-06-04	Diego Ongaro <ongardie at gmail.com>
+
+	* unmount branch: added Open Terminal Here
+
 2007-06-03	Diego Ongaro <ongardie at gmail.com>
 
 	* unmount branch: improved UI for context menu

Modified: xfce4-places-plugin/branches/umount/configure.ac
===================================================================
--- xfce4-places-plugin/branches/umount/configure.ac	2007-06-04 07:15:04 UTC (rev 2811)
+++ xfce4-places-plugin/branches/umount/configure.ac	2007-06-04 07:29:50 UTC (rev 2812)
@@ -28,6 +28,7 @@
 XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.3.99.1])
 XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.99.1])
 XDT_CHECK_PACKAGE([THUNAR_VFS], [thunar-vfs-1], [0.4.0])
+XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.1.10])
 
 XDT_FEATURE_DEBUG()
 

Modified: xfce4-places-plugin/branches/umount/panel-plugin/places.c
===================================================================
--- xfce4-places-plugin/branches/umount/panel-plugin/places.c	2007-06-04 07:15:04 UTC (rev 2811)
+++ xfce4-places-plugin/branches/umount/panel-plugin/places.c	2007-06-04 07:29:50 UTC (rev 2812)
@@ -24,11 +24,14 @@
 #include <gtk/gtk.h>
 #include <libxfce4panel/xfce-panel-plugin.h>
 #include <libxfcegui4/libxfcegui4.h>
+#include <exo/exo.h>
 
 #include "places.h"
 #include "model.h"
 #include "view.h"
 
+#include "string.h" // for strncmp
+
 static void places_construct(XfcePanelPlugin*);
 static void places_finalize(XfcePanelPlugin*, PlacesData*);
 
@@ -112,4 +115,32 @@
     }
 }
 
+void
+places_load_terminal(const gchar *path)
+{
+    gboolean free_path = FALSE;
+
+    if(path != NULL){
+        if(strstr(path, "trash://") != NULL){
+            DBG("Can't load terminal at trash:// URI's");
+            return;
+
+        }else if(strstr(path, "file://") != NULL){
+            path = g_filename_from_uri(path, NULL, NULL);
+            free_path = TRUE;
+        }
+    }
+
+    exo_execute_preferred_application("TerminalEmulator", NULL, path, NULL, NULL);
+
+    if(path != NULL && free_path)
+        g_free((gchar*) path);
+}
+
+void
+places_load_file(const gchar *path)
+{
+    exo_url_show(path, NULL, NULL);
+}
+
 // vim: ai et tabstop=4

Modified: xfce4-places-plugin/branches/umount/panel-plugin/places.h
===================================================================
--- xfce4-places-plugin/branches/umount/panel-plugin/places.h	2007-06-04 07:15:04 UTC (rev 2811)
+++ xfce4-places-plugin/branches/umount/panel-plugin/places.h	2007-06-04 07:29:50 UTC (rev 2812)
@@ -51,7 +51,9 @@
 
 };
 
-void places_load_thunar(const gchar*);
+void places_load_thunar(const gchar *path);
+void places_load_terminal(const gchar *path);
+void places_load_file(const gchar *path);
 
 #endif
 // vim: ai et tabstop=4

Modified: xfce4-places-plugin/branches/umount/panel-plugin/view.c
===================================================================
--- xfce4-places-plugin/branches/umount/panel-plugin/view.c	2007-06-04 07:15:04 UTC (rev 2811)
+++ xfce4-places-plugin/branches/umount/panel-plugin/view.c	2007-06-04 07:29:50 UTC (rev 2812)
@@ -38,6 +38,8 @@
 #include <libxfce4panel/xfce-panel-convenience.h>
 #include <libxfcegui4/libxfcegui4.h>
 
+#include <string.h>
+
 #include "view.h"
 #include "places.h"
 #include "model.h"
@@ -503,7 +505,7 @@
 places_view_cb_recent_item_open(GtkRecentChooser *chooser, PlacesData *pd)
 {
     gchar *uri = gtk_recent_chooser_get_current_uri(chooser);
-    places_load_thunar(uri);
+    places_load_file(uri);
     g_free(uri);
 }
 
@@ -575,6 +577,12 @@
 
 
 static void
+places_view_load_terminal_wrapper(gpointer path)
+{
+    places_load_terminal((gchar*) path);
+}
+
+static void
 places_view_add_menu_item(gpointer _pd, const gchar *label, const gchar *uri, const gchar *icon, GSList *actions)
 {
     g_assert(_pd != NULL);
@@ -600,11 +608,20 @@
         }
     }
 
-    if(uri != NULL)
-        g_object_set_data(G_OBJECT(item), "uri", (gchar*) uri);
-    else
+    if(uri != NULL){
+        
+        if(strstr(uri, "trash://") == NULL){
+            g_object_set_data(G_OBJECT(item), "uri", (gchar*) uri);
+            BookmarkAction *terminal = g_new0(BookmarkAction, 1);
+            terminal->label = "Open Terminal Here";
+            terminal->pass_thru = (gchar*) uri;
+            terminal->action = places_view_load_terminal_wrapper;
+            actions = g_slist_append(actions, terminal);
+        }
+    }else
         gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(item)), FALSE);
  
+
     if(actions != NULL)
         g_object_set_data_full(G_OBJECT(item), "actions", actions, (GDestroyNotify) g_slist_free);
 




More information about the Goodies-commits mailing list