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

dimitrov-adrian at users.sourceforge.net dimitrov-adrian at xxxxx
Mon Apr 19 19:57:50 UTC 2010


Revision: 1256
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1256&view=rev
Author:   dimitrov-adrian
Date:     2010-04-19 19:57:49 +0000 (Mon, 19 Apr 2010)

Log Message:
-----------
Treebrowser: following default font defined in geany prefs; fixed hidding hidden files on windows

Modified Paths:
--------------
    trunk/geany-plugins/treebrowser/ChangeLog
    trunk/geany-plugins/treebrowser/src/treebrowser.c

Modified: trunk/geany-plugins/treebrowser/ChangeLog
===================================================================
--- trunk/geany-plugins/treebrowser/ChangeLog	2010-04-19 16:32:01 UTC (rev 1255)
+++ trunk/geany-plugins/treebrowser/ChangeLog	2010-04-19 19:57:49 UTC (rev 1256)
@@ -4,7 +4,7 @@
 +---------------------------+
 
 	* crytical warning when unloading the plugin
-	* show/hide hidden files not working on Windows
+	(FIXED) show/hide hidden files not working on Windows
 
 
 +---------------------------+
@@ -16,7 +16,6 @@
 	(DONE) tracking path to current focused document (work only for refreshed directories)
 	* Better tracking for files, open path to them
 	* In windows can choice between devices (C:\, D:\,...)
-	* Windows compitable
 	* Language files
 	(DONE) Saving state of Showbars in config file everytime where is changed
 	(DONE) oneclick document opening
@@ -24,12 +23,20 @@
 	* fix possible memory leaks (using g_free... where is need)
 	* Folowing path from current document view
 	(DONE) Hide object files as native filebroser (*.o;*.a;*.so;*.dll;*.lib..)
+	(DONE) Using font from geany settings for sidebar
 
 
 +-------------------------------+
 | Development release ChangeLog |
 +-------------------------------+
 
+19-04-2010 	Adrian Dimitrov 		<dimitrov.adrian at gmail.com>
+
+	* src/treebrowser.c
+		added clear icon in filter // thanks to native filebrowser plugin
+		using font from geany settings for sidebar  // thanks to native filebrowser plugin
+
+
 17-04-2010 	Adrian Dimitrov 		<dimitrov.adrian at gmail.com>
 
 	* src/treebrowser.c

Modified: trunk/geany-plugins/treebrowser/src/treebrowser.c
===================================================================
--- trunk/geany-plugins/treebrowser/src/treebrowser.c	2010-04-19 16:32:01 UTC (rev 1255)
+++ trunk/geany-plugins/treebrowser/src/treebrowser.c	2010-04-19 19:57:49 UTC (rev 1256)
@@ -7,6 +7,10 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
+#ifdef HAVE_GIO
+# include <gio/gio.h>
+#endif
+
 #include "geanyplugin.h"
 
 /* These items are set by Geany before plugin_init() is called. */
@@ -73,7 +77,7 @@
  * ------------------ */
 
 PLUGIN_VERSION_CHECK(147)
-PLUGIN_SET_INFO(_("Tree Browser"), _("Treeview filebrowser plugin."), "0.1" , "Adrian Dimitrov (dimitrov.adrian at gmail.com)")
+PLUGIN_SET_INFO(_("Tree Browser"), _("Treeview filebrowser plugin."), "0.2" , "Adrian Dimitrov (dimitrov.adrian at gmail.com)")
 
 
 /* ------------------
@@ -155,6 +159,50 @@
 	return CONFIG_REVERSE_FILTER || temporary_reverse ? TRUE : FALSE;
 }
 
+static gboolean
+check_hidden(const gchar *uri)
+{
+	if (CONFIG_SHOW_HIDDEN_FILES)
+		return TRUE;
+
+#ifdef G_OS_WIN32
+#ifdef HAVE_GIO
+	GError *error = NULL;
+	GFile *file;
+	GFileInfo *info;
+
+	file = g_file_new_for_path(uri);
+	info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN, 0, NULL, &error);
+	if (error)
+	{
+		g_error_free(error);
+		g_object_unref(file);
+		return TRUE;
+	}
+	else
+	{
+		if (g_file_info_get_is_hidden (info))
+		{
+			g_error_free(error);
+			g_object_unref(file);
+			return FALSE;
+		}
+		g_error_free(error);
+		g_object_unref(file);
+		return TRUE;
+	}
+#else
+	return TRUE;
+#endif
+
+#else
+	if (g_path_get_basename(uri) [0] == '.')
+		return FALSE;
+	else
+		return TRUE;
+#endif
+}
+
 static gchar*
 get_default_dir(void)
 {
@@ -196,7 +244,7 @@
 treebrowser_browse(gchar *directory, gpointer parent, gint deep_limit)
 {
 	GtkTreeIter 	iter, iter_empty, *last_dir_iter = NULL;
-	gboolean 		is_dir;
+	gboolean 		is_dir, is_hidden;
 	gboolean 		expanded = FALSE;
 	gchar 			*utf8_name;
 	GSList 			*list, *node;
@@ -223,7 +271,7 @@
 			is_dir 			= g_file_test (uri, G_FILE_TEST_IS_DIR);
 			utf8_name 		= utils_get_utf8_from_locale(fname);
 
-			if (!(fname[0] == '.' && CONFIG_SHOW_HIDDEN_FILES == FALSE))
+			if (check_hidden(uri))
 			{
 				if (is_dir)
 				{
@@ -326,12 +374,12 @@
 		while (name != NULL)
 		{
 			gchar *path;
-			path = g_build_filename (root, name, NULL);
-			if (g_file_test (path, G_FILE_TEST_IS_DIR))
+			path = g_build_filename(root, name, NULL);
+			if (g_file_test(path, G_FILE_TEST_IS_DIR))
 				fs_remove(path, delete_root);
 			g_remove(path);
 			name = g_dir_read_name(dir);
-			g_free (path);
+			g_free(path);
 		}
 	}
 	else
@@ -783,7 +831,14 @@
 	treebrowser_chroot(addressbar_last_address);
 }
 
+static void
+on_filter_clear(GtkEntry *entry, gint icon_pos, GdkEvent *event, gpointer data)
+{
+	gtk_entry_set_text(entry, "");
+	treebrowser_chroot(addressbar_last_address);
+}
 
+
 /* ------------------
  * TREEVIEW EVENTS
  * ------------------ */
@@ -958,6 +1013,8 @@
 
 	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
 
+	ui_widget_modify_font_from_string(view, geany->interface_prefs->tagbar_font);
+
 	gtk_tree_view_append_column(GTK_TREE_VIEW(view), treeview_column_text);
 
 	gtk_tree_view_column_pack_start(treeview_column_text, render_icon, FALSE);
@@ -1034,6 +1091,12 @@
 
 	ui_widget_set_tooltip_text(filter,
 		_("Filter (*.c;*.h;*.cpp), and if you want temporary filter using the '!' reverse try for example this '!;*.c;*.h;*.cpp'"));
+	if (gtk_check_version(2, 15, 2) == NULL)
+	{
+		ui_entry_add_clear_icon(GTK_ENTRY(filter));
+		g_signal_connect(filter, "icon-release", G_CALLBACK(on_filter_clear), NULL);
+	}
+
 	ui_widget_set_tooltip_text(addressbar,
 		_("Addressbar for example '/projects/my-project'"));
 


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