SF.net SVN: geany: [1249] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Mon Feb 5 16:17:44 UTC 2007
Revision: 1249
http://svn.sourceforge.net/geany/?rev=1249&view=rev
Author: ntrel
Date: 2007-02-05 08:17:44 -0800 (Mon, 05 Feb 2007)
Log Message:
-----------
Move ui_update_tag_list() to treeviews.c.
Make treeviews_prepare_taglist() static.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/callbacks.c
trunk/src/document.c
trunk/src/main.c
trunk/src/treeviews.c
trunk/src/treeviews.h
trunk/src/ui_utils.c
trunk/src/ui_utils.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-02-05 15:40:33 UTC (rev 1248)
+++ trunk/ChangeLog 2007-02-05 16:17:44 UTC (rev 1249)
@@ -2,6 +2,10 @@
* src/treeviews.c:
Prevent right click in Symbol list from selecting a tag.
+ * src/ui_utils.h, src/treeviews.c, src/callbacks.c, src/treeviews.h,
+ src/document.c, src/main.c, src/ui_utils.c:
+ Move ui_update_tag_list() to treeviews.c.
+ Make treeviews_prepare_taglist() static.
2007-02-03 Nick Treleaven <nick.treleaven at btinternet.com>
Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c 2007-02-05 15:40:33 UTC (rev 1248)
+++ trunk/src/callbacks.c 2007-02-05 16:17:44 UTC (rev 1249)
@@ -244,7 +244,7 @@
else
document_save_file(idx, FALSE);
}
- ui_update_tag_list(cur_idx, TRUE);
+ treeviews_update_tag_list(cur_idx, TRUE);
ui_set_window_title(cur_idx);
}
@@ -728,7 +728,7 @@
build_menu_update(idx);
ui_update_statusbar(idx, -1);
ui_set_window_title(idx);
- ui_update_tag_list(idx, FALSE);
+ treeviews_update_tag_list(idx, FALSE);
}
}
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2007-02-05 15:40:33 UTC (rev 1248)
+++ trunk/src/document.c 2007-02-05 16:17:44 UTC (rev 1249)
@@ -365,7 +365,7 @@
document_undo_clear(idx);
if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0)
{
- ui_update_tag_list(-1, FALSE);
+ treeviews_update_tag_list(-1, FALSE);
//on_notebook1_switch_page(GTK_NOTEBOOK(app->notebook), NULL, 0, NULL);
ui_set_window_title(-1);
ui_save_buttons_toggle(FALSE);
@@ -1345,7 +1345,7 @@
! doc_list[idx].file_type->has_tags || ! doc_list[idx].file_name)
{
// set the default (empty) tag list
- ui_update_tag_list(idx, FALSE);
+ treeviews_update_tag_list(idx, FALSE);
return;
}
@@ -1359,13 +1359,13 @@
tm_workspace_add_object(doc_list[idx].tm_file);
if (update)
tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE);
- ui_update_tag_list(idx, TRUE);
+ treeviews_update_tag_list(idx, TRUE);
}
else
{
if (tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE))
{
- ui_update_tag_list(idx, TRUE);
+ treeviews_update_tag_list(idx, TRUE);
}
else
{
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2007-02-05 15:40:33 UTC (rev 1248)
+++ trunk/src/main.c 2007-02-05 16:17:44 UTC (rev 1249)
@@ -648,7 +648,7 @@
gtk_widget_grab_focus(GTK_WIDGET(doc_list[idx].sci));
gtk_tree_model_foreach(GTK_TREE_MODEL(tv.store_openfiles), treeviews_find_node, GINT_TO_POINTER(idx));
build_menu_update(idx);
- ui_update_tag_list(idx, FALSE);
+ treeviews_update_tag_list(idx, FALSE);
#ifdef G_OS_WIN32
// hide "Build" menu item, at least until it is available for Windows
Modified: trunk/src/treeviews.c
===================================================================
--- trunk/src/treeviews.c 2007-02-05 15:40:33 UTC (rev 1248)
+++ trunk/src/treeviews.c 2007-02-05 16:17:44 UTC (rev 1249)
@@ -30,6 +30,7 @@
#include "document.h"
#include "utils.h"
#include "ui_utils.h"
+#include "symbols.h"
enum
@@ -60,8 +61,8 @@
-/* the following two functions are document-related, but I think they fit better here than in document.c */
-void treeviews_prepare_taglist(GtkWidget *tree, GtkTreeStore *store)
+/* the prepare_* functions are document-related, but I think they fit better here than in document.c */
+static void prepare_taglist(GtkWidget *tree, GtkTreeStore *store)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
@@ -91,6 +92,60 @@
}
+// update = rescan the tags for document[idx].filename
+void treeviews_update_tag_list(gint idx, gboolean update)
+{
+ if (gtk_bin_get_child(GTK_BIN(app->tagbar)))
+ gtk_container_remove(GTK_CONTAINER(app->tagbar), gtk_bin_get_child(GTK_BIN(app->tagbar)));
+
+ if (app->default_tag_tree == NULL)
+ {
+ GtkTreeIter iter;
+ GtkTreeStore *store = gtk_tree_store_new(1, G_TYPE_STRING);
+
+ 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);
+ 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
+ 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;
+ }
+
+ if (update)
+ { // updating the tag list in the left tag window
+ if (doc_list[idx].tag_tree == NULL)
+ {
+ doc_list[idx].tag_store = gtk_tree_store_new(1, G_TYPE_STRING);
+ doc_list[idx].tag_tree = gtk_tree_view_new();
+ prepare_taglist(doc_list[idx].tag_tree, doc_list[idx].tag_store);
+ gtk_widget_show(doc_list[idx].tag_tree);
+ g_object_ref((gpointer)doc_list[idx].tag_tree); // to hold it after removing
+ }
+
+ doc_list[idx].has_tags = symbols_recreate_tag_list(idx);
+ }
+
+ 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);
+ }
+}
+
+
/* does some preparing things to the open files list widget */
void treeviews_prepare_openfiles()
{
@@ -188,7 +243,7 @@
gtk_widget_destroy(doc_list[idx].tag_tree);
if (GTK_IS_TREE_VIEW(doc_list[idx].tag_tree))
{
- // Because it was ref'd in ui_update_tag_list, it needs unref'ing
+ // Because it was ref'd in treeviews_update_tag_list, it needs unref'ing
g_object_unref((gpointer)doc_list[idx].tag_tree);
}
doc_list[idx].tag_tree = NULL;
Modified: trunk/src/treeviews.h
===================================================================
--- trunk/src/treeviews.h 2007-02-05 15:40:33 UTC (rev 1248)
+++ trunk/src/treeviews.h 2007-02-05 16:17:44 UTC (rev 1249)
@@ -36,7 +36,7 @@
} tv;
-void treeviews_prepare_taglist(GtkWidget *tree, GtkTreeStore *store);
+void treeviews_update_tag_list(gint idx, gboolean update);
void treeviews_prepare_openfiles();
Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c 2007-02-05 15:40:33 UTC (rev 1248)
+++ trunk/src/ui_utils.c 2007-02-05 16:17:44 UTC (rev 1249)
@@ -36,7 +36,6 @@
#include "encodings.h"
#include "images.c"
#include "treeviews.h"
-#include "symbols.h"
static gchar *menu_item_get_text(GtkMenuItem *menu_item);
@@ -213,60 +212,6 @@
}
-// update = rescan the tags for document[idx].filename
-void ui_update_tag_list(gint idx, gboolean update)
-{
- if (gtk_bin_get_child(GTK_BIN(app->tagbar)))
- gtk_container_remove(GTK_CONTAINER(app->tagbar), gtk_bin_get_child(GTK_BIN(app->tagbar)));
-
- if (app->default_tag_tree == NULL)
- {
- GtkTreeIter iter;
- GtkTreeStore *store = gtk_tree_store_new(1, G_TYPE_STRING);
-
- app->default_tag_tree = gtk_tree_view_new();
- treeviews_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);
- 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
- 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;
- }
-
- if (update)
- { // updating the tag list in the left tag window
- if (doc_list[idx].tag_tree == NULL)
- {
- doc_list[idx].tag_store = gtk_tree_store_new(1, G_TYPE_STRING);
- doc_list[idx].tag_tree = gtk_tree_view_new();
- treeviews_prepare_taglist(doc_list[idx].tag_tree, doc_list[idx].tag_store);
- gtk_widget_show(doc_list[idx].tag_tree);
- g_object_ref((gpointer)doc_list[idx].tag_tree); // to hold it after removing
- }
-
- doc_list[idx].has_tags = symbols_recreate_tag_list(idx);
- }
-
- 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);
- }
-}
-
-
void ui_update_popup_reundo_items(gint index)
{
gboolean enable_undo;
Modified: trunk/src/ui_utils.h
===================================================================
--- trunk/src/ui_utils.h 2007-02-05 15:40:33 UTC (rev 1248)
+++ trunk/src/ui_utils.h 2007-02-05 16:17:44 UTC (rev 1249)
@@ -38,9 +38,6 @@
void ui_set_fullscreen();
-void ui_update_tag_list(gint idx, gboolean update);
-
-
void ui_update_popup_reundo_items(gint idx);
void ui_update_popup_copy_items(gint idx);
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