Remove the Cursors tab as it's functionality is covered by the apperance
2007-05-26 Denis Washington <dwashington@gmx.net> * gnome-mouse-properties.glade: * gnome-mouse-poperties.c: Remove the Cursors tab as it's functionality is covered by the apperance capplet now. svn path=/trunk/; revision=7889
This commit is contained in:
parent
8f718f8d28
commit
03b9c9b1e1
4 changed files with 8 additions and 906 deletions
|
@ -1,3 +1,10 @@
|
|||
2007-05-26 Denis Washington <dwashington@gmx.net>
|
||||
|
||||
* gnome-mouse-properties.glade:
|
||||
* gnome-mouse-poperties.c:
|
||||
Remove the Cursors tab as it's functionality is covered by the apperance
|
||||
capplet now.
|
||||
|
||||
2007-05-08 Jens Granseuer <jensgr@gmx.net>
|
||||
|
||||
* gnome-mouse-properties.c: (cursor_size_from_widget),
|
||||
|
|
|
@ -20,13 +20,6 @@ pixmap_DATA = \
|
|||
mouse-cursor-normal-large.png \
|
||||
mouse-cursor-white-large.png
|
||||
|
||||
|
||||
cursorfontdir = $(datadir)/gnome/cursor-fonts
|
||||
cursorfont_DATA = \
|
||||
cursor-large.pcf \
|
||||
cursor-white.pcf \
|
||||
cursor-large-white.pcf
|
||||
|
||||
Gladedir = $(pkgdatadir)/glade
|
||||
Glade_DATA = gnome-mouse-properties.glade
|
||||
|
||||
|
@ -40,4 +33,4 @@ INCLUDES = \
|
|||
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
|
||||
-DGNOMECC_GLADE_DIR="\"$(pkgdatadir)/glade\""
|
||||
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA)
|
||||
EXTRA_DIST = $(Glade_DATA) $(pixmap_DATA) $(cursorfont_DATA)
|
||||
EXTRA_DIST = $(Glade_DATA) $(pixmap_DATA)
|
||||
|
|
|
@ -88,22 +88,10 @@ enum
|
|||
DOUBLE_CLICK_TEST_ON
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_PIXBUF,
|
||||
COLUMN_TEXT,
|
||||
COLUMN_FONT_PATH,
|
||||
COLUMN_SIZE,
|
||||
N_COLUMNS
|
||||
};
|
||||
|
||||
/* We use this in at least half a dozen places, so it makes sense just to
|
||||
* define the macro */
|
||||
|
||||
#define DOUBLE_CLICK_KEY "/desktop/gnome/peripherals/mouse/double_click"
|
||||
#define CURSOR_FONT_KEY "/desktop/gnome/peripherals/mouse/cursor_font"
|
||||
#define CURSOR_SIZE_KEY "/desktop/gnome/peripherals/mouse/cursor_size"
|
||||
#define CURSOR_THEME_KEY "/desktop/gnome/peripherals/mouse/cursor_theme"
|
||||
|
||||
/* State in testing the double-click speed. Global for a great deal of
|
||||
* convenience
|
||||
|
@ -247,65 +235,6 @@ drag_threshold_from_gconf (GConfPropertyEditor *peditor,
|
|||
return new_value;
|
||||
}
|
||||
|
||||
static GConfValue *
|
||||
cursor_size_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
|
||||
{
|
||||
GConfValue *new_value;
|
||||
gint widget_val;
|
||||
|
||||
widget_val = gconf_value_get_int (value);
|
||||
|
||||
new_value = gconf_value_new (GCONF_VALUE_INT);
|
||||
switch (widget_val) {
|
||||
case 12:
|
||||
gconf_value_set_int (new_value, 0);
|
||||
break;
|
||||
case 24:
|
||||
gconf_value_set_int (new_value, 1);
|
||||
break;
|
||||
case 36:
|
||||
gconf_value_set_int (new_value, 2);
|
||||
break;
|
||||
default:
|
||||
gconf_value_set_int (new_value, -1);
|
||||
break;
|
||||
}
|
||||
|
||||
return new_value;
|
||||
}
|
||||
|
||||
static GConfValue *
|
||||
cursor_size_from_widget (GConfPropertyEditor *peditor, const GConfValue *value)
|
||||
{
|
||||
GConfValue *new_value;
|
||||
gint radio_val;
|
||||
gint size;
|
||||
|
||||
radio_val = gconf_value_get_int (value);
|
||||
|
||||
switch (radio_val) {
|
||||
case 0:
|
||||
size = 12;
|
||||
break;
|
||||
case 1:
|
||||
size = 24;
|
||||
break;
|
||||
case 2:
|
||||
size = 36;
|
||||
break;
|
||||
case -1:
|
||||
return NULL;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
new_value = gconf_value_new (GCONF_VALUE_INT);
|
||||
gconf_value_set_int (new_value, size);
|
||||
|
||||
return new_value;
|
||||
}
|
||||
|
||||
/* Double Click handling */
|
||||
|
||||
struct test_data_t
|
||||
|
@ -418,456 +347,11 @@ left_handed_toggle_cb (GConfPropertyEditor *peditor, const gchar *key, const GCo
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_XCURSOR
|
||||
static void
|
||||
cursor_theme_changed (GConfClient *client,
|
||||
guint cnxn_id,
|
||||
GConfEntry *entry,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeView * view = GTK_TREE_VIEW(user_data);
|
||||
GtkTreeSelection* selection = gtk_tree_view_get_selection(view);
|
||||
GtkTreeModel * smodel = gtk_tree_view_get_model(view);
|
||||
GtkTreeModel * model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(smodel));
|
||||
gchar * theme;
|
||||
gint size = gconf_client_get_int (client, CURSOR_SIZE_KEY, NULL);
|
||||
|
||||
g_return_if_fail (gtk_tree_model_get_iter_first (model, &iter));
|
||||
theme = gconf_client_get_string (client, CURSOR_THEME_KEY, NULL);
|
||||
|
||||
do {
|
||||
gchar* theme_name;
|
||||
gint cursor_size;
|
||||
|
||||
gtk_tree_model_get(model, &iter,
|
||||
COLUMN_FONT_PATH, &theme_name,
|
||||
COLUMN_SIZE, &cursor_size,
|
||||
-1);
|
||||
|
||||
if(theme_name && theme && !strcmp(theme_name, theme) && cursor_size == size) {
|
||||
GtkTreeIter sort_iter;
|
||||
gtk_tree_model_sort_convert_child_iter_to_iter
|
||||
(GTK_TREE_MODEL_SORT(smodel), &sort_iter, &iter);
|
||||
gtk_tree_selection_select_iter(selection, &sort_iter);
|
||||
g_free(theme);
|
||||
g_free(theme_name);
|
||||
return;
|
||||
}
|
||||
g_free(theme_name);
|
||||
} while (gtk_tree_model_iter_next(model, &iter));
|
||||
|
||||
/* we didn't find it */
|
||||
gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(view));
|
||||
g_free(theme);
|
||||
}
|
||||
|
||||
#else /* !HAVE_XCURSOR */
|
||||
|
||||
static void
|
||||
cursor_font_changed (GConfClient *client,
|
||||
guint cnxn_id,
|
||||
GConfEntry *entry,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkTreeView *tree_view;
|
||||
gchar *cursor_font;
|
||||
gchar *cursor_text;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeModel *smodel;
|
||||
GtkTreeSelection *selection;
|
||||
|
||||
tree_view = GTK_TREE_VIEW (user_data);
|
||||
selection = gtk_tree_view_get_selection (tree_view);
|
||||
smodel = gtk_tree_view_get_model (tree_view);
|
||||
model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT(smodel));
|
||||
|
||||
cursor_font = gconf_client_get_string (client, CURSOR_FONT_KEY, NULL);
|
||||
|
||||
/* If there's no value set, then don't select anything, and return */
|
||||
if ( cursor_font == NULL ) {
|
||||
gtk_tree_selection_unselect_all (selection);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_tree_model_get_iter_root (model, &iter);
|
||||
|
||||
do {
|
||||
gchar *temp_cursor_font;
|
||||
GtkTreeIter sort_iter;
|
||||
gtk_tree_model_get (model, &iter,
|
||||
COLUMN_FONT_PATH, &temp_cursor_font,
|
||||
-1);
|
||||
gtk_tree_model_sort_convert_child_iter_to_iter
|
||||
(GTK_TREE_MODEL_SORT(smodel), &sort_iter, &iter);
|
||||
if ((cursor_font == NULL) ||
|
||||
((temp_cursor_font != NULL && cursor_font != NULL) &&
|
||||
(!strcmp (cursor_font, temp_cursor_font)))) {
|
||||
if (!gtk_tree_selection_iter_is_selected (selection, &sort_iter))
|
||||
gtk_tree_selection_select_iter (selection, &sort_iter);
|
||||
g_free (temp_cursor_font);
|
||||
g_free (cursor_font);
|
||||
return;
|
||||
}
|
||||
g_free (temp_cursor_font);
|
||||
} while (gtk_tree_model_iter_next (model, &iter));
|
||||
|
||||
/* we didn't find it; we add it to the end. */
|
||||
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
|
||||
cursor_text = g_strdup_printf ("<b>%s</b>\n%s",
|
||||
_("Unknown Pointer"), cursor_font);
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
|
||||
COLUMN_TEXT, cursor_text,
|
||||
COLUMN_FONT_PATH, cursor_font,
|
||||
-1);
|
||||
gtk_tree_selection_select_iter (selection, &iter);
|
||||
|
||||
g_free (cursor_font);
|
||||
g_free (cursor_text);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
read_cursor_font (void)
|
||||
{
|
||||
DIR *dir;
|
||||
gchar *dir_name;
|
||||
struct dirent *file_dirent;
|
||||
|
||||
dir_name = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2/share/cursor-fonts", NULL);
|
||||
if (! g_file_test (dir_name, G_FILE_TEST_EXISTS)) {
|
||||
g_free (dir_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dir = opendir (dir_name);
|
||||
|
||||
while ((file_dirent = readdir (dir)) != NULL) {
|
||||
struct stat st;
|
||||
gchar *link_name;
|
||||
|
||||
link_name = g_build_filename (dir_name, file_dirent->d_name, NULL);
|
||||
if (lstat (link_name, &st)) {
|
||||
g_free (link_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (S_ISLNK (st.st_mode)) {
|
||||
gint length;
|
||||
gchar target[256];
|
||||
|
||||
length = readlink (link_name, target, 255);
|
||||
if (length > 0) {
|
||||
gchar *retval;
|
||||
target[length] = '\0';
|
||||
retval = g_strdup (target);
|
||||
g_free (link_name);
|
||||
closedir (dir);
|
||||
return retval;
|
||||
}
|
||||
|
||||
}
|
||||
g_free (link_name);
|
||||
}
|
||||
g_free (dir_name);
|
||||
closedir (dir);
|
||||
return NULL;
|
||||
}
|
||||
#endif /* !HAVE_XCURSOR */
|
||||
|
||||
static void
|
||||
cursor_changed (GtkTreeSelection *selection,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreeModel *model = NULL;
|
||||
GtkTreeIter iter;
|
||||
gchar *cursor_font = NULL;
|
||||
gint cursor_size;
|
||||
GConfClient *client = gconf_client_get_default ();
|
||||
|
||||
if (! gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||
return;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
COLUMN_FONT_PATH, &cursor_font,
|
||||
COLUMN_SIZE, &cursor_size,
|
||||
-1);
|
||||
if (cursor_font != NULL) {
|
||||
#ifdef HAVE_XCURSOR
|
||||
gconf_client_set_string (client,
|
||||
CURSOR_THEME_KEY, cursor_font, NULL);
|
||||
gconf_client_set_int (client,
|
||||
CURSOR_SIZE_KEY, cursor_size, NULL);
|
||||
#else
|
||||
gconf_client_set_string (client,
|
||||
CURSOR_FONT_KEY, cursor_font, NULL);
|
||||
#endif
|
||||
g_free (cursor_font);
|
||||
} else {
|
||||
#ifdef HAVE_XCURSOR
|
||||
gconf_client_unset (client,
|
||||
CURSOR_THEME_KEY, NULL);
|
||||
gconf_client_unset (client,
|
||||
CURSOR_SIZE_KEY, NULL);
|
||||
#else
|
||||
gconf_client_unset (client,
|
||||
CURSOR_FONT_KEY, NULL);
|
||||
#endif
|
||||
}
|
||||
g_object_unref (client);
|
||||
}
|
||||
|
||||
#ifdef HAVE_XCURSOR
|
||||
static GdkPixbuf*
|
||||
gdk_pixbuf_from_xcursor_image(XcursorImage* cursor) {
|
||||
GdkPixbuf* pixbuf;
|
||||
#define BUF_SIZE sizeof(guint32) * cursor->width * cursor->height
|
||||
guchar* buf = malloc(BUF_SIZE);
|
||||
guchar* it;
|
||||
memset(buf, '\0', BUF_SIZE);
|
||||
|
||||
for(it = buf; it < (buf + BUF_SIZE); it += 4) {
|
||||
// can we get rid of this by using guint32 ?
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
// on little endianess it's BGRA to RGBA
|
||||
it[0] = ((guchar*)(cursor->pixels))[it - buf + 2];
|
||||
it[1] = ((guchar*)(cursor->pixels))[it - buf + 1];
|
||||
it[2] = ((guchar*)(cursor->pixels))[it - buf + 0];
|
||||
it[3] = ((guchar*)(cursor->pixels))[it - buf + 3];
|
||||
#else
|
||||
// on big endianess it's ARGB to RGBA
|
||||
it[0] = ((guchar*)cursor->pixels)[it - buf + 1];
|
||||
it[1] = ((guchar*)cursor->pixels)[it - buf + 2];
|
||||
it[2] = ((guchar*)cursor->pixels)[it - buf + 3];
|
||||
it[3] = ((guchar*)cursor->pixels)[it - buf + 0];
|
||||
#endif
|
||||
}
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_data((const guchar *)buf,
|
||||
GDK_COLORSPACE_RGB, TRUE, 8,
|
||||
cursor->width, cursor->height,
|
||||
cursor->width * 4,
|
||||
(GdkPixbufDestroyNotify)g_free,
|
||||
NULL);
|
||||
|
||||
if(!pixbuf) {
|
||||
g_free(buf);
|
||||
}
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) {
|
||||
#ifdef HAVE_XCURSOR
|
||||
// add the XCursor themes - paths taken from <xc/lib/Xcursor.library.c>
|
||||
const gchar* const path_defs[] = {
|
||||
"%s/.icons/",
|
||||
"/usr/share/icons/",
|
||||
"/usr/share/pixmaps/",
|
||||
"/usr/X11R6/lib/X11/icons/",
|
||||
NULL
|
||||
};
|
||||
const gchar *xpaths = g_getenv ("XCURSOR_PATH");
|
||||
|
||||
gchar **iterator = NULL;
|
||||
gchar **paths = NULL;
|
||||
gboolean has_default = FALSE;
|
||||
GtkTreeIter iter;
|
||||
|
||||
GConfClient* client = gconf_client_get_default();
|
||||
GtkListStore* store = GTK_LIST_STORE(gtk_tree_model_sort_get_model(model));
|
||||
gchar* current_theme = gconf_client_get_string(client, CURSOR_THEME_KEY, NULL);
|
||||
gint current_size = gconf_client_get_int(client, CURSOR_SIZE_KEY, NULL);
|
||||
g_object_unref(client);
|
||||
client = NULL;
|
||||
|
||||
if (xpaths != NULL) {
|
||||
paths = g_strsplit (xpaths, ":", 0);
|
||||
} else {
|
||||
paths = g_strdupv ((gchar **) path_defs);
|
||||
}
|
||||
|
||||
for(iterator = paths; *iterator; iterator++) {
|
||||
gchar* fname = NULL;
|
||||
GDir* folder = NULL;
|
||||
const gchar* name;
|
||||
|
||||
if(strchr(*iterator, '%')) {
|
||||
fname = g_strdup_printf(*iterator, g_getenv("HOME"));
|
||||
} else {
|
||||
fname = g_strdup(*iterator);
|
||||
}
|
||||
|
||||
folder = g_dir_open(fname, 0, NULL);
|
||||
|
||||
while(folder && (name = g_dir_read_name(folder))) {
|
||||
gchar* cursor_dir = g_strdup_printf("%s/%s/cursors/", fname, name);
|
||||
XcursorImage* cursor;
|
||||
gint sizes[] = { 12, 16, 24, 32, 36, 40, 48, 64, 0 };
|
||||
gint i;
|
||||
|
||||
if(!g_file_test(cursor_dir, G_FILE_TEST_EXISTS)) {
|
||||
g_free(cursor_dir);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (i = 0; sizes[i] != 0; i++) {
|
||||
cursor = XcursorLibraryLoadImage("left_ptr", name, sizes[i]);
|
||||
if (cursor && cursor->size != sizes[i]) {
|
||||
XcursorImageDestroy (cursor);
|
||||
cursor = NULL;
|
||||
}
|
||||
|
||||
if(cursor) {
|
||||
GdkPixbuf* pixbuf = gdk_pixbuf_from_xcursor_image(cursor);
|
||||
|
||||
if(pixbuf) {
|
||||
gtk_list_store_append(store, &iter);
|
||||
gtk_list_store_set(store, &iter,
|
||||
COLUMN_PIXBUF, pixbuf,
|
||||
COLUMN_TEXT, name,
|
||||
COLUMN_FONT_PATH, name,
|
||||
COLUMN_SIZE, sizes[i],
|
||||
-1);
|
||||
g_object_unref(pixbuf);
|
||||
|
||||
if(current_theme != NULL && !strcmp(current_theme, name) &&
|
||||
current_size == sizes[i]) {
|
||||
GtkTreeIter sort_iter;
|
||||
gtk_tree_model_sort_convert_child_iter_to_iter(model,
|
||||
&sort_iter,
|
||||
&iter);
|
||||
gtk_tree_selection_select_iter(selection,
|
||||
&sort_iter);
|
||||
}
|
||||
|
||||
if(G_LIKELY(!has_default) && !strcmp(name, "default")) {
|
||||
has_default = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_free(cursor_dir);
|
||||
}
|
||||
|
||||
if(folder) {
|
||||
g_dir_close(folder);
|
||||
}
|
||||
g_free(fname);
|
||||
}
|
||||
g_strfreev (paths);
|
||||
|
||||
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);
|
||||
|
||||
#else /* !HAVE_XCURSOR */
|
||||
gchar* cursor_font;
|
||||
static const gchar* builtins[][5] = {
|
||||
{
|
||||
"gnome/cursor-fonts/cursor-normal.pcf",
|
||||
N_("Default Pointer"),
|
||||
N_("Default Pointer - Current"),
|
||||
N_("The default pointer that ships with X"),
|
||||
"mouse-cursor-normal.png"
|
||||
}, {
|
||||
"gnome/cursor-fonts/cursor-white.pcf",
|
||||
N_("White Pointer"),
|
||||
N_("White Pointer - Current"),
|
||||
N_("The default pointer inverted"),
|
||||
"mouse-cursor-white.png"
|
||||
}, {
|
||||
"gnome/cursor-fonts/cursor-large.pcf",
|
||||
N_("Large Pointer"),
|
||||
N_("Large Pointer - Current"),
|
||||
N_("Large version of normal pointer"),
|
||||
"mouse-cursor-normal-large.png"
|
||||
}, {
|
||||
"gnome/cursor-fonts/cursor-large-white.pcf",
|
||||
N_("Large White Pointer - Current"),
|
||||
N_("Large White Pointer"),
|
||||
N_("Large version of white pointer"),
|
||||
"mouse-cursor-white-large.png"
|
||||
}
|
||||
};
|
||||
GtkListStore* store = GTK_LIST_STORE(gtk_tree_model_sort_get_model(model));
|
||||
guint i;
|
||||
// add the default x font cursors
|
||||
cursor_font = read_cursor_font();
|
||||
|
||||
if(!cursor_font) {
|
||||
cursor_font = g_strdup (builtins[0][0]);
|
||||
}
|
||||
|
||||
for(i = 0; i < G_N_ELEMENTS(builtins); i++) {
|
||||
GtkTreeIter iter;
|
||||
gchar* cursor_string;
|
||||
gchar* filename;
|
||||
GdkPixbuf* pixbuf;
|
||||
|
||||
filename = gnome_program_locate_file (gnome_program_get(), GNOME_FILE_DOMAIN_APP_PIXMAP, builtins[i][4], TRUE, NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
|
||||
g_free(filename);
|
||||
|
||||
filename = gnome_program_locate_file (gnome_program_get(), GNOME_FILE_DOMAIN_DATADIR, builtins[i][0], FALSE, NULL);
|
||||
if(cursor_font && !strcmp(cursor_font, filename)) {
|
||||
cursor_string = g_strdup_printf("<b>%s</b>\n%s", ((const gchar*)builtins[i][2]), _((const gchar*)builtins[i][3]));
|
||||
} else {
|
||||
cursor_string = g_strdup_printf("<b>%s</b>\n%s", _((const gchar*)builtins[i][1]), _((const gchar*)builtins[i][3]));
|
||||
}
|
||||
gtk_list_store_append(store, &iter);
|
||||
gtk_list_store_set(store, &iter,
|
||||
COLUMN_PIXBUF, pixbuf,
|
||||
COLUMN_TEXT, cursor_string,
|
||||
COLUMN_FONT_PATH, filename,
|
||||
-1);
|
||||
|
||||
if(cursor_font && !strcmp(cursor_font, filename)) {
|
||||
GtkTreeIter sort_iter;
|
||||
gtk_tree_model_sort_convert_child_iter_to_iter(model,
|
||||
&sort_iter,
|
||||
&iter);
|
||||
gtk_tree_selection_select_iter(selection, &sort_iter);
|
||||
}
|
||||
|
||||
g_free(cursor_string);
|
||||
g_free(filename);
|
||||
}
|
||||
|
||||
if(0 == gtk_tree_selection_count_selected_rows(selection)) {
|
||||
GtkTreeIter child_iter,
|
||||
sort_iter;
|
||||
gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &child_iter, NULL, 0);
|
||||
gtk_tree_model_sort_convert_child_iter_to_iter(model,
|
||||
&sort_iter,
|
||||
&child_iter);
|
||||
gtk_tree_selection_select_iter(selection,
|
||||
&sort_iter);
|
||||
}
|
||||
|
||||
g_free(cursor_font);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Set up the property editors in the dialog. */
|
||||
static void
|
||||
setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
|
||||
{
|
||||
GObject *peditor;
|
||||
GtkWidget *tree_view;
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeModel *model;
|
||||
GConfValue *value;
|
||||
gchar *message;
|
||||
|
||||
|
@ -901,37 +385,6 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
|
|||
gtk_label_set_label ((GtkLabel*) WID ("delay_label"), message);
|
||||
g_free (message);
|
||||
|
||||
/* Cursors page */
|
||||
tree_view = WID ("cursor_tree");
|
||||
model = (GtkTreeModel *) gtk_list_store_new (N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
|
||||
model = (GtkTreeModel *) gtk_tree_model_sort_new_with_model (model);
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view),
|
||||
model);
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
|
||||
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
|
||||
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), -1,
|
||||
"Preview", gtk_cell_renderer_pixbuf_new (),
|
||||
"pixbuf", COLUMN_PIXBUF,
|
||||
NULL);
|
||||
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), -1,
|
||||
"Name", gtk_cell_renderer_text_new (),
|
||||
"markup", COLUMN_TEXT,
|
||||
NULL);
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), 1, GTK_SORT_ASCENDING);
|
||||
|
||||
/* Add the cursors */
|
||||
populate_tree_model(GTK_TREE_MODEL_SORT(model), selection);
|
||||
g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (cursor_changed), NULL);
|
||||
|
||||
gconf_peditor_new_boolean
|
||||
(changeset, "/desktop/gnome/peripherals/mouse/locate_pointer", WID ("locate_pointer_toggle"), NULL);
|
||||
|
||||
peditor = gconf_peditor_new_combo_box
|
||||
(changeset, "/desktop/gnome/peripherals/mouse/cursor_size", WID ("cursor_size_omenu"),
|
||||
"conv-to-widget-cb", cursor_size_to_widget,
|
||||
"conv-from-widget-cb", cursor_size_from_widget,
|
||||
NULL);
|
||||
|
||||
/* Motion page */
|
||||
/* speed */
|
||||
gconf_peditor_new_numeric_range
|
||||
|
@ -950,22 +403,6 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
|
|||
(changeset, "/desktop/gnome/peripherals/mouse/drag_threshold", WID ("drag_threshold_scale"),
|
||||
"conv-to-widget-cb", drag_threshold_from_gconf,
|
||||
NULL);
|
||||
|
||||
/* listen to cursors changing and set it up initially */
|
||||
#ifdef HAVE_XCURSOR
|
||||
gconf_client_notify_add (client,
|
||||
CURSOR_THEME_KEY,
|
||||
cursor_theme_changed,
|
||||
tree_view, NULL, NULL);
|
||||
cursor_theme_changed (client, 0, NULL, tree_view);
|
||||
#else
|
||||
gconf_client_notify_add (client,
|
||||
CURSOR_FONT_KEY,
|
||||
cursor_font_changed,
|
||||
tree_view, NULL, NULL);
|
||||
cursor_font_changed (client, 0, NULL, tree_view);
|
||||
#endif
|
||||
g_object_unref (client);
|
||||
}
|
||||
|
||||
/* Construct the dialog */
|
||||
|
@ -975,7 +412,6 @@ create_dialog (void)
|
|||
{
|
||||
GladeXML *dialog;
|
||||
GtkSizeGroup *size_group;
|
||||
gchar *text;
|
||||
|
||||
/* register the custom type */
|
||||
(void) mouse_capplet_check_button_get_type ();
|
||||
|
@ -984,10 +420,6 @@ create_dialog (void)
|
|||
if (!dialog)
|
||||
return NULL;
|
||||
|
||||
text = g_strdup_printf ("<b>%s</b>", _("Pointer Theme"));
|
||||
gtk_label_set_markup (GTK_LABEL (WID ("cursor_category_label")), text);
|
||||
g_free (text);
|
||||
|
||||
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
gtk_size_group_add_widget (size_group, WID ("acceleration_label"));
|
||||
gtk_size_group_add_widget (size_group, WID ("sensitivity_label"));
|
||||
|
|
|
@ -478,336 +478,6 @@
|
|||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="cursors_vbox">
|
||||
<property name="border_width">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">18</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="cursor_appearance_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="cursor_category_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox8">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label15">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"> </property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="cursor_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="cursor_font_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="cursor_tree">
|
||||
<property name="width_request">350</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="fixed_height_mode">False</property>
|
||||
<property name="hover_selection">False</property>
|
||||
<property name="hover_expand">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox5">
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">8</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Pointer Size:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="mnemonic_widget">cursor_size_omenu</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="cursor_size_omenu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="items" translatable="yes">Small
|
||||
Medium
|
||||
Large</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="cursor_locate_pointer_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="locate_category_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Locate Pointer</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox9">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label16">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"> </property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox6">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="locate_pointer_toggle">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Highlight the _pointer when you press Ctrl</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
<property name="tab_fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Pointers</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox4">
|
||||
<property name="border_width">12</property>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue