]> spindle.queued.net Git - midori/commitdiff
Add Zoom Stepping Value to Preferences
authorChristian Dywan <christian@twotoasts.de>
Sun, 8 Jun 2008 16:42:39 +0000 (18:42 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sun, 8 Jun 2008 16:42:39 +0000 (18:42 +0200)
katze/katze-utils.c
midori/main.c
midori/midori-preferences.c

index 9b958911f553e902e77a9f70cac75008ccb1a31c..1353fa1b42971695092ab6c835ce6171d3c6c59d 100644 (file)
@@ -73,9 +73,19 @@ proxy_entry_focus_out_event_cb (GtkEntry*      entry,
 static gboolean
 proxy_spin_button_changed_cb (GtkSpinButton* button, GObject* object)
 {
-    gint value = gtk_spin_button_get_value_as_int (button);
+    GObjectClass* class = G_OBJECT_GET_CLASS (object);
     const gchar* property = g_object_get_data (G_OBJECT (button), "property");
-    g_object_set (object, property, value, NULL);
+    GParamSpec* pspec = g_object_class_find_property (class, property);
+    if (G_PARAM_SPEC_TYPE (pspec) == G_TYPE_PARAM_INT)
+    {
+        gint value = gtk_spin_button_get_value_as_int (button);
+        g_object_set (object, property, value, NULL);
+    }
+    else
+    {
+        gdouble value = gtk_spin_button_get_value (button);
+        g_object_set (object, property, value, NULL);
+    }
     return FALSE;
 }
 
@@ -213,6 +223,18 @@ katze_property_proxy (gpointer     object,
         g_signal_connect (widget, "focus-out-event",
                           G_CALLBACK (proxy_entry_focus_out_event_cb), object);
     }
+    else if (type == G_TYPE_PARAM_FLOAT)
+    {
+        widget = gtk_spin_button_new_with_range (
+            G_PARAM_SPEC_FLOAT (pspec)->minimum,
+            G_PARAM_SPEC_FLOAT (pspec)->maximum, 1);
+        gtk_spin_button_set_digits (GTK_SPIN_BUTTON (widget), 2);
+        gfloat value;
+        g_object_get (object, property, &value, NULL);
+        gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
+        g_signal_connect (widget, "value-changed",
+                          G_CALLBACK (proxy_spin_button_changed_cb), object);
+    }
     else if (type == G_TYPE_PARAM_INT)
     {
         widget = gtk_spin_button_new_with_range (
index 9907e740181cc6b972c22cb89c5500f715ce028c..f88d0b15a81c054f1383d9fac4881b352a3e4be7 100644 (file)
@@ -125,7 +125,7 @@ settings_new_from_file (const gchar* filename)
         }
         else if (type == G_TYPE_PARAM_FLOAT)
         {
-            gdouble number = sokoke_key_file_get_double_default (key_file,
+            gfloat number = sokoke_key_file_get_double_default (key_file,
                 "settings", property,
                 G_PARAM_SPEC_FLOAT (pspec)->default_value, NULL);
             g_object_set (settings, property, number, NULL);
@@ -198,7 +198,7 @@ settings_save_to_file (MidoriWebSettings* settings,
         }
         else if (type == G_TYPE_PARAM_FLOAT)
         {
-            gdouble number;
+            gfloat number;
             g_object_get (settings, property, &number, NULL);
             g_key_file_set_double (key_file, "settings", property, number);
         }
index b3ddc9e7cd41bbf8f6fe4f3f3a6557bd1c939a49..aa2017a58bc8f50405c3debd52053793722089d3 100644 (file)
@@ -279,7 +279,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
     // Page "Behavior"
     PAGE_NEW (_("Behavior"));
     FRAME_NEW (_("Features"));
-    TABLE_NEW (5, 2);
+    TABLE_NEW (6, 2);
     button = katze_property_proxy (settings, "auto-load-images", NULL);
     INDENTED_ADD (button, 0, 1, 0, 1);
     button = katze_property_proxy (settings, "auto-shrink-images", NULL);
@@ -304,10 +304,28 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
                       G_CALLBACK (clear_button_clicked_cb), entry);
     gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 4);
     FILLED_ADD (hbox, 1, 2, 3, 4);
+    if (g_object_class_find_property (G_OBJECT_GET_CLASS (settings), "zoom-step"))
+    {
+        label = katze_property_label (settings, "zoom-step");
+        INDENTED_ADD (label, 0, 1, 4, 5);
+        hbox = gtk_hbox_new (FALSE, 4);
+        entry = katze_property_proxy (settings, "zoom-step", NULL);
+        gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
+        FILLED_ADD (hbox, 1, 2, 4, 5);
+    }
+    else
+    {
+        label = gtk_label_new ("Zoom Stepping Value");
+        INDENTED_ADD (label, 0, 1, 4, 5);
+        hbox = gtk_hbox_new (FALSE, 4);
+        entry = gtk_label_new ("Not available in this WebKit version");
+        gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
+        FILLED_ADD (hbox, 1, 2, 4, 5);
+    }
     label = katze_property_label (settings, "location-entry-search");
-    INDENTED_ADD (label, 0, 1, 4, 5);
+    INDENTED_ADD (label, 0, 1, 5, 6);
     entry = katze_property_proxy (settings, "location-entry-search", NULL);
-    FILLED_ADD (entry, 1, 2, 4, 5);
+    FILLED_ADD (entry, 1, 2, 5, 6);
 
     // Page "Interface"
     PAGE_NEW (_("Interface"));