[gthumb] set double digit precision when using percentage in resize tools
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] set double digit precision when using percentage in resize tools
- Date: Thu, 25 Feb 2010 23:23:54 +0000 (UTC)
commit 65148d1ff42fcc8e27bdac9dedc017eb5549cd28
Author: Paolo Bacchilega <paobac src gnome org>
Date: Fri Feb 26 00:22:33 2010 +0100
set double digit precision when using percentage in resize tools
extensions/file_tools/data/ui/resize-options.ui | 6 +++---
extensions/file_tools/gth-file-tool-resize.c | 8 ++++----
extensions/resize_images/data/ui/resize-images.ui | 4 +++-
extensions/resize_images/dlg-resize-images.c | 12 ++++++++++++
4 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/extensions/file_tools/data/ui/resize-options.ui b/extensions/file_tools/data/ui/resize-options.ui
index 155d396..e58312e 100644
--- a/extensions/file_tools/data/ui/resize-options.ui
+++ b/extensions/file_tools/data/ui/resize-options.ui
@@ -121,9 +121,6 @@
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
<object class="GtkComboBox" id="unit_combobox">
<property name="visible">True</property>
<property name="model">unit_liststore</property>
@@ -141,6 +138,9 @@
<property name="x_options">GTK_FILL</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="position">0</property>
diff --git a/extensions/file_tools/gth-file-tool-resize.c b/extensions/file_tools/gth-file-tool-resize.c
index 83420f8..9933ae9 100644
--- a/extensions/file_tools/gth-file-tool-resize.c
+++ b/extensions/file_tools/gth-file-tool-resize.c
@@ -199,8 +199,8 @@ unit_combobox_changed_cb (GtkComboBox *combobox,
if (self->priv->unit == GTH_UNIT_PERCENTAGE) {
double p;
- gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), 1);
- gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), 1);
+ 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);
p = ((double) self->priv->new_width) / self->priv->original_width * 100.0;
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), p);
@@ -267,8 +267,8 @@ gth_file_tool_resize_get_options (GthFileTool *base)
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), self->priv->original_height);
}
else if (self->priv->unit == GTH_UNIT_PERCENTAGE) {
- gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), 1);
- gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), 1);
+ 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);
}
diff --git a/extensions/resize_images/data/ui/resize-images.ui b/extensions/resize_images/data/ui/resize-images.ui
index aaa167a..36a4d65 100644
--- a/extensions/resize_images/data/ui/resize-images.ui
+++ b/extensions/resize_images/data/ui/resize-images.ui
@@ -131,6 +131,7 @@
<object class="GtkSpinButton" id="width_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="width_chars">6</property>
<property name="adjustment">width_adjustment</property>
<property name="climb_rate">1</property>
</object>
@@ -145,6 +146,7 @@
<object class="GtkSpinButton" id="height_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="width_chars">6</property>
<property name="adjustment">height_adjustment</property>
<property name="climb_rate">1</property>
</object>
@@ -253,8 +255,8 @@
<child>
<object class="GtkFileChooserButton" id="destination_filechooserbutton">
<property name="visible">True</property>
- <property name="create_folders">False</property>
<property name="action">select-folder</property>
+ <property name="create_folders">False</property>
<property name="title" translatable="yes">Choose destination folder</property>
</object>
</child>
diff --git a/extensions/resize_images/dlg-resize-images.c b/extensions/resize_images/dlg-resize-images.c
index 53cfa0f..cd761e1 100644
--- a/extensions/resize_images/dlg-resize-images.c
+++ b/extensions/resize_images/dlg-resize-images.c
@@ -170,6 +170,18 @@ ok_clicked_cb (GtkWidget *widget,
static void
update_sensitivity (DialogData *data)
{
+ GthUnit unit;
+
+ unit = units[gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("unit_combobox")))];
+ if (unit == GTH_UNIT_PERCENTAGE) {
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("width_spinbutton")), 2);
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("height_spinbutton")), 2);
+ }
+ else if (unit == GTH_UNIT_PIXELS) {
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("width_spinbutton")), 0);
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("height_spinbutton")), 0);
+ }
+
gtk_widget_set_sensitive (GET_WIDGET ("keep_ratio_checkbutton"), units[gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("unit_combobox")))] != GTH_UNIT_PERCENTAGE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]