SF.net SVN: geany: [1975] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Wed Oct 24 16:10:57 UTC 2007
Revision: 1975
http://geany.svn.sourceforge.net/geany/?rev=1975&view=rev
Author: ntrel
Date: 2007-10-24 09:10:56 -0700 (Wed, 24 Oct 2007)
Log Message:
-----------
Fix bug with choosing 'show full path name' from documents list popup
menu when there is no selected item (can happen after using the command
twice).
Fix hiding the sidebar/documents list from the popup menu when there's
no selected item.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/treeviews.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-10-24 12:04:15 UTC (rev 1974)
+++ trunk/ChangeLog 2007-10-24 16:10:56 UTC (rev 1975)
@@ -19,6 +19,12 @@
plugins/pluginmacros.h:
Add pluginmacros.h to define common macros for app, utils, etc.
Add more documentation/comments to demoplugin.c.
+ * src/treeviews.c:
+ Fix bug with choosing 'show full path name' from documents list popup
+ menu when there is no selected item (can happen after using the command
+ twice).
+ Fix hiding the sidebar/documents list from the popup menu when there's
+ no selected item.
2007-10-23 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/treeviews.c
===================================================================
--- trunk/src/treeviews.c 2007-10-24 12:04:15 UTC (rev 1974)
+++ trunk/src/treeviews.c 2007-10-24 16:10:56 UTC (rev 1975)
@@ -53,7 +53,6 @@
OPENFILES_ACTION_REMOVE = 0,
OPENFILES_ACTION_SAVE,
OPENFILES_ACTION_RELOAD,
- OPENFILES_ACTION_FULLPATH,
OPENFILES_ACTION_HIDE,
OPENFILES_ACTION_HIDE_ALL,
SYMBOL_ACTION_SORT_BY_NAME,
@@ -69,7 +68,8 @@
/* callback prototypes */
static void on_taglist_tree_popup_clicked(GtkMenuItem *menuitem, gpointer user_data);
static void on_openfiles_tree_selection_changed(GtkTreeSelection *selection, gpointer data);
-static void on_openfiles_tree_popup_clicked(GtkMenuItem *menuitem, gpointer user_data);
+static void on_openfiles_document_action(GtkMenuItem *menuitem, gpointer user_data);
+static void on_openfiles_hide_item_clicked(GtkMenuItem *menuitem, gpointer user_data);
static gboolean on_taglist_tree_selection_changed(GtkTreeSelection *selection);
static gboolean on_treeviews_button_press_event(GtkWidget *widget, GdkEventButton *event,
gpointer user_data);
@@ -381,6 +381,13 @@
}
+static void on_openfiles_fullpath_activate(GtkCheckMenuItem *item)
+{
+ prefs.sidebar_openfiles_fullpath = gtk_check_menu_item_get_active(item);
+ treeviews_openfiles_update_all();
+}
+
+
static void create_openfiles_popup_menu()
{
GtkWidget *item;
@@ -391,7 +398,7 @@
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(tv.popup_openfiles), item);
g_signal_connect((gpointer) item, "activate",
- G_CALLBACK(on_openfiles_tree_popup_clicked), GINT_TO_POINTER(OPENFILES_ACTION_REMOVE));
+ G_CALLBACK(on_openfiles_document_action), GINT_TO_POINTER(OPENFILES_ACTION_REMOVE));
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
@@ -401,7 +408,7 @@
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(tv.popup_openfiles), item);
g_signal_connect((gpointer) item, "activate",
- G_CALLBACK(on_openfiles_tree_popup_clicked), GINT_TO_POINTER(OPENFILES_ACTION_SAVE));
+ G_CALLBACK(on_openfiles_document_action), GINT_TO_POINTER(OPENFILES_ACTION_SAVE));
item = gtk_image_menu_item_new_with_mnemonic(_("_Reload"));
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
@@ -409,7 +416,7 @@
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(tv.popup_openfiles), item);
g_signal_connect((gpointer) item, "activate",
- G_CALLBACK(on_openfiles_tree_popup_clicked), GINT_TO_POINTER(OPENFILES_ACTION_RELOAD));
+ G_CALLBACK(on_openfiles_document_action), GINT_TO_POINTER(OPENFILES_ACTION_RELOAD));
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
@@ -418,15 +425,15 @@
tv.popup_openfiles_fullpath = gtk_check_menu_item_new_with_mnemonic(_("Show _full path name"));
gtk_widget_show(tv.popup_openfiles_fullpath);
gtk_container_add(GTK_CONTAINER(tv.popup_openfiles), tv.popup_openfiles_fullpath);
- g_signal_connect((gpointer) tv.popup_openfiles_fullpath, "toggled",
- G_CALLBACK(on_openfiles_tree_popup_clicked), GINT_TO_POINTER(OPENFILES_ACTION_FULLPATH));
+ g_signal_connect((gpointer) tv.popup_openfiles_fullpath, "activate",
+ G_CALLBACK(on_openfiles_fullpath_activate), NULL);
item = gtk_image_menu_item_new_with_mnemonic(_("_Hide"));
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
gtk_image_new_from_stock("gtk-close", GTK_ICON_SIZE_MENU));
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(tv.popup_openfiles), item);
- g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_openfiles_tree_popup_clicked),
+ g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_openfiles_hide_item_clicked),
GINT_TO_POINTER(OPENFILES_ACTION_HIDE));
item = gtk_image_menu_item_new_with_mnemonic(_("H_ide sidebar"));
@@ -434,7 +441,7 @@
gtk_image_new_from_stock("gtk-close", GTK_ICON_SIZE_MENU));
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(tv.popup_openfiles), item);
- g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_openfiles_tree_popup_clicked),
+ g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_openfiles_hide_item_clicked),
GINT_TO_POINTER(OPENFILES_ACTION_HIDE_ALL));
}
@@ -467,7 +474,7 @@
/* callbacks */
-static void on_openfiles_tree_popup_clicked(GtkMenuItem *menuitem, gpointer user_data)
+static void on_openfiles_document_action(GtkMenuItem *menuitem, gpointer user_data)
{
GtkTreeIter iter;
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv.tree_openfiles));
@@ -496,33 +503,32 @@
on_toolbutton23_clicked(NULL, NULL);
break;
}
- case OPENFILES_ACTION_FULLPATH:
- {
- if (! app->ignore_callback)
- {
- prefs.sidebar_openfiles_fullpath = ! prefs.sidebar_openfiles_fullpath;
- treeviews_openfiles_update_all();
- }
- break;
- }
- case OPENFILES_ACTION_HIDE:
- {
- prefs.sidebar_openfiles_visible = FALSE;
- ui_treeviews_show_hide(FALSE);
- break;
- }
- case OPENFILES_ACTION_HIDE_ALL:
- {
- ui_prefs.sidebar_visible = FALSE;
- ui_treeviews_show_hide(TRUE);
- break;
- }
}
}
}
}
+static void on_openfiles_hide_item_clicked(GtkMenuItem *menuitem, gpointer user_data)
+{
+ switch (GPOINTER_TO_INT(user_data))
+ {
+ case OPENFILES_ACTION_HIDE:
+ {
+ prefs.sidebar_openfiles_visible = FALSE;
+ ui_treeviews_show_hide(FALSE);
+ break;
+ }
+ case OPENFILES_ACTION_HIDE_ALL:
+ {
+ ui_prefs.sidebar_visible = FALSE;
+ ui_treeviews_show_hide(TRUE);
+ break;
+ }
+ }
+}
+
+
static gboolean change_focus(gpointer data)
{
gint idx = (gint) data;
@@ -627,10 +633,8 @@
{ // popupmenu to hide or clear the active treeview
if (GPOINTER_TO_INT(user_data) == TREEVIEW_OPENFILES)
{
- app->ignore_callback = TRUE;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tv.popup_openfiles_fullpath),
prefs.sidebar_openfiles_fullpath);
- app->ignore_callback = FALSE;
gtk_menu_popup(GTK_MENU(tv.popup_openfiles), NULL, NULL, NULL, NULL,
event->button, event->time);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list