Replace the Apply/Cancel/OK buttons with a Finish button, using the stock
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
This commit is contained in:
parent
2f430f6b99
commit
4622d5ed51
4 changed files with 123 additions and 135 deletions
|
@ -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
|
||||
|
|
|
@ -47,42 +47,78 @@
|
|||
</widget>
|
||||
</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>
|
||||
|
|
|
@ -278,7 +278,6 @@ static gboolean gnome_wp_props_wp_set (GnomeWPCapplet * capplet) {
|
|||
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 (GnomeWPCapplet * capplet) {
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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 ();
|
||||
|
||||
if (!strcmp (item->filename, "(none)")) {
|
||||
gconf_change_set_set_string (cs, WP_OPTIONS_KEY, "none");
|
||||
} 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);
|
||||
|
||||
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;
|
||||
|
||||
return retval;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void gnome_wp_props_wp_selected (GtkTreeSelection * selection,
|
||||
|
@ -389,6 +347,8 @@ static void gnome_wp_props_wp_selected (GtkTreeSelection * selection,
|
|||
} 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 * key, GnomeWPItem * item,
|
|||
}
|
||||
|
||||
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,34 +387,10 @@ static void wallpaper_properties_clicked (GtkWidget * dialog,
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -505,6 +439,8 @@ static void gnome_wp_scale_type_changed (GtkOptionMenu * option_menu,
|
|||
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 (GtkOptionMenu * option_menu,
|
|||
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 (GnomeWPCapplet * capplet,
|
|||
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 (void * data) {
|
|||
|
||||
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 (void * data) {
|
|||
|
||||
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);
|
||||
|
@ -701,9 +641,6 @@ static gboolean gnome_wp_load_stuffs (void * data) {
|
|||
g_slist_free (capplet->uri_list);
|
||||
}
|
||||
|
||||
if (capplet->old_item == NULL && item != NULL)
|
||||
capplet->old_item = gnome_wp_item_dup (item);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue