also display the default theme (though without a preview for technical

2006-08-16  Sven Herzberg  <herzi@gnome-de.org>

        * gnome-mouse-properties.c: also display the default theme (though
	without a preview for technical reasons); fixes bug #322514
This commit is contained in:
Sven Herzberg 2006-08-16 17:16:13 +00:00 committed by Sven Herzberg
parent ce30ca4583
commit f6691b0266
2 changed files with 47 additions and 33 deletions

View file

@ -1,3 +1,8 @@
2006-08-16 Sven Herzberg <herzi@gnome-de.org>
* gnome-mouse-properties.c: also display the default theme (though
without a preview for technical reasons); fixes bug #322514
2006-07-24 Sven Herzberg <herzi@gnome-de.org> 2006-07-24 Sven Herzberg <herzi@gnome-de.org>
* gnome-mouse-properties.c: use ngettext() correctly * gnome-mouse-properties.c: use ngettext() correctly

View file

@ -674,6 +674,8 @@ populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) {
gchar **iterator = NULL; gchar **iterator = NULL;
gchar **paths = NULL; gchar **paths = NULL;
gboolean has_default = FALSE;
GtkTreeIter iter;
GConfClient* client = gconf_client_get_default(); GConfClient* client = gconf_client_get_default();
GtkListStore* store = GTK_LIST_STORE(gtk_tree_model_sort_get_model(model)); GtkListStore* store = GTK_LIST_STORE(gtk_tree_model_sort_get_model(model));
@ -706,7 +708,6 @@ populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) {
XcursorImage* cursor; XcursorImage* cursor;
gint sizes[] = { 12, 16, 24, 32, 36, 48, 0 }; gint sizes[] = { 12, 16, 24, 32, 36, 48, 0 };
gint i; gint i;
GtkTreeIter iter;
if(!g_file_test(cursor_dir, G_FILE_TEST_EXISTS)) { if(!g_file_test(cursor_dir, G_FILE_TEST_EXISTS)) {
g_free(cursor_dir); g_free(cursor_dir);
@ -742,6 +743,10 @@ populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) {
gtk_tree_selection_select_iter(selection, gtk_tree_selection_select_iter(selection,
&sort_iter); &sort_iter);
} }
if(G_LIKELY(!has_default) && !strcmp(name, "default")) {
has_default = TRUE;
}
} }
} }
} }
@ -755,6 +760,16 @@ populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) {
g_free(fname); g_free(fname);
} }
if(G_LIKELY(!has_default)) {
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
COLUMN_PIXBUF, NULL,
COLUMN_TEXT, _("Default Pointer"),
COLUMN_FONT_PATH, "default",
COLUMN_SIZE, 18,
-1);
}
g_free(current_theme); g_free(current_theme);
if (xpaths != NULL) { if (xpaths != NULL) {
@ -856,8 +871,6 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
GtkWidget *tree_view; GtkWidget *tree_view;
GtkTreeSelection *selection; GtkTreeSelection *selection;
GtkTreeModel *model; GtkTreeModel *model;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GConfValue *value; GConfValue *value;
gchar *cursor_font; gchar *cursor_font;
gchar *message; gchar *message;
@ -902,22 +915,18 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
model); model);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
column = gtk_tree_view_column_new (); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), -1,
renderer = gtk_cell_renderer_pixbuf_new (); "Preview", gtk_cell_renderer_pixbuf_new (),
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_attributes (column, renderer,
"pixbuf", COLUMN_PIXBUF, "pixbuf", COLUMN_PIXBUF,
NULL); NULL);
renderer = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), -1,
gtk_tree_view_column_pack_start (column, renderer, TRUE); "Name", gtk_cell_renderer_text_new (),
gtk_tree_view_column_set_attributes (column, renderer,
"markup", COLUMN_TEXT, "markup", COLUMN_TEXT,
NULL); NULL);
/* Add the cursors */ /* Add the cursors */
populate_tree_model(GTK_TREE_MODEL_SORT(model), selection); populate_tree_model(GTK_TREE_MODEL_SORT(model), selection);
g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (cursor_changed), NULL); g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (cursor_changed), NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
gconf_peditor_new_boolean gconf_peditor_new_boolean
(changeset, "/desktop/gnome/peripherals/mouse/locate_pointer", WID ("locate_pointer_toggle"), NULL); (changeset, "/desktop/gnome/peripherals/mouse/locate_pointer", WID ("locate_pointer_toggle"), NULL);