[gthumb] Use a combobox to set the zoom quality



commit 2a555e7a31ea446791eff485c23bbdbe886f8230
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Thu Mar 4 21:50:11 2010 +0100

    Use a combobox to set the zoom quality
    
    The ui looks cleaner to me this way.

 .../data/ui/image-viewer-preferences.ui            |  141 ++++++++------------
 extensions/image_viewer/preferences.c              |   32 +----
 2 files changed, 61 insertions(+), 112 deletions(-)
---
diff --git a/extensions/image_viewer/data/ui/image-viewer-preferences.ui b/extensions/image_viewer/data/ui/image-viewer-preferences.ui
index cc6a880..4e103af 100644
--- a/extensions/image_viewer/data/ui/image-viewer-preferences.ui
+++ b/extensions/image_viewer/data/ui/image-viewer-preferences.ui
@@ -88,18 +88,18 @@
       </packing>
     </child>
     <child>
-      <object class="GtkVBox" id="vbox59">
+      <object class="GtkVBox" id="vbox3">
         <property name="visible">True</property>
         <property name="orientation">vertical</property>
         <property name="spacing">6</property>
         <child>
-          <object class="GtkHBox" id="hbox116">
+          <object class="GtkHBox" id="hbox3">
             <property name="visible">True</property>
             <property name="spacing">5</property>
             <child>
-              <object class="GtkLabel" id="label185">
+              <object class="GtkLabel" id="label2">
                 <property name="visible">True</property>
-                <property name="label" translatable="yes">Zoom quality</property>
+                <property name="label" translatable="yes">Other</property>
                 <property name="justify">center</property>
                 <attributes>
                   <attribute name="weight" value="bold"/>
@@ -118,119 +118,72 @@
           </packing>
         </child>
         <child>
-          <object class="GtkAlignment" id="alignment2">
+          <object class="GtkAlignment" id="alignment4">
             <property name="visible">True</property>
             <property name="left_padding">12</property>
             <child>
-              <object class="GtkVBox" id="vbox60">
+              <object class="GtkTable" id="table1">
                 <property name="visible">True</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">6</property>
+                <property name="n_rows">2</property>
+                <property name="n_columns">2</property>
+                <property name="column_spacing">6</property>
+                <property name="row_spacing">6</property>
                 <child>
-                  <object class="GtkRadioButton" id="opt_zoom_quality_high">
-                    <property name="label" translatable="yes">H_igh</property>
+                  <object class="GtkLabel" id="label95">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Transparency _type:</property>
                     <property name="use_underline">True</property>
-                    <property name="draw_indicator">True</property>
-                    <property name="group">opt_zoom_quality_low</property>
+                    <property name="justify">center</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkRadioButton" id="opt_zoom_quality_low">
-                    <property name="label" translatable="yes">Lo_w</property>
+                  <object class="GtkHBox" id="transp_type_box">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                    <property name="active">True</property>
-                    <property name="draw_indicator">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">1</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>
+                    <property name="x_options">GTK_FILL</property>
                   </packing>
                 </child>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkVBox" id="vbox2">
-        <property name="visible">True</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">6</property>
-        <child>
-          <object class="GtkHBox" id="hbox2">
-            <property name="visible">True</property>
-            <property name="spacing">5</property>
-            <child>
-              <object class="GtkLabel" id="label1">
-                <property name="visible">True</property>
-                <property name="label" translatable="yes">Other</property>
-                <property name="justify">center</property>
-                <attributes>
-                  <attribute name="weight" value="bold"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkAlignment" id="alignment3">
-            <property name="visible">True</property>
-            <property name="left_padding">12</property>
-            <child>
-              <object class="GtkHBox" id="hbox1">
-                <property name="visible">True</property>
-                <property name="spacing">12</property>
                 <child>
-                  <object class="GtkLabel" id="label95">
+                  <object class="GtkLabel" id="label1">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Transparency _type:</property>
+                    <property name="label" translatable="yes">_Zoom quality:</property>
                     <property name="use_underline">True</property>
-                    <property name="justify">center</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="position">0</property>
+                    <property name="x_options">GTK_FILL</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkHBox" id="transp_type_box">
+                  <object class="GtkComboBox" id="zoom_quality_combobox">
                     <property name="visible">True</property>
+                    <property name="model">zoom_quality_liststore</property>
+                    <property name="active">0</property>
                     <child>
-                      <placeholder/>
+                      <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                      <attributes>
+                        <attribute name="text">0</attribute>
+                      </attributes>
                     </child>
                   </object>
                   <packing>
-                    <property name="position">1</property>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
                   </packing>
                 </child>
               </object>
@@ -243,8 +196,22 @@
       </object>
       <packing>
         <property name="expand">False</property>
-        <property name="position">2</property>
+        <property name="position">1</property>
       </packing>
     </child>
   </object>
+  <object class="GtkListStore" id="zoom_quality_liststore">
+    <columns>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">High</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Low</col>
+      </row>
+    </data>
+  </object>
 </interface>
diff --git a/extensions/image_viewer/preferences.c b/extensions/image_viewer/preferences.c
index 1d0bbac..6ab230e 100644
--- a/extensions/image_viewer/preferences.c
+++ b/extensions/image_viewer/preferences.c
@@ -44,24 +44,13 @@ browser_data_free (BrowserData *data)
 
 
 static void
-zoom_quality_high_cb (GtkToggleButton *button,
-		      BrowserData     *data)
+zoom_quality_changed_cb (GtkComboBox *combo_box,
+			 BrowserData     *data)
 {
-	if (! gtk_toggle_button_get_active (button))
-		return;
-	eel_gconf_set_enum (PREF_ZOOM_QUALITY, GTH_TYPE_ZOOM_QUALITY, GTH_ZOOM_QUALITY_HIGH);
+	eel_gconf_set_enum (PREF_ZOOM_QUALITY, GTH_TYPE_ZOOM_QUALITY, gtk_combo_box_get_active (combo_box));
 }
 
 
-static void
-zoom_quality_low_cb (GtkToggleButton *button,
-		     BrowserData     *data)
-{
-	if (! gtk_toggle_button_get_active (button))
-		return;
-	eel_gconf_set_enum (PREF_ZOOM_QUALITY, GTH_TYPE_ZOOM_QUALITY, GTH_ZOOM_QUALITY_LOW);
-}
-
 
 static void
 zoom_change_changed_cb (GtkComboBox *combo_box,
@@ -127,18 +116,11 @@ image_viewer__dlg_preferences_construct_cb (GtkWidget  *dialog,
 	gtk_widget_show (data->transp_type_combobox);
 	gtk_container_add (GTK_CONTAINER (_gtk_builder_get_widget (data->builder, "transp_type_box")), data->transp_type_combobox);
 
-	if (eel_gconf_get_enum (PREF_ZOOM_QUALITY, GTH_TYPE_ZOOM_QUALITY, GTH_ZOOM_QUALITY_HIGH) == GTH_ZOOM_QUALITY_HIGH)
-		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (_gtk_builder_get_widget (data->builder, "opt_zoom_quality_high")), TRUE);
-	else
-		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (_gtk_builder_get_widget (data->builder, "opt_zoom_quality_low")), TRUE);
+	gtk_combo_box_set_active (GTK_COMBO_BOX (_gtk_builder_get_widget (data->builder, "zoom_quality_combobox")), eel_gconf_get_enum (PREF_ZOOM_QUALITY, GTH_TYPE_ZOOM_QUALITY, GTH_ZOOM_QUALITY_LOW));
 
-	g_signal_connect (G_OBJECT (_gtk_builder_get_widget (data->builder, "opt_zoom_quality_high")),
-			  "toggled",
-			  G_CALLBACK (zoom_quality_high_cb),
-			  data);
-	g_signal_connect (G_OBJECT (_gtk_builder_get_widget (data->builder, "opt_zoom_quality_low")),
-			  "toggled",
-			  G_CALLBACK (zoom_quality_low_cb),
+	g_signal_connect (_gtk_builder_get_widget (data->builder, "zoom_quality_combobox"),
+			  "changed",
+			  G_CALLBACK (zoom_quality_changed_cb),
 			  data);
 	g_signal_connect (G_OBJECT (data->change_zoom_combobox),
 			  "changed",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]