- Added option to save current background when saving a custom theme.

2006-04-28  Thomas Wood  <thos@gnome.org>

	* gnome-theme-save.c: (write_theme_to_disk), (save_theme_to_disk),
	(save_dialog_response):
	* theme-properties.glade:

	- Added option to save current background when saving a custom theme.
	Fixes bug 330302 - Saved themes should remember wallpaper.
	- Also implements some of the UI changes for the save dialog, suggested
	in bug 100622
This commit is contained in:
Thomas Wood 2006-04-28 19:03:07 +00:00 committed by Thomas Wood
parent 71339b526e
commit 7bbf1f9953
3 changed files with 159 additions and 175 deletions

View file

@ -1,3 +1,14 @@
2006-04-28 Thomas Wood <thos@gnome.org>
* gnome-theme-save.c: (write_theme_to_disk), (save_theme_to_disk),
(save_dialog_response):
* theme-properties.glade:
- Added option to save current background when saving a custom theme.
Fixes bug 330302 - Saved themes should remember wallpaper.
- Also implements some of the UI changes for the save dialog, suggested
in bug 100622
2006-04-27 Thomas Wood <thos@gnome.org>
* gnome-theme-save.c: (str_remove_slash),

View file

@ -3,6 +3,7 @@
#include "gnome-theme-manager.h"
#include "capplet-util.h"
#include <libgnomevfs/gnome-vfs-ops.h>
#include <gconf/gconf-client.h>
#include "gnome-theme-save-data.c"
@ -163,6 +164,7 @@ static gboolean
write_theme_to_disk (GnomeThemeMetaInfo *meta_theme_info,
const gchar *theme_name,
const gchar *theme_description,
gboolean save_background,
GError **error)
{
gchar *dir, *theme_name_dir;
@ -170,7 +172,8 @@ write_theme_to_disk (GnomeThemeMetaInfo *meta_theme_info,
GnomeVFSURI *target_uri;
GnomeVFSHandle *handle = NULL;
GnomeVFSFileSize bytes_written;
gchar *str;
gchar *str, *current_background;
GConfClient *client;
theme_name_dir = str_remove_slash (theme_name);
dir = g_build_filename (g_get_home_dir (), ".themes", theme_name_dir, "index.theme~", NULL);
@ -201,6 +204,19 @@ write_theme_to_disk (GnomeThemeMetaInfo *meta_theme_info,
gnome_vfs_write (handle, str, strlen (str), &bytes_written);
g_free (str);
if (save_background)
{
client = gconf_client_get_default ();
current_background = gconf_client_get_string (client, BACKGROUND_KEY, NULL);
str = g_strdup_printf ("BackgroundImage=%s\n", current_background);
gnome_vfs_write (handle, str, strlen (str), &bytes_written);
g_object_unref (client);
g_free (current_background);
g_free (str);
}
gnome_vfs_close (handle);
@ -215,6 +231,7 @@ static gboolean
save_theme_to_disk (GnomeThemeMetaInfo *meta_theme_info,
const gchar *theme_name,
const gchar *theme_description,
gboolean save_background,
GError **error)
{
if (! check_theme_name (theme_name, error))
@ -223,7 +240,7 @@ save_theme_to_disk (GnomeThemeMetaInfo *meta_theme_info,
if (! setup_directory_structure (theme_name, error))
return FALSE;
if (! write_theme_to_disk (meta_theme_info, theme_name, theme_description, error))
if (! write_theme_to_disk (meta_theme_info, theme_name, theme_description, save_background, error))
return FALSE;
return TRUE;
@ -248,6 +265,7 @@ save_dialog_response (GtkWidget *save_dialog,
GtkTextIter start_iter;
GtkTextIter end_iter;
gchar *buffer_text;
gboolean save_background;
dialog = gnome_theme_manager_get_theme_dialog ();
entry = WID ("save_dialog_entry");
@ -261,7 +279,8 @@ save_dialog_response (GtkWidget *save_dialog,
theme_description = escape_string_and_dup (buffer_text);
g_free (buffer_text);
meta_theme_info = (GnomeThemeMetaInfo *) g_object_get_data (G_OBJECT (save_dialog), "meta-theme-info");
if (! save_theme_to_disk (meta_theme_info, theme_name, theme_description, &error))
save_background = gtk_toggle_button_get_active (/*GTK_TOGGLE_BUTTON*/ (WID ("save_background_checkbutton")));
if (! save_theme_to_disk (meta_theme_info, theme_name, theme_description, save_background, &error))
{
goto out;
}

View file

@ -1549,7 +1549,7 @@
</widget>
<widget class="GtkDialog" id="save_dialog">
<property name="border_width">5</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Save Theme</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
@ -1611,196 +1611,150 @@
</child>
<child>
<widget class="GtkHBox" id="hbox13">
<property name="border_width">5</property>
<widget class="GtkTable" id="table2">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkImage" id="image5">
<widget class="GtkEntry" id="save_dialog_entry">
<property name="visible">True</property>
<property name="stock">gtk-dialog-question</property>
<property name="icon_size">6</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox15">
<widget class="GtkLabel" id="label39">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<property name="label" translatable="yes">_Name:</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</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">save_dialog_entry</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="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<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="GtkLabel" id="label38">
<widget class="GtkTextView" id="save_dialog_textview">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;span size=&quot;larger&quot; weight=&quot;bold&quot;&gt;Save Theme to Disk&lt;/span&gt;</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>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="overwrite">False</property>
<property name="accepts_tab">False</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_WORD</property>
<property name="cursor_visible">True</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table2">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkEntry" id="save_dialog_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label39">
<property name="visible">True</property>
<property name="label" translatable="yes">_Theme name:</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</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">save_dialog_entry</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="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<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="GtkTextView" id="save_dialog_textview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="overwrite">False</property>
<property name="accepts_tab">False</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_WORD</property>
<property name="cursor_visible">True</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label40">
<property name="visible">True</property>
<property name="label" translatable="yes">Short _description:</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</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">scrolledwindow1</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="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options">fill</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>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label40">
<property name="visible">True</property>
<property name="label" translatable="yes">_Description:</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</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">scrolledwindow1</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="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="save_background_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Save _Background Image</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="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>