Revision: 1251 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1251&view=re... Author: dimitrov-adrian Date: 2010-04-17 14:46:50 +0000 (Sat, 17 Apr 2010)
Log Message: ----------- Treebrowser: added option to hide object files
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-16 18:34:12 UTC (rev 1250) +++ trunk/geany-plugins/treebrowser/ChangeLog 2010-04-17 14:46:50 UTC (rev 1251) @@ -12,7 +12,7 @@
(DONE) codestyle improve to be same as other parts as geany`s (DONE) configuration dialog - (DONE) tracking path to current focused document (currently now roking on Windows) + (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 @@ -21,16 +21,26 @@ (DONE) oneclick document opening (DONE) filter separating ex.: "*.c;*.cpp;*.h" * 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..)
+-------------------------------+ | Development release ChangeLog | +-------------------------------+
+17-04-2010 Adrian Dimitrov dimitrov.adrian@gmail.com + + * src/treebrowser.c + added option to hide object files *.so;*.obj;*.so;*.dll;*.a;*.lib + fixed a few warnings + + 14-04-2010 Adrian Dimitrov dimitrov.adrian@gmail.com
* src/treebrowser.c strings cleanup + (This is version 0.2, because the plugin become 2 months old :)
11-04-2010 Adrian Dimitrov dimitrov.adrian@gmail.com @@ -38,7 +48,7 @@ * src/treebrowser.c fixed bug when turned off "On expand refresh" fixed runtime crytical warnings reported in http://nopaste.geany.org/p/m3f018a3e - and thanks to Enrico to help with gdb :) + and thanks to Enrico for help with gdb :) added empty element when directory not filled, and changed default option values for "On expand refresh"
Modified: trunk/geany-plugins/treebrowser/src/treebrowser.c =================================================================== --- trunk/geany-plugins/treebrowser/src/treebrowser.c 2010-04-16 18:34:12 UTC (rev 1250) +++ trunk/geany-plugins/treebrowser/src/treebrowser.c 2010-04-17 14:46:50 UTC (rev 1251) @@ -23,8 +23,6 @@ static GtkWidget *addressbar; static gchar *addressbar_last_address = NULL;
-static GtkWidget *menu_showbars; - static GtkTreeViewColumn *treeview_column_icon, *treeview_column_text; static GtkCellRenderer *render_icon, *render_text;
@@ -45,6 +43,7 @@ static gboolean CONFIG_REVERSE_FILTER = FALSE; static gboolean CONFIG_ONE_CLICK_CHDOC = FALSE; static gboolean CONFIG_SHOW_HIDDEN_FILES = FALSE; +static gboolean CONFIG_HIDE_OBJECT_FILES = FALSE; static gboolean CONFIG_SHOW_BARS = TRUE; static gboolean CONFIG_CHROOT_ON_DCLICK = FALSE; static gboolean CONFIG_FOLLOW_CURRENT_DOC = TRUE; @@ -126,8 +125,16 @@ { gchar **filters; gint i; - gboolean temporary_reverse = FALSE; + gboolean temporary_reverse = FALSE; + const gchar *exts[] = {".o", ".obj", ".so", ".dll", ".a", ".lib"};
+ if (CONFIG_HIDE_OBJECT_FILES) + for (i = 0; exts[i]; i++) + { + if (g_str_has_suffix(base_name, exts[i])) + return FALSE; + } + if (! NZV(gtk_entry_get_text(GTK_ENTRY(filter)))) return TRUE;
@@ -201,7 +208,7 @@
directory = g_strconcat(directory, G_DIR_SEPARATOR_S, NULL);
- if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(treeview), gtk_tree_model_get_path(GTK_TREE_MODEL(treestore), parent))) + if (parent && gtk_tree_view_row_expanded(GTK_TREE_VIEW(treeview), gtk_tree_model_get_path(GTK_TREE_MODEL(treestore), parent))) expanded = TRUE;
gtk_tree_store_iter_clear_nodes(parent, FALSE); @@ -262,7 +269,7 @@ g_free(uri); } } - if (expanded) + if (parent && expanded) gtk_tree_view_expand_row(GTK_TREE_VIEW(treeview), gtk_tree_model_get_path(GTK_TREE_MODEL(treestore), parent), FALSE); }
@@ -345,7 +352,6 @@ gtk_widget_hide(sidebar_vbox_bars);
CONFIG_SHOW_BARS = state; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_showbars), CONFIG_SHOW_BARS); save_settings(); }
@@ -360,10 +366,8 @@ gtk_tree_store_iter_clear_nodes(&i, TRUE); gtk_tree_store_remove(GTK_TREE_STORE(treestore), &i); } - if (delete_root) gtk_tree_store_remove(GTK_TREE_STORE(treestore), iter); - }
static gboolean @@ -508,6 +512,7 @@ if (g_creat(uri_new, 0755) != -1) treebrowser_browse(uri, refresh_root ? NULL : &iter, CONFIG_INITIAL_DIR_DEEP); } + }
static void @@ -603,6 +608,14 @@ }
static void +on_menu_show_hidden_files(GtkMenuItem *menuitem, gpointer *user_data) +{ + CONFIG_SHOW_HIDDEN_FILES = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem)); + save_settings(); + treebrowser_browse(addressbar_last_address, NULL, CONFIG_INITIAL_DIR_DEEP); +} + +static void on_menu_show_bars(GtkMenuItem *menuitem, gpointer *user_data) { showbars(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))); @@ -693,11 +706,15 @@ gtk_container_add(GTK_CONTAINER(menu), item); }
- menu_showbars = gtk_check_menu_item_new_with_mnemonic(_("Show bars")); + item = gtk_check_menu_item_new_with_mnemonic(_("Show hidden files")); + gtk_container_add(GTK_CONTAINER(menu), item); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), CONFIG_SHOW_HIDDEN_FILES); + g_signal_connect(item, "activate", G_CALLBACK(on_menu_show_hidden_files), NULL);
- gtk_container_add(GTK_CONTAINER(menu), menu_showbars); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_showbars), CONFIG_SHOW_BARS); - g_signal_connect(menu_showbars, "activate", G_CALLBACK(on_menu_show_bars), NULL); + item = gtk_check_menu_item_new_with_mnemonic(_("Show bars")); + gtk_container_add(GTK_CONTAINER(menu), item); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), CONFIG_SHOW_BARS); + g_signal_connect(item, "activate", G_CALLBACK(on_menu_show_bars), NULL);
gtk_widget_show_all(menu);
@@ -744,7 +761,7 @@ { gchar *directory = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
- static const GdkColor red = {0, 0xffff, 0x6666, 0x6666}; + static const GdkColor red = {0, 0xffff, 0x6666, 0x6666}; static const GdkColor white = {0, 0xffff, 0xffff, 0xffff}; static gboolean old_value = TRUE; gboolean success = g_file_test(directory, G_FILE_TEST_IS_DIR); @@ -776,7 +793,7 @@ { GtkTreeIter iter; GtkTreeModel *model; - gchar *name = NULL, *uri = NULL; + gchar *name = "", *uri = "";
if (gtk_tree_selection_get_selected(selection, &model, &iter)) { @@ -966,14 +983,13 @@ GtkWidget *wid; GtkTreeSelection *selection;
- treeview = create_view_and_model(); - menu_showbars = gtk_check_menu_item_new(); - sidebar_vbox = gtk_vbox_new(FALSE, 0); - sidebar_vbox_bars = gtk_vbox_new(FALSE, 0); - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); - addressbar = gtk_entry_new(); - filter = gtk_entry_new(); - scrollwin = gtk_scrolled_window_new(NULL, NULL); + treeview = create_view_and_model(); + sidebar_vbox = gtk_vbox_new(FALSE, 0); + sidebar_vbox_bars = gtk_vbox_new(FALSE, 0); + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); + addressbar = gtk_entry_new(); + filter = gtk_entry_new(); + scrollwin = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@@ -1052,6 +1068,7 @@ GtkWidget *REVERSE_FILTER; GtkWidget *ONE_CLICK_CHDOC; GtkWidget *SHOW_HIDDEN_FILES; + GtkWidget *HIDE_OBJECT_FILES; GtkWidget *SHOW_BARS; GtkWidget *CHROOT_ON_DCLICK; GtkWidget *FOLLOW_CURRENT_DOC; @@ -1072,6 +1089,7 @@ CONFIG_REVERSE_FILTER = utils_get_setting_boolean(config, "treebrowser", "reverse_filter", CONFIG_REVERSE_FILTER); CONFIG_ONE_CLICK_CHDOC = utils_get_setting_boolean(config, "treebrowser", "one_click_chdoc", CONFIG_ONE_CLICK_CHDOC); CONFIG_SHOW_HIDDEN_FILES = utils_get_setting_boolean(config, "treebrowser", "show_hidden_files", CONFIG_SHOW_HIDDEN_FILES); + CONFIG_HIDE_OBJECT_FILES = utils_get_setting_boolean(config, "treebrowser", "hide_object_files", CONFIG_HIDE_OBJECT_FILES); CONFIG_SHOW_BARS = utils_get_setting_boolean(config, "treebrowser", "show_bars", CONFIG_SHOW_BARS); CONFIG_CHROOT_ON_DCLICK = utils_get_setting_boolean(config, "treebrowser", "chroot_on_dclick", CONFIG_CHROOT_ON_DCLICK); CONFIG_FOLLOW_CURRENT_DOC = utils_get_setting_boolean(config, "treebrowser", "follow_current_doc", CONFIG_FOLLOW_CURRENT_DOC); @@ -1097,6 +1115,7 @@ g_key_file_set_boolean(config, "treebrowser", "reverse_filter", CONFIG_REVERSE_FILTER); g_key_file_set_boolean(config, "treebrowser", "one_click_chdoc", CONFIG_ONE_CLICK_CHDOC); g_key_file_set_boolean(config, "treebrowser", "show_hidden_files", CONFIG_SHOW_HIDDEN_FILES); + g_key_file_set_boolean(config, "treebrowser", "hide_object_files", CONFIG_HIDE_OBJECT_FILES); g_key_file_set_boolean(config, "treebrowser", "show_bars", CONFIG_SHOW_BARS); g_key_file_set_boolean(config, "treebrowser", "chroot_on_dclick", CONFIG_CHROOT_ON_DCLICK); g_key_file_set_boolean(config, "treebrowser", "follow_current_doc", CONFIG_FOLLOW_CURRENT_DOC); @@ -1122,6 +1141,7 @@ CONFIG_REVERSE_FILTER = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configure_widgets.REVERSE_FILTER)); CONFIG_ONE_CLICK_CHDOC = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configure_widgets.ONE_CLICK_CHDOC)); CONFIG_SHOW_HIDDEN_FILES = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configure_widgets.SHOW_HIDDEN_FILES)); + CONFIG_HIDE_OBJECT_FILES = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configure_widgets.HIDE_OBJECT_FILES)); CONFIG_CHROOT_ON_DCLICK = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configure_widgets.CHROOT_ON_DCLICK)); CONFIG_FOLLOW_CURRENT_DOC = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configure_widgets.FOLLOW_CURRENT_DOC)); CONFIG_ON_EXPAND_REFRESH = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(configure_widgets.ON_EXPAND_REFRESH)); @@ -1173,6 +1193,13 @@ ui_widget_set_tooltip_text(configure_widgets.INITIAL_DIR_DEEP, _("On Windows, this just hide files that are prefixed with '.' (dot)"));
+ configure_widgets.HIDE_OBJECT_FILES = gtk_check_button_new_with_label(_("Hide object files")); + gtk_button_set_focus_on_click(GTK_BUTTON(configure_widgets.HIDE_OBJECT_FILES), FALSE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configure_widgets.HIDE_OBJECT_FILES), CONFIG_HIDE_OBJECT_FILES); + gtk_box_pack_start(GTK_BOX(vbox), configure_widgets.HIDE_OBJECT_FILES, FALSE, FALSE, 0); + ui_widget_set_tooltip_text(configure_widgets.INITIAL_DIR_DEEP, + _("Don't show generated object files in the file browser, this includes *.o, *.obj. *.so, *.dll, *.a, *.lib")); + configure_widgets.REVERSE_FILTER = gtk_check_button_new_with_label(_("Reverse filter")); gtk_button_set_focus_on_click(GTK_BUTTON(configure_widgets.REVERSE_FILTER), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configure_widgets.REVERSE_FILTER), CONFIG_REVERSE_FILTER); @@ -1198,7 +1225,7 @@ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configure_widgets.ON_EXPAND_REFRESH), CONFIG_ON_EXPAND_REFRESH); gtk_box_pack_start(GTK_BOX(vbox), configure_widgets.ON_EXPAND_REFRESH, FALSE, FALSE, 0);
- configure_widgets.ON_DELETE_CLOSE_FILE = gtk_check_button_new_with_label(_("On delete file, close if it is opened")); + configure_widgets.ON_DELETE_CLOSE_FILE = gtk_check_button_new_with_label(_("On delete file, close it if is opened.")); gtk_button_set_focus_on_click(GTK_BUTTON(configure_widgets.ON_DELETE_CLOSE_FILE), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(configure_widgets.ON_DELETE_CLOSE_FILE), CONFIG_ON_DELETE_CLOSE_FILE); gtk_box_pack_start(GTK_BOX(vbox), configure_widgets.ON_DELETE_CLOSE_FILE, FALSE, FALSE, 0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.