Background Capplet UI
- From: Rodney Dawes <dobey novell com>
- To: release-team gnome org
- Subject: Background Capplet UI
- Date: Thu, 09 Feb 2006 23:18:33 -0500
Here is a patch I just cooked to move the background capplet back to
instant apply. The patch includes a requirement on the
yet-to-be-released gtk+ 2.8.12 to depend on the cairo workaround patch
that Federico so generously worked on, so that we can at least ensure
some amount of speedup from previous incarnations fo the desktop.
Also, rather than using the "Close" button, I have changed it to use
the text "Finish" with the stock apply icon, based on the user testing
that suggests instant apply with "Close" is confusing to target users.
Furthermore, this patch does not bring back the extra key-repeat delay
timeout, to help speedup the actual application of the settings.
The related bug numbers are: #327335 #330587 #329818 and #330168
Given the fuss on desktop-devel-list, I presume that I can commit this
ASAP, right? Thanks.
-- dobey
? capplets/background/gnome-background-properties.gladep
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-control-center/ChangeLog,v
retrieving revision 1.765
diff -u -p -r1.765 ChangeLog
--- ChangeLog 8 Feb 2006 11:57:40 -0000 1.765
+++ ChangeLog 10 Feb 2006 03:53:46 -0000
@@ -1,3 +1,8 @@
+2006-02-09 Rodney Dawes <dobey novell com>
+
+ * configure.in: Require gtk+ 2.8.12 for cairo speed workaround for
+ applying the desktop background image
+
2006-02-08 Rodrigo Moya <rodrigo novell com>
Fixes #330335
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gnome-control-center/configure.in,v
retrieving revision 1.536
diff -u -p -r1.536 configure.in
--- configure.in 8 Feb 2006 11:57:40 -0000 1.536
+++ configure.in 10 Feb 2006 03:53:47 -0000
@@ -24,7 +24,7 @@ GNOME_DOC_INIT
m4_define(gnomevfs_minver, 2.0.0)
m4_define(fontconfig_minver, 1.0.0)
m4_define(xft_minver, 2.1.2)
-m4_define(gtk_minver, 2.6.0)
+m4_define(gtk_minver, 2.8.12)
m4_define(libbonobo_minver, 2.0.0)
m4_define(libgnomeui_minver, 2.2.0)
m4_define(nautilus_minver, 2.6.0)
Index: capplets/background/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-control-center/capplets/background/ChangeLog,v
retrieving revision 1.208
diff -u -p -r1.208 ChangeLog
--- capplets/background/ChangeLog 27 Jan 2006 03:15:06 -0000 1.208
+++ capplets/background/ChangeLog 10 Feb 2006 03:53:48 -0000
@@ -1,3 +1,24 @@
+2006-02-09 Rodney Dawes <dobey novell com>
+
+ * gnome-background-properties.glade: Replace the Apply/Cancel/OK
+ buttons with a Finish button, using the stock apply icon
+
+ * gnome-wp-capplet.c (gnome_wp_props_wp_set): Don't need to check if
+ we are the same image as we were before now
+ (gnome_wp_props_revert): Remove this as it is no longer needed
+ (gnome_wp_props_wp_selected): Call the set function here
+ (gnome_wp_main_quit): Remove the freeing of capplet->old_item
+ (wallpaper_properties_clicked): Only handle GTK_RESPONSE_OK as an
+ action to close the dialog now, as we are instant apply again
+ (gnome_wp_scale_type_changed, gnome_wp_shade_type_changed):
+ (gnome_wp_color_changed): Set the appropriate gconf keys here
+ (gnome_wp_load_stuffs): Remove references to capplet->old_item
+
+ * gnome-wp-capplet.h (struct _GnomeWPCapplet): Remove old_item object
+
+ Fixes #327335, #330587 and #329818
+ Partially fixes #330168
+
2006-01-26 Rodney Dawes <dobey novell com>
* gnome-wp-capplet.c (gnome_wp_capplet_scroll_to_item): If we are
Index: capplets/background/gnome-background-properties.glade
===================================================================
RCS file: /cvs/gnome/gnome-control-center/capplets/background/gnome-background-properties.glade,v
retrieving revision 1.6
diff -u -p -r1.6 gnome-background-properties.glade
--- capplets/background/gnome-background-properties.glade 27 Jan 2006 03:01:58 -0000 1.6
+++ capplets/background/gnome-background-properties.glade 10 Feb 2006 03:53:48 -0000
@@ -48,41 +48,77 @@
</child>
<child>
- <widget class="GtkButton" id="button1">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-apply</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-10</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button2">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
<widget class="GtkButton" id="button3">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-apply</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="label">_Finish</property>
+ <property name="use_underline">True</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>
+ </widget>
+ </child>
+ </widget>
+ </child>
</widget>
</child>
</widget>
Index: capplets/background/gnome-wp-capplet.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/capplets/background/gnome-wp-capplet.c,v
retrieving revision 1.41
diff -u -p -r1.41 gnome-wp-capplet.c
--- capplets/background/gnome-wp-capplet.c 27 Jan 2006 03:15:06 -0000 1.41
+++ capplets/background/gnome-wp-capplet.c 10 Feb 2006 03:53:49 -0000
@@ -278,7 +278,6 @@ static gboolean gnome_wp_props_wp_set (G
GnomeWPItem * item;
GConfChangeSet * cs;
gchar * wpfile;
- gboolean retval = FALSE;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (capplet->treeview));
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
@@ -286,79 +285,38 @@ static gboolean gnome_wp_props_wp_set (G
item = g_hash_table_lookup (capplet->wphash, wpfile);
- if (g_utf8_collate (capplet->old_item->filename, wpfile) != 0) {
- cs = gconf_change_set_new ();
+ cs = gconf_change_set_new ();
- if (!strcmp (item->filename, "(none)")) {
- gconf_change_set_set_string (cs, WP_OPTIONS_KEY, "none");
- gconf_change_set_set_string (cs, WP_FILE_KEY, "");
- } else {
- gchar * uri;
+ if (!strcmp (item->filename, "(none)")) {
+ gconf_change_set_set_string (cs, WP_OPTIONS_KEY, "none");
+ gconf_change_set_set_string (cs, WP_FILE_KEY, "");
+ } else {
+ gchar * uri;
+
+ if (g_utf8_validate (item->filename, -1, NULL))
+ uri = g_strdup (item->filename);
+ else
+ uri = g_filename_to_utf8 (item->filename, -1, NULL, NULL, NULL);
- if (g_utf8_validate (item->filename, -1, NULL))
- uri = g_strdup (item->filename);
- else
- uri = g_filename_to_utf8 (item->filename, -1, NULL, NULL, NULL);
+ gconf_change_set_set_string (cs, WP_FILE_KEY, uri);
+ g_free (uri);
- gconf_change_set_set_string (cs, WP_FILE_KEY, uri);
- g_free (uri);
-
- gconf_change_set_set_string (cs, WP_OPTIONS_KEY, item->options);
- }
-
- gconf_change_set_set_string (cs, WP_SHADING_KEY, item->shade_type);
-
- gconf_change_set_set_string (cs, WP_PCOLOR_KEY, item->pri_color);
- gconf_change_set_set_string (cs, WP_SCOLOR_KEY, item->sec_color);
-
- gconf_client_commit_change_set (capplet->client, cs, TRUE, NULL);
-
- gconf_change_set_unref (cs);
-
- retval = TRUE;
+ gconf_change_set_set_string (cs, WP_OPTIONS_KEY, item->options);
}
- g_free (wpfile);
- }
- return retval;
-}
-
-static gboolean gnome_wp_props_revert (GnomeWPCapplet * capplet) {
- GnomeWPItem * item;
- GConfChangeSet * cs;
- gboolean retval = FALSE;
-
- item = capplet->old_item;
- cs = gconf_change_set_new ();
+ gconf_change_set_set_string (cs, WP_SHADING_KEY, item->shade_type);
- if (!strcmp (item->filename, "(none)")) {
- gconf_change_set_set_string (cs, WP_OPTIONS_KEY, "none");
- } else {
- gchar * uri;
+ gconf_change_set_set_string (cs, WP_PCOLOR_KEY, item->pri_color);
+ gconf_change_set_set_string (cs, WP_SCOLOR_KEY, item->sec_color);
- if (g_utf8_validate (item->filename, -1, NULL))
- uri = g_strdup (item->filename);
- else
- uri = g_filename_to_utf8 (item->filename, -1, NULL, NULL, NULL);
+ gconf_client_commit_change_set (capplet->client, cs, TRUE, NULL);
- gconf_change_set_set_string (cs, WP_FILE_KEY, uri);
- g_free (uri);
+ gconf_change_set_unref (cs);
- gconf_change_set_set_string (cs, WP_OPTIONS_KEY, item->options);
+ g_free (wpfile);
}
- gconf_change_set_set_string (cs, WP_SHADING_KEY, item->shade_type);
-
- gconf_change_set_set_string (cs, WP_PCOLOR_KEY, item->pri_color);
- gconf_change_set_set_string (cs, WP_SCOLOR_KEY, item->sec_color);
-
- gconf_client_commit_change_set (capplet->client, cs, TRUE, NULL);
-
- gconf_change_set_unref (cs);
-
- retval = TRUE;
-
- return retval;
+ return FALSE;
}
static void gnome_wp_props_wp_selected (GtkTreeSelection * selection,
@@ -389,6 +347,8 @@ static void gnome_wp_props_wp_selected (
} else {
gtk_widget_set_sensitive (capplet->rm_button, FALSE);
}
+
+ gnome_wp_props_wp_set (capplet);
}
static void gnome_wp_remove_wp (gchar * key, GnomeWPItem * item,
@@ -408,9 +368,7 @@ static void gnome_wp_remove_wp (gchar *
}
void gnome_wp_main_quit (GnomeWPCapplet * capplet) {
- gnome_wp_item_free (capplet->old_item);
- g_hash_table_foreach (capplet->wphash, (GHFunc) gnome_wp_remove_wp,
- capplet);
+ g_hash_table_foreach (capplet->wphash, (GHFunc) gnome_wp_remove_wp, capplet);
gnome_wp_xml_save_list (capplet);
@@ -429,35 +387,11 @@ static void wallpaper_properties_clicked
wp_properties_help (GTK_WINDOW (dialog),
"user-guide.xml", "goscustdesk-7");
break;
- case GTK_RESPONSE_APPLY:
- gnome_wp_props_wp_set (capplet);
- break;
case GTK_RESPONSE_OK:
- if (gnome_wp_props_wp_set (capplet)) {
- /*
- This is here because applying the background is about 1.4 seconds
- slow, with nautilus managing the desktop on my Radeon 7500
- Without nautilus, this is about 600000 usecs
- */
- usleep (1400000);
- }
- gtk_widget_destroy (dialog);
- gnome_wp_main_quit (capplet);
- break;
- case GTK_RESPONSE_DELETE_EVENT:
- case GTK_RESPONSE_CANCEL: {
- if (gnome_wp_props_revert (capplet)) {
- /*
- Reverting the preferences will also have the same slowness as
- applying them and quitting, so we need a timeout here as well
- */
- usleep (1400000);
- }
gtk_widget_destroy (dialog);
gnome_wp_main_quit (capplet);
break;
}
- }
}
static void gnome_wp_scale_type_changed (GtkOptionMenu * option_menu,
@@ -505,6 +439,8 @@ static void gnome_wp_scale_type_changed
0, pixbuf,
-1);
g_object_unref (pixbuf);
+ gconf_client_set_string (capplet->client, WP_OPTIONS_KEY,
+ item->options, NULL);
}
static void gnome_wp_shade_type_changed (GtkOptionMenu * option_menu,
@@ -550,6 +486,8 @@ static void gnome_wp_shade_type_changed
0, pixbuf,
-1);
g_object_unref (pixbuf);
+ gconf_client_set_string (capplet->client, WP_SHADING_KEY,
+ item->shade_type, NULL);
}
static void gnome_wp_color_changed (GnomeWPCapplet * capplet,
@@ -591,6 +529,13 @@ static void gnome_wp_color_changed (Gnom
item->scolor->green >> 8,
item->scolor->blue >> 8);
+ if (update) {
+ gconf_client_set_string (capplet->client, WP_PCOLOR_KEY,
+ item->pri_color, NULL);
+ gconf_client_set_string (capplet->client, WP_SCOLOR_KEY,
+ item->sec_color, NULL);
+ }
+
gnome_wp_shade_type_changed (NULL, capplet);
}
@@ -654,7 +599,6 @@ static gboolean gnome_wp_load_stuffs (vo
item = g_hash_table_lookup (capplet->wphash, imagepath);
if (item != NULL && strcmp (style, "none") != 0) {
- capplet->old_item = gnome_wp_item_dup (item);
if (item->deleted == TRUE) {
item->deleted = FALSE;
wp_props_load_wallpaper (item->filename, item, capplet);
@@ -687,10 +631,6 @@ static gboolean gnome_wp_load_stuffs (vo
if (!strcmp (style, "none")) {
gnome_wp_capplet_scroll_to_item (capplet, item);
- if (capplet->old_item)
- gnome_wp_item_free (capplet->old_item);
-
- capplet->old_item = gnome_wp_item_dup (item);
}
}
g_free (imagepath);
@@ -700,9 +640,6 @@ static gboolean gnome_wp_load_stuffs (vo
gnome_wp_add_images (capplet, capplet->uri_list);
g_slist_free (capplet->uri_list);
}
-
- if (capplet->old_item == NULL && item != NULL)
- capplet->old_item = gnome_wp_item_dup (item);
return FALSE;
}
Index: capplets/background/gnome-wp-capplet.h
===================================================================
RCS file: /cvs/gnome/gnome-control-center/capplets/background/gnome-wp-capplet.h,v
retrieving revision 1.11
diff -u -p -r1.11 gnome-wp-capplet.h
--- capplets/background/gnome-wp-capplet.h 27 Jan 2006 03:01:58 -0000 1.11
+++ capplets/background/gnome-wp-capplet.h 10 Feb 2006 03:53:49 -0000
@@ -71,12 +71,6 @@ struct _GnomeWPCapplet {
/* File Chooser Dialog */
GtkWidget * filesel;
GtkWidget * image;
-
- /*
- The GnomeWPItem of the wallpaper we were
- already set to on startup
- */
- GnomeWPItem * old_item;
};
typedef enum {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]