Made pages list in preferences dialog a list, not a tree
This commit is contained in:
parent
703ddfe09b
commit
e3bc0cff16
@ -1018,8 +1018,7 @@ cmp_page_and_id (GObject *page,
|
||||
}
|
||||
|
||||
static void
|
||||
sync_pages (MooPrefsDialog *dialog,
|
||||
MooPrefsDialogPage *main_page)
|
||||
sync_pages (MooPrefsDialog *dialog)
|
||||
{
|
||||
GSList *old_plugin_pages, *plugin_pages, *plugin_ids, *l, *plugins;
|
||||
|
||||
@ -1058,7 +1057,7 @@ sync_pages (MooPrefsDialog *dialog,
|
||||
g_strdup (moo_plugin_id (plugin)),
|
||||
g_free);
|
||||
plugin_pages = g_slist_append (plugin_pages, plugin_page);
|
||||
moo_prefs_dialog_insert_page (dialog, plugin_page, GTK_WIDGET (main_page), -1);
|
||||
moo_prefs_dialog_insert_page (dialog, plugin_page, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1112,7 +1111,7 @@ prefs_init (MooPrefsDialog *dialog,
|
||||
selection_changed (gtk_tree_view_get_selection (treeview), page);
|
||||
|
||||
g_slist_free (plugins);
|
||||
sync_pages (dialog, page);
|
||||
sync_pages (dialog);
|
||||
}
|
||||
|
||||
|
||||
@ -1153,7 +1152,7 @@ prefs_apply (MooPrefsDialog *dialog,
|
||||
}
|
||||
while (gtk_tree_model_iter_next (model, &iter));
|
||||
|
||||
sync_pages (dialog, page);
|
||||
sync_pages (dialog);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1306,7 +1306,6 @@
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkWidget*" "page")
|
||||
'("GtkWidget*" "parent_page")
|
||||
'("int" "position")
|
||||
)
|
||||
)
|
||||
|
@ -202,7 +202,7 @@ setup_pages_list (MooPrefsDialog *dialog)
|
||||
GtkTreeViewColumn *icon_column, *label_column;
|
||||
GtkTreeSelection *selection;
|
||||
|
||||
dialog->store = gtk_tree_store_new (N_COLUMNS,
|
||||
dialog->store = gtk_list_store_new (N_COLUMNS,
|
||||
GDK_TYPE_PIXBUF,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING,
|
||||
@ -396,41 +396,29 @@ void
|
||||
moo_prefs_dialog_append_page (MooPrefsDialog *dialog,
|
||||
GtkWidget *page)
|
||||
{
|
||||
moo_prefs_dialog_insert_page (dialog, page, NULL, -1);
|
||||
moo_prefs_dialog_insert_page (dialog, page, -1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_prefs_dialog_insert_page (MooPrefsDialog *dialog,
|
||||
GtkWidget *page,
|
||||
GtkWidget *parent_page,
|
||||
int position)
|
||||
{
|
||||
char *label = NULL, *icon_id = NULL;
|
||||
GdkPixbuf *icon = NULL;
|
||||
GtkTreeIter iter, parent_iter;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeRowReference *ref;
|
||||
GtkTreePath *path = NULL;
|
||||
|
||||
g_return_if_fail (MOO_IS_PREFS_DIALOG (dialog));
|
||||
g_return_if_fail (MOO_IS_PREFS_DIALOG_PAGE (page));
|
||||
g_return_if_fail (page->parent == NULL);
|
||||
g_return_if_fail (!parent_page || MOO_IS_PREFS_DIALOG_PAGE (parent_page));
|
||||
g_return_if_fail (!parent_page || parent_page->parent == GTK_WIDGET (dialog->notebook));
|
||||
|
||||
if (parent_page)
|
||||
{
|
||||
ref = g_object_get_data (G_OBJECT (parent_page), "moo-prefs-dialog-row");
|
||||
g_return_if_fail (ref && gtk_tree_row_reference_valid (ref));
|
||||
path = gtk_tree_row_reference_get_path (ref);
|
||||
gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->store), &parent_iter, path);
|
||||
gtk_tree_store_insert (dialog->store, &iter, &parent_iter, position);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_tree_store_insert (dialog->store, &iter, NULL, position);
|
||||
}
|
||||
if (position < 0)
|
||||
position = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (dialog->store), NULL);
|
||||
|
||||
gtk_list_store_insert (dialog->store, &iter, position);
|
||||
|
||||
gtk_widget_show (page);
|
||||
gtk_notebook_insert_page (dialog->notebook, page, NULL, -1);
|
||||
@ -441,7 +429,7 @@ moo_prefs_dialog_insert_page (MooPrefsDialog *dialog,
|
||||
"icon-stock-id", &icon_id,
|
||||
NULL);
|
||||
|
||||
gtk_tree_store_set (dialog->store, &iter,
|
||||
gtk_list_store_set (dialog->store, &iter,
|
||||
ICON_ID_COLUMN, icon_id,
|
||||
ICON_COLUMN, icon,
|
||||
LABEL_COLUMN, label,
|
||||
@ -479,7 +467,7 @@ moo_prefs_dialog_remove_page (MooPrefsDialog *dialog,
|
||||
|
||||
path = gtk_tree_row_reference_get_path (ref);
|
||||
gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->store), &iter, path);
|
||||
gtk_tree_store_remove (dialog->store, &iter);
|
||||
gtk_list_store_remove (dialog->store, &iter);
|
||||
|
||||
g_object_set_data (G_OBJECT (page), "moo-prefs-dialog-row", NULL);
|
||||
gtk_tree_path_free (path);
|
||||
|
@ -34,7 +34,7 @@ struct _MooPrefsDialog
|
||||
{
|
||||
GtkDialog dialog;
|
||||
GtkNotebook *notebook;
|
||||
GtkTreeStore *store;
|
||||
GtkListStore *store;
|
||||
GtkTreeView *pages_list;
|
||||
gboolean hide_on_delete;
|
||||
};
|
||||
@ -61,7 +61,6 @@ void moo_prefs_dialog_remove_page (MooPrefsDialog *dialog,
|
||||
GtkWidget *page);
|
||||
void moo_prefs_dialog_insert_page (MooPrefsDialog *dialog,
|
||||
GtkWidget *page,
|
||||
GtkWidget *parent_page,
|
||||
int position);
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user