SF.net SVN: geany-plugins:[1659] trunk/geany-plugins

dimitrov-adrian at users.sourceforge.net dimitrov-adrian at xxxxx
Sat Oct 16 18:37:05 UTC 2010


Revision: 1659
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1659&view=rev
Author:   dimitrov-adrian
Date:     2010-10-16 18:37:05 +0000 (Sat, 16 Oct 2010)

Log Message:
-----------
Fixed gio troubles (BIG THANKS TO Colomban Wendling)

Modified Paths:
--------------
    trunk/geany-plugins/build/treebrowser.m4
    trunk/geany-plugins/treebrowser/ChangeLog
    trunk/geany-plugins/treebrowser/src/Makefile.am
    trunk/geany-plugins/treebrowser/src/treebrowser.c

Modified: trunk/geany-plugins/build/treebrowser.m4
===================================================================
--- trunk/geany-plugins/build/treebrowser.m4	2010-10-16 15:48:45 UTC (rev 1658)
+++ trunk/geany-plugins/build/treebrowser.m4	2010-10-16 18:37:05 UTC (rev 1659)
@@ -1,5 +1,7 @@
 AC_DEFUN([GP_CHECK_TREEBROWSER],
 [
+    PKG_CHECK_MODULES([GIO], [gio-2.0],
+                      [AC_DEFINE([HAVE_GIO], 1, [Whether we have GIO])], [])
     GP_STATUS_PLUGIN_ADD([Treebrowser], [yes])
     AC_CONFIG_FILES([
         treebrowser/Makefile

Modified: trunk/geany-plugins/treebrowser/ChangeLog
===================================================================
--- trunk/geany-plugins/treebrowser/ChangeLog	2010-10-16 15:48:45 UTC (rev 1658)
+++ trunk/geany-plugins/treebrowser/ChangeLog	2010-10-16 18:37:05 UTC (rev 1659)
@@ -41,6 +41,8 @@
 16-10-2010 	Adrian Dimitrov 		<dimitrov.adrian at gmail.com>
 
 	* src/treebrowser.c
+		Fixed gio troubles (BIG THANKS TO Colomban Wendling)
+
 		Fixed unref data in utils_pixbuf_from_path()
 		Changed default icon for bookmarks to GTK_STOCK_HOME
 

Modified: trunk/geany-plugins/treebrowser/src/Makefile.am
===================================================================
--- trunk/geany-plugins/treebrowser/src/Makefile.am	2010-10-16 15:48:45 UTC (rev 1658)
+++ trunk/geany-plugins/treebrowser/src/Makefile.am	2010-10-16 18:37:05 UTC (rev 1659)
@@ -2,4 +2,5 @@
 
 geanyplugins_LTLIBRARIES = treebrowser.la
 treebrowser_la_SOURCES = treebrowser.c
-treebrowser_la_LIBADD = $(COMMONLIBS)
+treebrowser_la_CFLAGS = $(AM_CFLAGS) $(GIO_CFLAGS)
+treebrowser_la_LIBADD = $(COMMONLIBS) $(GIO_LIBS)

Modified: trunk/geany-plugins/treebrowser/src/treebrowser.c
===================================================================
--- trunk/geany-plugins/treebrowser/src/treebrowser.c	2010-10-16 15:48:45 UTC (rev 1658)
+++ trunk/geany-plugins/treebrowser/src/treebrowser.c	2010-10-16 18:37:05 UTC (rev 1659)
@@ -10,7 +10,7 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#ifdef HAVE_GIO_2_0
+#ifdef HAVE_GIO
 # include <gio/gio.h>
 #endif
 
@@ -150,9 +150,29 @@
 };
 
 
+/* ------------------
+ * TREEBROWSER CORE FUNCTIONS
+ * ------------------ */
+
+
 static GdkPixbuf *
+utils_pixbuf_from_stock(const gchar *stock_id)
+{
+	GtkIconSet 	*icon_set;
+
+	icon_set = gtk_icon_factory_lookup_default(stock_id);
+
+	if (icon_set)
+		return gtk_icon_set_render_icon(icon_set, gtk_widget_get_default_style(),
+										gtk_widget_get_default_direction(),
+										GTK_STATE_NORMAL, GTK_ICON_SIZE_MENU, NULL, NULL);
+	return NULL;
+}
+
+static GdkPixbuf *
 utils_pixbuf_from_path(gchar *path)
 {
+#ifdef HAVE_GIO
 	GIcon 		*icon;
 	GdkPixbuf 	*ret = NULL;
 	GtkIconInfo *info;
@@ -174,27 +194,13 @@
 		gtk_icon_info_free(info);
 	}
 	return ret;
+#else
+	return utils_pixbuf_from_stock(g_file_test(path, G_FILE_TEST_IS_DIR)
+									? GTK_STOCK_DIRECTORY
+									: GTK_STOCK_FILE);
+#endif
 }
 
-static GdkPixbuf *
-utils_pixbuf_from_stock(const gchar *stock_id)
-{
-	GtkIconSet 	*icon_set;
-
-	icon_set = gtk_icon_factory_lookup_default(stock_id);
-
-	if (icon_set)
-		return gtk_icon_set_render_icon(icon_set, gtk_widget_get_default_style(),
-										gtk_widget_get_default_direction(),
-										GTK_STATE_NORMAL, GTK_ICON_SIZE_MENU, NULL, NULL);
-	return NULL;
-}
-
-
-/* ------------------
- * TREEBROWSER CORE FUNCTIONS
- * ------------------ */
-
 static gboolean
 check_filtered(const gchar *base_name)
 {
@@ -246,7 +252,7 @@
 		return FALSE;
 
 #ifdef G_OS_WIN32
-#ifdef HAVE_GIO_2_0
+#ifdef HAVE_GIO
 	GError *error;
 	GFile *file;
 	GFileInfo *info;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list