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:
parent
ce30ca4583
commit
f6691b0266
2 changed files with 47 additions and 33 deletions
|
@ -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
|
||||||
|
|
|
@ -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));
|
||||||
|
@ -692,7 +694,7 @@ populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) {
|
||||||
gchar* fname = NULL;
|
gchar* fname = NULL;
|
||||||
GDir* folder = NULL;
|
GDir* folder = NULL;
|
||||||
const gchar* name;
|
const gchar* name;
|
||||||
|
|
||||||
if(strchr(*iterator, '%')) {
|
if(strchr(*iterator, '%')) {
|
||||||
fname = g_strdup_printf(*iterator, g_getenv("HOME"));
|
fname = g_strdup_printf(*iterator, g_getenv("HOME"));
|
||||||
} else {
|
} else {
|
||||||
|
@ -700,26 +702,25 @@ populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) {
|
||||||
}
|
}
|
||||||
|
|
||||||
folder = g_dir_open(fname, 0, NULL);
|
folder = g_dir_open(fname, 0, NULL);
|
||||||
|
|
||||||
while(folder && (name = g_dir_read_name(folder))) {
|
while(folder && (name = g_dir_read_name(folder))) {
|
||||||
gchar* cursor_dir = g_strdup_printf("%s/%s/cursors/", fname, name);
|
gchar* cursor_dir = g_strdup_printf("%s/%s/cursors/", fname, name);
|
||||||
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);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; sizes[i] != 0; i++) {
|
for (i = 0; sizes[i] != 0; i++) {
|
||||||
cursor = XcursorLibraryLoadImage("left_ptr", name, sizes[i]);
|
cursor = XcursorLibraryLoadImage("left_ptr", name, sizes[i]);
|
||||||
if (cursor && cursor->size != sizes[i]) {
|
if (cursor && cursor->size != sizes[i]) {
|
||||||
XcursorImageDestroy (cursor);
|
XcursorImageDestroy (cursor);
|
||||||
cursor = NULL;
|
cursor = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cursor) {
|
if(cursor) {
|
||||||
GdkPixbuf* pixbuf = gdk_pixbuf_from_xcursor_image(cursor);
|
GdkPixbuf* pixbuf = gdk_pixbuf_from_xcursor_image(cursor);
|
||||||
|
|
||||||
|
@ -732,7 +733,7 @@ populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) {
|
||||||
COLUMN_SIZE, sizes[i],
|
COLUMN_SIZE, sizes[i],
|
||||||
-1);
|
-1);
|
||||||
g_object_unref(pixbuf);
|
g_object_unref(pixbuf);
|
||||||
|
|
||||||
if(current_theme != NULL && !strcmp(current_theme, name) &&
|
if(current_theme != NULL && !strcmp(current_theme, name) &&
|
||||||
current_size == sizes[i]) {
|
current_size == sizes[i]) {
|
||||||
GtkTreeIter sort_iter;
|
GtkTreeIter sort_iter;
|
||||||
|
@ -742,10 +743,14 @@ 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(cursor_dir);
|
g_free(cursor_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,7 +759,17 @@ 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) {
|
||||||
|
@ -765,21 +780,21 @@ populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) {
|
||||||
static const gchar* builtins[][5] = {
|
static const gchar* builtins[][5] = {
|
||||||
{
|
{
|
||||||
"gnome/cursor-fonts/cursor-normal.pcf",
|
"gnome/cursor-fonts/cursor-normal.pcf",
|
||||||
N_("Default Pointer"),
|
N_("Default Pointer"),
|
||||||
N_("Default Pointer - Current"),
|
N_("Default Pointer - Current"),
|
||||||
N_("The default pointer that ships with X"),
|
N_("The default pointer that ships with X"),
|
||||||
"mouse-cursor-normal.png"
|
"mouse-cursor-normal.png"
|
||||||
}, {
|
}, {
|
||||||
"gnome/cursor-fonts/cursor-white.pcf",
|
"gnome/cursor-fonts/cursor-white.pcf",
|
||||||
N_("White Pointer"),
|
N_("White Pointer"),
|
||||||
N_("White Pointer - Current"),
|
N_("White Pointer - Current"),
|
||||||
N_("The default pointer inverted"),
|
N_("The default pointer inverted"),
|
||||||
"mouse-cursor-white.png"
|
"mouse-cursor-white.png"
|
||||||
}, {
|
}, {
|
||||||
"gnome/cursor-fonts/cursor-large.pcf",
|
"gnome/cursor-fonts/cursor-large.pcf",
|
||||||
N_("Large Pointer"),
|
N_("Large Pointer"),
|
||||||
N_("Large Pointer - Current"),
|
N_("Large Pointer - Current"),
|
||||||
N_("Large version of normal pointer"),
|
N_("Large version of normal pointer"),
|
||||||
"mouse-cursor-normal-large.png"
|
"mouse-cursor-normal-large.png"
|
||||||
}, {
|
}, {
|
||||||
"gnome/cursor-fonts/cursor-large-white.pcf",
|
"gnome/cursor-fonts/cursor-large-white.pcf",
|
||||||
|
@ -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,23 +915,19 @@ 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);
|
"pixbuf", COLUMN_PIXBUF,
|
||||||
gtk_tree_view_column_set_attributes (column, renderer,
|
NULL);
|
||||||
"pixbuf", COLUMN_PIXBUF,
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), -1,
|
||||||
NULL);
|
"Name", gtk_cell_renderer_text_new (),
|
||||||
renderer = gtk_cell_renderer_text_new ();
|
"markup", COLUMN_TEXT,
|
||||||
gtk_tree_view_column_pack_start (column, renderer, TRUE);
|
NULL);
|
||||||
gtk_tree_view_column_set_attributes (column, renderer,
|
|
||||||
"markup", COLUMN_TEXT,
|
|
||||||
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);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue