Revision: 1273 http://svn.sourceforge.net/geany/?rev=1273&view=rev Author: ntrel Date: 2007-02-13 04:02:16 -0800 (Tue, 13 Feb 2007)
Log Message: ----------- Allow popup Symbols menu when the current document has no tags, so the sidebar can be hidden. Use a GtkLabel to display 'No tags found'.
Modified Paths: -------------- trunk/ChangeLog trunk/src/treeviews.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-02-12 21:39:32 UTC (rev 1272) +++ trunk/ChangeLog 2007-02-13 12:02:16 UTC (rev 1273) @@ -1,3 +1,11 @@ +2007-02-13 Nick Treleaven nick.treleaven@btinternet.com + + * src/treeviews.c: + Allow popup Symbols menu when the current document has no tags, so + the sidebar can be hidden. + Use a GtkLabel to display 'No tags found'. + + 2007-02-12 Enrico Tröger enrico.troeger@uvena.de
* src/main.c: Convert config, application and documentation dir paths
Modified: trunk/src/treeviews.c =================================================================== --- trunk/src/treeviews.c 2007-02-12 21:39:32 UTC (rev 1272) +++ trunk/src/treeviews.c 2007-02-13 12:02:16 UTC (rev 1273) @@ -92,6 +92,18 @@ }
+static gboolean +on_default_tag_tree_button_press_event(GtkWidget *widget, GdkEventButton *event, + gpointer user_data) +{ + if (event->button == 3) + { + on_treeviews_button_press_event(widget, event, GINT_TO_POINTER(TREEVIEW_SYMBOL)); + } + return FALSE; +} + + // update = rescan the tags for document[idx].filename void treeviews_update_tag_list(gint idx, gboolean update) { @@ -100,21 +112,22 @@
if (app->default_tag_tree == NULL) { - GtkTreeIter iter; - GtkTreeStore *store = gtk_tree_store_new(1, G_TYPE_STRING); + GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW(app->tagbar);
- app->default_tag_tree = gtk_tree_view_new(); - prepare_taglist(app->default_tag_tree, store); - gtk_tree_store_append(store, &iter, NULL); - gtk_tree_store_set(store, &iter, 0, _("No tags found"), -1); - gtk_widget_show(app->default_tag_tree); + // default_tag_tree is a GtkViewPort with a GtkLabel inside it + app->default_tag_tree = gtk_viewport_new( + gtk_scrolled_window_get_hadjustment(scrolled_window), + gtk_scrolled_window_get_vadjustment(scrolled_window)); + gtk_container_add(GTK_CONTAINER(app->default_tag_tree), gtk_label_new(_("No tags found"))); + gtk_widget_show_all(app->default_tag_tree); + g_signal_connect(G_OBJECT(app->default_tag_tree), "button-press-event", + G_CALLBACK(on_default_tag_tree_button_press_event), NULL); g_object_ref((gpointer)app->default_tag_tree); // to hold it after removing }
- // make all inactive, because there is no more tab left, or something strange occured + // show default empty tag tree if there are no tags if (idx == -1 || doc_list[idx].file_type == NULL || ! doc_list[idx].file_type->has_tags) { - gtk_widget_set_sensitive(app->tagbar, FALSE); gtk_container_add(GTK_CONTAINER(app->tagbar), app->default_tag_tree); return; } @@ -135,12 +148,10 @@
if (doc_list[idx].has_tags) { - gtk_widget_set_sensitive(app->tagbar, TRUE); gtk_container_add(GTK_CONTAINER(app->tagbar), doc_list[idx].tag_tree); } else { - gtk_widget_set_sensitive(app->tagbar, FALSE); gtk_container_add(GTK_CONTAINER(app->tagbar), app->default_tag_tree); } }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.