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

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


Author: ongardie
Date: 2007-09-24 23:27:25 +0000 (Mon, 24 Sep 2007)
New Revision: 3242

Added:
   xfce4-places-plugin/trunk/panel-plugin/support.c
   xfce4-places-plugin/trunk/panel-plugin/support.h
Modified:
   xfce4-places-plugin/trunk/ChangeLog
   xfce4-places-plugin/trunk/panel-plugin/Makefile.am
   xfce4-places-plugin/trunk/panel-plugin/cfg.c
   xfce4-places-plugin/trunk/panel-plugin/places.c
   xfce4-places-plugin/trunk/panel-plugin/places.h
   xfce4-places-plugin/trunk/panel-plugin/view.c
   xfce4-places-plugin/trunk/panel-plugin/view.h
Log:
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.


Modified: xfce4-places-plugin/trunk/ChangeLog
===================================================================
--- xfce4-places-plugin/trunk/ChangeLog	2007-09-23 14:43:36 UTC (rev 3241)
+++ xfce4-places-plugin/trunk/ChangeLog	2007-09-24 23:27:25 UTC (rev 3242)
@@ -1,3 +1,8 @@
+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.
+
 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/Makefile.am
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/Makefile.am	2007-09-23 14:43:36 UTC (rev 3241)
+++ xfce4-places-plugin/trunk/panel-plugin/Makefile.am	2007-09-24 23:27:25 UTC (rev 3242)
@@ -6,6 +6,8 @@
 xfce4_places_plugin_SOURCES =						\
 	places.c							\
 	places.h							\
+	support.c							\
+	support.h							\
 	view.c								\
 	view.h								\
 	cfg.c								\

Modified: xfce4-places-plugin/trunk/panel-plugin/cfg.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/cfg.c	2007-09-23 14:43:36 UTC (rev 3241)
+++ xfce4-places-plugin/trunk/panel-plugin/cfg.c	2007-09-24 23:27:25 UTC (rev 3242)
@@ -27,6 +27,7 @@
 
 #include <gtk/gtk.h>
 
+#include <libxfce4util/libxfce4util.h>
 #include <libxfce4panel/xfce-panel-plugin.h>
 #include <libxfce4panel/xfce-panel-convenience.h>
 #include <libxfcegui4/libxfcegui4.h>

Modified: xfce4-places-plugin/trunk/panel-plugin/places.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/places.c	2007-09-23 14:43:36 UTC (rev 3241)
+++ xfce4-places-plugin/trunk/panel-plugin/places.c	2007-09-24 23:27:25 UTC (rev 3242)
@@ -1,7 +1,6 @@
 /*  xfce4-places-plugin
  *
  *  This is the main plugin file. It starts the init and finalize processes.
- *  Also, this file provides wrappers to open external applications.
  *
  *  Copyright (c) 2007 Diego Ongaro <ongardie at gmail.com>
  *
@@ -26,16 +25,12 @@
 
 #include <glib.h>
 
+#include <libxfce4util/libxfce4util.h>
 #include <libxfce4panel/xfce-panel-plugin.h>
-#include <libxfcegui4/libxfcegui4.h>
-#include <exo/exo.h>
 
-#include "string.h"
-
 #include "places.h"
 #include "view.h"
 
-
 /**
  * Cleans up resources.
  */
@@ -75,85 +70,4 @@
 
 XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL(places_construct);
 
-
-
-/**
- * Opens Thunar at the location given by path.
- * If path is NULL or empty, it will open Thunar at the default location (home).
- * The caller is in charge of freeing path.
- */
-void
-places_load_thunar(const gchar *path)
-{
-    if(path != NULL && *path != '\0'){
-
-        gchar *cmd = g_strconcat("thunar \"", path, "\"", NULL);
-        DBG("exec: %s", cmd);
-        places_gui_exec(cmd);
-        g_free(cmd);
-
-    }else{
-        DBG("exec: thunar");
-        places_gui_exec("thunar");
-    }
-}
-
-/**
- * Opens the terminal at the location given by path.
- * If path is NULL or empty, it will open the terminal at the default location (home).
- * The caller is in charge of freeing path.
- */
-void
-places_load_terminal(const gchar *const_path)
-{
-    gchar *path = NULL;
-    gboolean path_owner = FALSE; /* whether this function "owns" path */
-
-    if(const_path != NULL){
-        if(strncmp(const_path, "trash://", 8) == 0){
-            DBG("Can't load terminal at trash:// URI's");
-            return;
-
-        }else if(strncmp(const_path, "file://", 7) == 0){
-            path = g_filename_from_uri(const_path, NULL, NULL);
-            path_owner = TRUE;
-
-        }else{
-            path = (gchar*) const_path;
-            /* (path_owner is FALSE) */
-            
-        }
-    }
-
-    DBG("Open terminal emulator at %s", path);
-    exo_execute_preferred_application("TerminalEmulator", NULL, path, NULL, NULL);
-
-    if(path_owner && path != NULL)
-        g_free(path);
-}
-
-/**
- * Loads the file given by path.
- * If path is NULL or empty, it will do nothing.
- * The caller is in charge of freeing path.
- */
-void
-places_load_file(const gchar *path)
-{
-    if(path != NULL && *path != '\0')
-        exo_url_show(path, NULL, NULL);
-}
-
-/**
- * Runs the graphical command given by cmd
- * If cmd is NULL or empty, it will do nothing.
- * The caller is in charge of freeing cmd.
- */
-void
-places_gui_exec(const gchar *cmd)
-{
-    if(cmd != NULL && *cmd != '\0')
-        xfce_exec(cmd, FALSE, TRUE, NULL);
-}
-
 /* vim: set ai et tabstop=4: */

Modified: xfce4-places-plugin/trunk/panel-plugin/places.h
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/places.h	2007-09-23 14:43:36 UTC (rev 3241)
+++ xfce4-places-plugin/trunk/panel-plugin/places.h	2007-09-24 23:27:25 UTC (rev 3242)
@@ -1,7 +1,5 @@
 /*  xfce4-places-plugin
  *
- *  Headers for wrappers to open external applications.
- *
  *  Copyright (c) 2007 Diego Ongaro <ongardie at gmail.com>
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -22,15 +20,7 @@
 #ifndef _XFCE_PANEL_PLACES_H
 #define _XFCE_PANEL_PLACES_H
 
-#include <glib.h>
-
 #define PLUGIN_NAME "places"
 
-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);
-
-
 #endif
 /* vim: set ai et tabstop=4: */

Added: xfce4-places-plugin/trunk/panel-plugin/support.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/support.c	                        (rev 0)
+++ xfce4-places-plugin/trunk/panel-plugin/support.c	2007-09-24 23:27:25 UTC (rev 3242)
@@ -0,0 +1,116 @@
+/*  xfce4-places-plugin
+ *
+ *  This file provides wrappers to open external applications.
+ *
+ *  Copyright (c) 2007 Diego Ongaro <ongardie at gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <glib.h>
+
+#include <libxfce4util/libxfce4util.h>
+#include <libxfcegui4/libxfcegui4.h>
+#include <exo/exo.h>
+
+#include "string.h"
+
+#include "support.h"
+#include "view.h"
+
+/**
+ * Opens Thunar at the location given by path.
+ * If path is NULL or empty, it will open Thunar at the default location (home).
+ * The caller is in charge of freeing path.
+ */
+void
+places_load_thunar(const gchar *path)
+{
+    if(path != NULL && *path != '\0'){
+
+        gchar *cmd = g_strconcat("thunar \"", path, "\"", NULL);
+        DBG("exec: %s", cmd);
+        places_gui_exec(cmd);
+        g_free(cmd);
+
+    }else{
+        DBG("exec: thunar");
+        places_gui_exec("thunar");
+    }
+}
+
+/**
+ * Opens the terminal at the location given by path.
+ * If path is NULL or empty, it will open the terminal at the default location (home).
+ * The caller is in charge of freeing path.
+ */
+void
+places_load_terminal(const gchar *const_path)
+{
+    gchar *path = NULL;
+    gboolean path_owner = FALSE; /* whether this function "owns" path */
+
+    if(const_path != NULL){
+        if(strncmp(const_path, "trash://", 8) == 0){
+            DBG("Can't load terminal at trash:// URI's");
+            return;
+
+        }else if(strncmp(const_path, "file://", 7) == 0){
+            path = g_filename_from_uri(const_path, NULL, NULL);
+            path_owner = TRUE;
+
+        }else{
+            path = (gchar*) const_path;
+            /* (path_owner is FALSE) */
+            
+        }
+    }
+
+    DBG("Open terminal emulator at %s", path);
+    exo_execute_preferred_application("TerminalEmulator", NULL, path, NULL, NULL);
+
+    if(path_owner && path != NULL)
+        g_free(path);
+}
+
+/**
+ * Loads the file given by path.
+ * If path is NULL or empty, it will do nothing.
+ * The caller is in charge of freeing path.
+ */
+void
+places_load_file(const gchar *path)
+{
+    if(path != NULL && *path != '\0')
+        exo_url_show(path, NULL, NULL);
+}
+
+/**
+ * Runs the graphical command given by cmd
+ * If cmd is NULL or empty, it will do nothing.
+ * The caller is in charge of freeing cmd.
+ */
+void
+places_gui_exec(const gchar *cmd)
+{
+    if(cmd != NULL && *cmd != '\0')
+        xfce_exec(cmd, FALSE, TRUE, NULL);
+}
+
+/* vim: set ai et tabstop=4: */

Added: xfce4-places-plugin/trunk/panel-plugin/support.h
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/support.h	                        (rev 0)
+++ xfce4-places-plugin/trunk/panel-plugin/support.h	2007-09-24 23:27:25 UTC (rev 3242)
@@ -0,0 +1,34 @@
+/*  xfce4-places-plugin
+ *
+ *  Headers for wrappers to open external applications.
+ *
+ *  Copyright (c) 2007 Diego Ongaro <ongardie at gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _XFCE_PANEL_PLACES_SUPPORT_H
+#define _XFCE_PANEL_PLACES_SUPPORT_H
+
+#include <glib.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);
+
+
+#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-23 14:43:36 UTC (rev 3241)
+++ xfce4-places-plugin/trunk/panel-plugin/view.c	2007-09-24 23:27:25 UTC (rev 3242)
@@ -40,14 +40,15 @@
 
 #include <gtk/gtk.h>
 
+#include <libxfce4util/libxfce4util.h>
 #include <libxfce4panel/xfce-panel-plugin.h>
 #include <libxfce4panel/xfce-panel-convenience.h>
 #include <libxfcegui4/libxfcegui4.h>
 
 #include <string.h>
 
-#include "places.h"
 #include "view.h"
+#include "support.h"
 #include "cfg.h"
 #include "model.h"
 #include "model_system.h"

Modified: xfce4-places-plugin/trunk/panel-plugin/view.h
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/view.h	2007-09-23 14:43:36 UTC (rev 3241)
+++ xfce4-places-plugin/trunk/panel-plugin/view.h	2007-09-24 23:27:25 UTC (rev 3242)
@@ -24,7 +24,8 @@
 #define _XFCE_PANEL_PLACES_VIEW_H
 
 #include <glib.h>
-#include "places.h"
+#include <gtk/gtk.h>
+#include <libxfce4panel/xfce-panel-plugin.h>
 
 #if GTK_CHECK_VERSION(2,10,0)
 #  define USE_RECENT_DOCUMENTS TRUE




More information about the Goodies-commits mailing list