Revision: 1767 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1767&view=re... Author: dimitrov-adrian Date: 2010-12-09 21:51:30 +0000 (Thu, 09 Dec 2010)
Log Message: ----------- TreeBrowser: Menu rearanged, Color errors correction
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-12-09 17:04:02 UTC (rev 1766) +++ trunk/geany-plugins/treebrowser/ChangeLog 2010-12-09 21:51:30 UTC (rev 1767) @@ -25,7 +25,7 @@ * Complete following 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 - * Migrating to stash + (REJECTED) Migrating to stash (DONE) Adding keybindings for renaming/deleting/refreshing (DONE) Add option to change bars position // requested by <dmaphy> (DONE) Add option to autorename point the newest created objects by the Treebrowser @@ -36,6 +36,14 @@ +-------------------------------+
+09-12-2010 Adrian Dimitrov dimitrov.adrian@gmail.com + + * src/treebrowser.c + Fixed error colors in addressbar when last directory wasn`t existing, + but then chrooting. + "Right click" menu rearanged to looks more logically + + 01-11-2010 Adrian Dimitrov dimitrov.adrian@gmail.com
* src/treebrowser.c @@ -43,7 +51,7 @@ target files if they exists.
-01-10-2010 Adrian Dimitrov dimitrov.adrian@gmail.com +01-11-2010 Adrian Dimitrov dimitrov.adrian@gmail.com
* ChangeLog Revision 1688, Modified Thu Oct 28 21:02:33 2010 UTC by colombanw
Modified: trunk/geany-plugins/treebrowser/src/treebrowser.c =================================================================== --- trunk/geany-plugins/treebrowser/src/treebrowser.c 2010-12-09 17:04:02 UTC (rev 1766) +++ trunk/geany-plugins/treebrowser/src/treebrowser.c 2010-12-09 21:51:30 UTC (rev 1767) @@ -344,6 +344,35 @@ return terminal; }
+static gboolean +treebrowser_checkdir(gchar *directory) +{ + gboolean is_dir; + static const GdkColor red = {0, 0xffff, 0x6666, 0x6666}; + static const GdkColor white = {0, 0xffff, 0xffff, 0xffff}; + static gboolean old_value = TRUE; + + is_dir = g_file_test(directory, G_FILE_TEST_IS_DIR); + g_return_if_fail(GTK_WIDGET(addressbar) != NULL); + + if (old_value != is_dir) + { + gtk_widget_modify_base(GTK_WIDGET(addressbar), GTK_STATE_NORMAL, is_dir ? NULL : &red); + gtk_widget_modify_text(GTK_WIDGET(addressbar), GTK_STATE_NORMAL, is_dir ? NULL : &white); + old_value = is_dir; + } + + if (!is_dir) + { + if (CONFIG_SHOW_BARS == 0) + dialogs_show_msgbox(GTK_MESSAGE_ERROR, _("%s: no such directory."), directory); + + return FALSE; + } + + return is_dir; +} + static void treebrowser_chroot(gchar *directory) { @@ -355,13 +384,8 @@ if (!directory || strlen(directory) == 0) directory = "/";
- if (! g_file_test(directory, G_FILE_TEST_IS_DIR)) - { - if (CONFIG_SHOW_BARS == 0) - dialogs_show_msgbox(GTK_MESSAGE_ERROR, _("%s: no such directory."), directory); - + if (! treebrowser_checkdir(directory)) return; - }
treebrowser_bookmarks_set_state();
@@ -384,7 +408,7 @@ gchar *fname; gchar *uri;
- directory = g_strconcat(directory, G_DIR_SEPARATOR_S, NULL); + directory = g_strconcat(directory, G_DIR_SEPARATOR_S, NULL);
has_parent = parent ? gtk_tree_store_iter_is_valid(treestore, parent) : FALSE; if (has_parent) @@ -1048,6 +1072,10 @@ g_signal_connect(item, "activate", G_CALLBACK(on_menu_set_as_root), uri); gtk_widget_set_sensitive(item, is_dir);
+ item = ui_image_menu_item_new(GTK_STOCK_REFRESH, _("Refresh")); + gtk_container_add(GTK_CONTAINER(menu), item); + g_signal_connect(item, "activate", G_CALLBACK(on_menu_refresh), NULL); + item = gtk_separator_menu_item_new(); gtk_container_add(GTK_CONTAINER(menu), item);
@@ -1072,13 +1100,19 @@ item = gtk_separator_menu_item_new(); gtk_container_add(GTK_CONTAINER(menu), item);
- item = ui_image_menu_item_new(GTK_STOCK_REFRESH, _("Refresh")); + item = ui_image_menu_item_new(GTK_STOCK_CLOSE, g_strdup_printf(_("Close: %s"), name)); gtk_container_add(GTK_CONTAINER(menu), item); - g_signal_connect(item, "activate", G_CALLBACK(on_menu_refresh), NULL); + g_signal_connect(item, "activate", G_CALLBACK(on_menu_close), uri); + gtk_widget_set_sensitive(item, is_document);
+ item = ui_image_menu_item_new(GTK_STOCK_COPY, _("Copy full path to clipboard")); + gtk_container_add(GTK_CONTAINER(menu), item); + g_signal_connect(item, "activate", G_CALLBACK(on_menu_copy_uri), uri); + gtk_widget_set_sensitive(item, is_exists); + item = gtk_separator_menu_item_new(); + gtk_container_add(GTK_CONTAINER(menu), item); gtk_widget_show(item); - gtk_container_add(GTK_CONTAINER(menu), item);
item = ui_image_menu_item_new(GTK_STOCK_GO_FORWARD, _("Expand all")); gtk_container_add(GTK_CONTAINER(menu), item); @@ -1091,19 +1125,6 @@ item = gtk_separator_menu_item_new(); gtk_container_add(GTK_CONTAINER(menu), item);
- item = ui_image_menu_item_new(GTK_STOCK_CLOSE, g_strdup_printf(_("Close: %s"), name)); - gtk_container_add(GTK_CONTAINER(menu), item); - g_signal_connect(item, "activate", G_CALLBACK(on_menu_close), uri); - gtk_widget_set_sensitive(item, is_document); - - item = ui_image_menu_item_new(GTK_STOCK_COPY, _("Copy full path to clipboard")); - gtk_container_add(GTK_CONTAINER(menu), item); - g_signal_connect(item, "activate", G_CALLBACK(on_menu_copy_uri), uri); - gtk_widget_set_sensitive(item, is_exists); - - item = gtk_separator_menu_item_new(); - gtk_container_add(GTK_CONTAINER(menu), item); - item = gtk_check_menu_item_new_with_mnemonic(_("Show bookmarks")); gtk_container_add(GTK_CONTAINER(menu), item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), CONFIG_SHOW_BOOKMARKS); @@ -1114,7 +1135,7 @@ 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);
- item = gtk_check_menu_item_new_with_mnemonic(_("Show bars")); + item = gtk_check_menu_item_new_with_mnemonic(_("Show toolbars")); gtk_container_add(GTK_CONTAINER(menu), item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), CONFIG_SHOW_BARS ? TRUE : FALSE); g_signal_connect(item, "activate", G_CALLBACK(on_menu_show_bars), NULL); @@ -1175,20 +1196,6 @@ on_addressbar_activate(GtkEntry *entry, gpointer user_data) { gchar *directory = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); - - 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); - - g_return_if_fail(GTK_WIDGET(entry) != NULL); - if (old_value != success) - { - gtk_widget_modify_base(GTK_WIDGET(entry), GTK_STATE_NORMAL, success ? NULL : &red); - gtk_widget_modify_text(GTK_WIDGET(entry), GTK_STATE_NORMAL, success ? NULL : &white); - old_value = success; - } - treebrowser_chroot(directory); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.