diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-12-13 08:32:28 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-12-13 08:32:28 +0800 |
commit | dc41429125ddb873fda8a5eeb1691f104d5d88fd (patch) | |
tree | ed0b48d5e6a2d0f21e7e64df62879bc220eb9389 /filter/vfolder-rule.c | |
parent | 1229557d373b7bc0d14fb7d8d3a9aacafb2d567b (diff) | |
download | gsoc2013-evolution-dc41429125ddb873fda8a5eeb1691f104d5d88fd.tar.gz gsoc2013-evolution-dc41429125ddb873fda8a5eeb1691f104d5d88fd.tar.zst gsoc2013-evolution-dc41429125ddb873fda8a5eeb1691f104d5d88fd.zip |
New custom function for creating the source_list widget. (get_widget):
2002-12-12 Jeffrey Stedfast <fejj@ximian.com>
* vfolder-rule.c (vfolder_editor_sourcelist_new): New custom
function for creating the source_list widget.
(get_widget): Removed the source_list creation code.
* rule-editor.c (rule_editor_construct): Listen to row-activated
for double-click events. Also, removed the model creation code out
of here.
(rule_editor_treeview_new): Moved the treeview and model creation
code into here instead, and made the glade widgets into custom
widgets.
svn path=/trunk/; revision=19106
Diffstat (limited to 'filter/vfolder-rule.c')
-rw-r--r-- | filter/vfolder-rule.c | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/filter/vfolder-rule.c b/filter/vfolder-rule.c index 393bfc8650..616349d324 100644 --- a/filter/vfolder-rule.c +++ b/filter/vfolder-rule.c @@ -474,6 +474,46 @@ source_remove (GtkWidget *widget, struct _source_data *data) set_sensitive (data); } + +GtkWidget *vfolder_editor_sourcelist_new (char *widget_name, char *string1, char *string2, + int int1, int int2); + +GtkWidget * +vfolder_editor_sourcelist_new (char *widget_name, char *string1, char *string2, int int1, int int2) +{ + GtkWidget *table, *scrolled; + GtkTreeSelection *selection; + GtkCellRenderer *renderer; + GtkListStore *model; + + scrolled = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + model = gtk_list_store_new (1, G_TYPE_STRING); + table = gtk_tree_view_new_with_model ((GtkTreeModel *) model); + gtk_tree_view_set_headers_visible ((GtkTreeView *) table, FALSE); + + renderer = gtk_cell_renderer_text_new (); + gtk_tree_view_insert_column_with_attributes ((GtkTreeView *) table, -1, + _("VFolder source"), renderer, + "text", 0, NULL); + + selection = gtk_tree_view_get_selection ((GtkTreeView *) table); + gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); + + gtk_container_add (GTK_CONTAINER (scrolled), table); + + g_object_set_data ((GObject *) scrolled, "table", table); + g_object_set_data ((GObject *) scrolled, "model", model); + + gtk_widget_show (scrolled); + gtk_widget_show (table); + + return scrolled; +} + + /* DO NOT internationalise these strings */ const char *source_names[] = { "specific", @@ -512,15 +552,9 @@ get_widget (FilterRule *fr, RuleContext *rc) g_signal_connect (data->buttons[i], "clicked", edit_buttons[i].func, data); } - data->model = gtk_list_store_new (1, G_TYPE_STRING); - data->list = (GtkTreeView *) glade_xml_get_widget (gui, "source_list"); - gtk_tree_view_set_model (data->list, (GtkTreeModel *) data->model); - selection = gtk_tree_view_get_selection (data->list); - gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); - gtk_tree_view_insert_column_with_attributes(data->list, -1, _("Folder(s)"), - gtk_cell_renderer_text_new(), - "text", 0, - NULL); + widget = glade_xml_get_widget (gui, "source_list"); + data->list = (GtkTreeView *) g_object_get_data ((GObject *) widget, "table"); + data->model = (GtkListStore *) g_object_get_data ((GObject *) widget, "model"); source = NULL; while ((source = vfolder_rule_next_source (vr, source))) { |