Move ui_update_tag_list() to treeviews.c.
Make treeviews_prepare_taglist() static. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1249 ea778897-0a13-0410-b9d1-a72fbfd435f5master
parent
807751de31
commit
b8491a2b7d
|
@ -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@btinternet.com>
|
||||
|
|
|
@ -244,7 +244,7 @@ on_save_all1_activate (GtkMenuItem *menuitem,
|
|||
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 @@ on_notebook1_switch_page (GtkNotebook *notebook,
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ gboolean document_remove(guint page_num)
|
|||
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 @@ void document_update_tag_list(gint idx, gboolean update)
|
|||
! 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 @@ void document_update_tag_list(gint idx, gboolean update)
|
|||
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
|
||||
{
|
||||
|
|
|
@ -648,7 +648,7 @@ gint main(gint argc, gchar **argv)
|
|||
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
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "document.h"
|
||||
#include "utils.h"
|
||||
#include "ui_utils.h"
|
||||
#include "symbols.h"
|
||||
|
||||
|
||||
enum
|
||||
|
@ -60,8 +61,8 @@ static gboolean on_treeviews_button_press_event(GtkWidget *widget, GdkEventButto
|
|||
|
||||
|
||||
|
||||
/* 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 @@ void treeviews_prepare_taglist(GtkWidget *tree, GtkTreeStore *store)
|
|||
}
|
||||
|
||||
|
||||
// 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 @@ void treeviews_remove_document(gint idx)
|
|||
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;
|
||||
|
|
|
@ -36,7 +36,7 @@ struct SidebarTreeviews
|
|||
} tv;
|
||||
|
||||
|
||||
void treeviews_prepare_taglist(GtkWidget *tree, GtkTreeStore *store);
|
||||
void treeviews_update_tag_list(gint idx, gboolean update);
|
||||
|
||||
void treeviews_prepare_openfiles();
|
||||
|
||||
|
|
|
@ -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 @@ void ui_set_fullscreen()
|
|||
}
|
||||
|
||||
|
||||
// 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;
|
||||
|
|
|
@ -38,9 +38,6 @@ void ui_set_editor_font(const gchar *font_name);
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue