[gthumb] [resize tool] save and restore the size when using the percentage
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] [resize tool] save and restore the size when using the percentage
- Date: Thu, 24 Jun 2010 12:14:37 +0000 (UTC)
commit d328cf16be5370f4107e298b660f2bf508cb489e
Author: Paolo Bacchilega <paobac src gnome org>
Date: Thu Jun 24 14:07:18 2010 +0200
[resize tool] save and restore the size when using the percentage
.../data/gthumb_resize_options.schemas.in | 24 ++++++++++++++++++++
extensions/file_tools/gth-file-tool-resize.c | 13 ++++++++--
extensions/file_tools/preferences.h | 2 +
3 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/extensions/file_tools/data/gthumb_resize_options.schemas.in b/extensions/file_tools/data/gthumb_resize_options.schemas.in
index d17968a..6446ce0 100644
--- a/extensions/file_tools/data/gthumb_resize_options.schemas.in
+++ b/extensions/file_tools/data/gthumb_resize_options.schemas.in
@@ -14,6 +14,30 @@
</schema>
<schema>
+ <key>/schemas/apps/gthumb/ext/resize/width</key>
+ <applyto>/apps/gthumb/ext/resize/width</applyto>
+ <owner>gthumb</owner>
+ <type>float</type>
+ <default>100.0</default>
+ <locale name="C">
+ <short></short>
+ <long></long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gthumb/ext/resize/height</key>
+ <applyto>/apps/gthumb/ext/resize/height</applyto>
+ <owner>gthumb</owner>
+ <type>float</type>
+ <default>100.0</default>
+ <locale name="C">
+ <short></short>
+ <long></long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/gthumb/ext/resize/aspect_ratio_width</key>
<applyto>/apps/gthumb/ext/resize/aspect_ratio_width</applyto>
<owner>gthumb</owner>
diff --git a/extensions/file_tools/gth-file-tool-resize.c b/extensions/file_tools/gth-file-tool-resize.c
index e9762f1..d5b1117 100644
--- a/extensions/file_tools/gth-file-tool-resize.c
+++ b/extensions/file_tools/gth-file-tool-resize.c
@@ -415,8 +415,8 @@ gth_file_tool_resize_get_options (GthFileTool *base)
else if (self->priv->unit == GTH_UNIT_PERCENTAGE) {
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), 2);
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), 2);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), 100.0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), 100.0);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), eel_gconf_get_float (PREF_RESIZE_WIDTH,100.0));
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), eel_gconf_get_float (PREF_RESIZE_HEIGHT, 100.0));
}
gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("unit_combobox")), self->priv->unit);
@@ -505,9 +505,16 @@ gth_file_tool_resize_destroy_options (GthFileTool *base)
self = (GthFileToolResize *) base;
if (self->priv->builder != NULL) {
+ int unit;
+
/* save the dialog options */
- eel_gconf_set_enum (PREF_RESIZE_UNIT, GTH_TYPE_UNIT, gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("unit_combobox"))));
+ unit = gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("unit_combobox")));
+ eel_gconf_set_enum (PREF_RESIZE_UNIT, GTH_TYPE_UNIT, unit);
+ if (unit == GTH_UNIT_PERCENTAGE) {
+ eel_gconf_set_float (PREF_RESIZE_WIDTH, (float) gtk_spin_button_get_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton"))));
+ eel_gconf_set_float (PREF_RESIZE_HEIGHT, (float) gtk_spin_button_get_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton"))));
+ }
eel_gconf_set_integer (PREF_RESIZE_ASPECT_RATIO_WIDTH, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_w_spinbutton"))));
eel_gconf_set_integer (PREF_RESIZE_ASPECT_RATIO_HEIGHT, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_h_spinbutton"))));
eel_gconf_set_enum (PREF_RESIZE_ASPECT_RATIO, GTH_TYPE_ASPECT_RATIO, gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->ratio_combobox)));
diff --git a/extensions/file_tools/preferences.h b/extensions/file_tools/preferences.h
index 93c3e43..a7f391f 100644
--- a/extensions/file_tools/preferences.h
+++ b/extensions/file_tools/preferences.h
@@ -34,6 +34,8 @@ G_BEGIN_DECLS
#define PREF_CROP_ASPECT_RATIO_HEIGHT "/apps/gthumb/ext/crop/aspect_ratio_height"
#define PREF_RESIZE_UNIT "/apps/gthumb/ext/resize/unit"
+#define PREF_RESIZE_WIDTH "/apps/gthumb/ext/resize/width"
+#define PREF_RESIZE_HEIGHT "/apps/gthumb/ext/resize/height"
#define PREF_RESIZE_ASPECT_RATIO_WIDTH "/apps/gthumb/ext/resize/aspect_ratio_width"
#define PREF_RESIZE_ASPECT_RATIO_HEIGHT "/apps/gthumb/ext/resize/aspect_ratio_height"
#define PREF_RESIZE_ASPECT_RATIO "/apps/gthumb/ext/resize/aspect_ratio"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]