Set model only after populating it

master
Yevgen Muntyan 2007-06-14 02:18:35 -05:00
parent 2f9a2fa3c8
commit e899ee19a7
6 changed files with 23 additions and 20 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<medit-project version="1.0" type="C" name="moo">
<active>debug</active>
<active>optimized</active>
<configurations>
<debug>
<build_dir>build/debug</build_dir>
@ -34,7 +34,7 @@
</configure>
</optimized>
</configurations>
<file_selector_dir>/home/muntyan/projects/moo/</file_selector_dir>
<file_selector_dir>/home/muntyan/projects/moo/moo/mooutils/</file_selector_dir>
<run>
<args>--new-app --mode=project</args>
<exe>medit/medit</exe>

View File

@ -674,7 +674,6 @@ init_combo (GtkComboBox *combo,
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, "text", 0, NULL);
store = gtk_list_store_new (1, G_TYPE_STRING);
gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
for (i = 0; i < n_items; ++i)
{
@ -683,6 +682,8 @@ init_combo (GtkComboBox *combo,
gtk_list_store_set (store, &iter, 0, Q_(items[i]), -1);
}
gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
g_object_unref (store);
}
@ -700,7 +701,6 @@ init_filter_combo (GtkComboBox *combo)
"text", COLUMN_NAME, NULL);
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
gtk_list_store_append (store, &iter);
/* Translators: "None" means no filter for a shell command, do not translate the part before | */
@ -732,6 +732,8 @@ init_filter_combo (GtkComboBox *combo)
g_free (id);
}
gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
g_object_unref (store);
}

View File

@ -222,7 +222,6 @@ init_factory_combo (MooCommandDisplay *display,
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (display->factory_combo), cell, "text", 0, NULL);
store = gtk_list_store_new (1, G_TYPE_STRING);
gtk_combo_box_set_model (display->factory_combo, GTK_TREE_MODEL (store));
factories = moo_command_list_factories ();
display->active = -1;
@ -254,6 +253,8 @@ init_factory_combo (MooCommandDisplay *display,
factories = g_slist_delete_link (factories, factories);
}
gtk_combo_box_set_model (display->factory_combo, GTK_TREE_MODEL (store));
g_signal_connect_swapped (display->factory_combo, "changed",
G_CALLBACK (combo_changed), display);

View File

@ -392,9 +392,6 @@ create_lang_model (MooEditor *editor)
g_free (ext);
g_free (mime);
/* separator */
gtk_tree_store_append (store, &iter, NULL);
while (sections)
{
char *section = sections->data;
@ -440,6 +437,7 @@ create_lang_model (MooEditor *editor)
}
#if 0
static gboolean
separator_func (GtkTreeModel *model,
GtkTreeIter *iter,
@ -455,6 +453,8 @@ separator_func (GtkTreeModel *model,
g_free (name);
return FALSE;
}
#endif
static void
set_sensitive (G_GNUC_UNUSED GtkCellLayout *cell_layout,
@ -480,9 +480,6 @@ default_lang_combo_init (GtkComboBox *combo,
model = page_get_lang_model (page);
g_return_if_fail (model != NULL);
gtk_combo_box_set_model (combo, model);
gtk_combo_box_set_row_separator_func (combo, separator_func, NULL, NULL);
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo));
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
@ -490,6 +487,8 @@ default_lang_combo_init (GtkComboBox *combo,
"text", COLUMN_NAME, NULL);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo), cell,
set_sensitive, NULL, NULL);
gtk_combo_box_set_model (combo, model);
}
@ -656,9 +655,6 @@ lang_combo_init (GtkComboBox *combo,
model = page_get_lang_model (page);
g_return_if_fail (model != NULL);
gtk_combo_box_set_model (combo, model);
gtk_combo_box_set_row_separator_func (combo, separator_func, NULL, NULL);
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo));
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
@ -667,6 +663,8 @@ lang_combo_init (GtkComboBox *combo,
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo), cell,
set_sensitive, NULL, NULL);
gtk_combo_box_set_model (combo, model);
_moo_combo_box_select_first (combo);
helper = _moo_tree_helper_new (GTK_WIDGET (combo), NULL, NULL, NULL, NULL);
g_return_if_fail (helper != NULL);

View File

@ -300,7 +300,6 @@ command_page_init (MooPrefsDialogPage *page,
treeview = moo_glade_xml_get_widget (page->xml, "treeview");
store = gtk_list_store_new (N_COLUMNS, MOO_TYPE_USER_TOOL_INFO);
gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (store));
cell = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new ();
@ -330,6 +329,8 @@ command_page_init (MooPrefsDialogPage *page,
g_signal_connect_swapped (helper, "update-widgets", G_CALLBACK (update_widgets), page);
g_signal_connect_swapped (helper, "update-model", G_CALLBACK (update_model), page);
gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (store));
_moo_tree_view_select_first (treeview);
_moo_tree_helper_update_widgets (MOO_TREE_HELPER (helper));

View File

@ -571,6 +571,7 @@ combo_changed (GtkComboBox *combo,
}
#if 0
static gboolean
row_separator_func (GtkTreeModel *model,
GtkTreeIter *iter)
@ -584,6 +585,8 @@ row_separator_func (GtkTreeModel *model,
g_free (text);
return separator;
}
#endif
static void
cell_data_func (G_GNUC_UNUSED GtkCellLayout *layout,
@ -638,8 +641,8 @@ setup_combo (GtkComboBox *combo,
}
gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter, COLUMN_DISPLAY, "Other", -1);
/* Translators: do not translate the part before | */
gtk_tree_store_set (store, &iter, COLUMN_DISPLAY, _("Encodings combo submenu|Other"), -1);
for (i = 0; i < enc_mgr->n_groups; ++i)
{
@ -663,9 +666,7 @@ setup_combo (GtkComboBox *combo,
gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (combo), COLUMN_DISPLAY);
gtk_combo_box_set_row_separator_func (combo,
(GtkTreeViewRowSeparatorFunc) row_separator_func,
NULL, NULL);
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo));
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);