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

Diego Ongaro ongardie at xfce.org
Tue Sep 25 01:43:15 CEST 2007


Author: ongardie
Date: 2007-09-24 23:43:15 +0000 (Mon, 24 Sep 2007)
New Revision: 3243

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

* view.c, support.{c,h}: Moved "Open" and "Open Terminal Here"
action creation into support.


Modified: xfce4-places-plugin/trunk/ChangeLog
===================================================================
--- xfce4-places-plugin/trunk/ChangeLog	2007-09-24 23:27:25 UTC (rev 3242)
+++ xfce4-places-plugin/trunk/ChangeLog	2007-09-24 23:43:15 UTC (rev 3243)
@@ -1,8 +1,11 @@
 2007-09-24	Diego Ongaro <ongardie at gmail.com>
 
-	* places.{c,h}, support.{c,h}: Created the latter with the parts
-	of the former that didn't belong.
+	* places.{c,h}, support.{c,h}: Created support with the parts
+	of places that didn't belong.
+	* view.c, support.{c,h}: Moved "Open" and "Open Terminal Here"
+	action creation into support.
 
+
 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/support.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/support.c	2007-09-24 23:27:25 UTC (rev 3242)
+++ xfce4-places-plugin/trunk/panel-plugin/support.c	2007-09-24 23:43:15 UTC (rev 3243)
@@ -32,7 +32,7 @@
 #include "string.h"
 
 #include "support.h"
-#include "view.h"
+#include "model.h"
 
 /**
  * Opens Thunar at the location given by path.
@@ -113,4 +113,55 @@
         xfce_exec(cmd, FALSE, TRUE, NULL);
 }
 
+static void
+psupport_load_thunar_wrapper(PlacesBookmarkAction *act)
+{
+    g_assert(act != NULL);
+
+    /* we stored the path in priv */
+    places_load_thunar((gchar*) act->priv);
+}
+
+static void
+psupport_load_terminal_wrapper(PlacesBookmarkAction *act)
+{
+    g_assert(act != NULL);
+
+    /* we stored the path in priv */
+    places_load_terminal((gchar*) act->priv);
+}
+
+
+PlacesBookmarkAction*
+places_create_open_action(const PlacesBookmark *bookmark)
+{
+    PlacesBookmarkAction *action;
+
+    g_assert(bookmark != NULL);
+    g_assert(bookmark->uri != NULL);
+
+    action                = g_new0(PlacesBookmarkAction, 1);
+    action->label         = _("Open");
+    action->priv          = bookmark->uri;
+    action->action        = psupport_load_thunar_wrapper;
+
+    return action;
+}
+
+PlacesBookmarkAction*
+places_create_open_terminal_action(const PlacesBookmark *bookmark)
+{
+    PlacesBookmarkAction *action;
+
+    g_assert(bookmark != NULL);
+    g_assert(bookmark->uri != NULL);
+
+    action            = g_new0(PlacesBookmarkAction, 1);
+    action->label     = _("Open Terminal Here");
+    action->priv      = bookmark->uri;
+    action->action    = psupport_load_terminal_wrapper;
+
+    return action;
+}
+
 /* vim: set ai et tabstop=4: */

Modified: xfce4-places-plugin/trunk/panel-plugin/support.h
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/support.h	2007-09-24 23:27:25 UTC (rev 3242)
+++ xfce4-places-plugin/trunk/panel-plugin/support.h	2007-09-24 23:43:15 UTC (rev 3243)
@@ -23,12 +23,26 @@
 #define _XFCE_PANEL_PLACES_SUPPORT_H
 
 #include <glib.h>
+#include "model.h"
 
-void places_load_thunar(const gchar *path);
-void places_load_terminal(const gchar *path);
-void places_load_file(const gchar *path);
-void places_gui_exec(const gchar *cmd);
+void
+places_load_thunar(const gchar *path);
 
+void
+places_load_terminal(const gchar *path);
 
+void
+places_load_file(const gchar *path);
+
+void
+places_gui_exec(const gchar *cmd);
+
+PlacesBookmarkAction*
+places_create_open_action(const PlacesBookmark *bookmark);
+
+PlacesBookmarkAction*
+places_create_open_terminal_action(const PlacesBookmark *bookmark);
+
+
 #endif
 /* vim: set ai et tabstop=4: */

Modified: xfce4-places-plugin/trunk/panel-plugin/view.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/view.c	2007-09-24 23:27:25 UTC (rev 3242)
+++ xfce4-places-plugin/trunk/panel-plugin/view.c	2007-09-24 23:43:15 UTC (rev 3243)
@@ -473,27 +473,6 @@
 #endif
 
 
-/********** Model Visitor Callbacks **********/
-
-static void
-pview_load_thunar_wrapper(PlacesBookmarkAction *act)
-{
-    g_assert(act != NULL);
-
-    /* we stored the path in priv */
-    places_load_thunar((gchar*) act->priv);
-}
-
-static void
-pview_load_terminal_wrapper(PlacesBookmarkAction *act)
-{
-    g_assert(act != NULL);
-
-    /* we stored the path in priv */
-    places_load_terminal((gchar*) act->priv);
-}
-
-
 /********** UI Helpers **********/
 
 static void
@@ -541,17 +520,11 @@
         g_object_set_data(G_OBJECT(item), "uri", (gchar*) bookmark->uri);
 
         if(bookmark->uri_scheme != PLACES_URI_SCHEME_TRASH){
-            terminal            = g_new0(PlacesBookmarkAction, 1);
-            terminal->label     = _("Open Terminal Here");
-            terminal->priv      = bookmark->uri;
-            terminal->action    = pview_load_terminal_wrapper;
+            terminal            = places_create_open_terminal_action(bookmark);
             bookmark->actions   = g_list_prepend(bookmark->actions, terminal);
         }
 
-        open                = g_new0(PlacesBookmarkAction, 1);
-        open->label         = _("Open");
-        open->priv          = bookmark->uri;
-        open->action        = pview_load_thunar_wrapper;
+        open                = places_create_open_action(bookmark);
         bookmark->actions   = g_list_prepend(bookmark->actions, open);
 
     }else{




More information about the Goodies-commits mailing list