OSDN Git Service

LinGui: merge gtk mingw cross compiling support
[handbrake-jp/handbrake-jp-git.git] / gtk / src / settings.c
index 03d65c7..c665770 100644 (file)
@@ -98,7 +98,7 @@ ghb_settings_set_boolean(GValue *settings, const gchar *key, gboolean bval)
 }
 
 GValue*
-ghb_settings_get_value(GValue *settings, const gchar *key)
+ghb_settings_get_value(const GValue *settings, const gchar *key)
 {
        GValue *value;
        value = ghb_dict_lookup(settings, key);
@@ -108,7 +108,7 @@ ghb_settings_get_value(GValue *settings, const gchar *key)
 }
 
 gboolean
-ghb_settings_get_boolean(GValue *settings, const gchar *key)
+ghb_settings_get_boolean(const GValue *settings, const gchar *key)
 {
        const GValue* value;
        value = ghb_settings_get_value(settings, key);
@@ -117,7 +117,7 @@ ghb_settings_get_boolean(GValue *settings, const gchar *key)
 }
 
 gint64
-ghb_settings_get_int64(GValue *settings, const gchar *key)
+ghb_settings_get_int64(const GValue *settings, const gchar *key)
 {
        const GValue* value;
        value = ghb_settings_get_value(settings, key);
@@ -126,7 +126,7 @@ ghb_settings_get_int64(GValue *settings, const gchar *key)
 }
 
 gint
-ghb_settings_get_int(GValue *settings, const gchar *key)
+ghb_settings_get_int(const GValue *settings, const gchar *key)
 {
        const GValue* value;
        value = ghb_settings_get_value(settings, key);
@@ -135,7 +135,7 @@ ghb_settings_get_int(GValue *settings, const gchar *key)
 }
 
 gdouble
-ghb_settings_get_double(GValue *settings, const gchar *key)
+ghb_settings_get_double(const GValue *settings, const gchar *key)
 {
        const GValue* value;
        value = ghb_settings_get_value(settings, key);
@@ -144,7 +144,7 @@ ghb_settings_get_double(GValue *settings, const gchar *key)
 }
 
 gchar*
-ghb_settings_get_string(GValue *settings, const gchar *key)
+ghb_settings_get_string(const GValue *settings, const gchar *key)
 {
        const GValue* value;
        value = ghb_settings_get_value(settings, key);
@@ -153,13 +153,19 @@ ghb_settings_get_string(GValue *settings, const gchar *key)
 }
 
 gint
-ghb_settings_combo_int(GValue *settings, const gchar *key)
+ghb_settings_combo_int(const GValue *settings, const gchar *key)
 {
        return ghb_lookup_combo_int(key, ghb_settings_get_value(settings, key));
 }
 
+gdouble
+ghb_settings_combo_double(const GValue *settings, const gchar *key)
+{
+       return ghb_lookup_combo_double(key, ghb_settings_get_value(settings, key));
+}
+
 const gchar*
-ghb_settings_combo_option(GValue *settings, const gchar *key)
+ghb_settings_combo_option(const GValue *settings, const gchar *key)
 {
        return ghb_lookup_combo_option(key, ghb_settings_get_value(settings, key));
 }
@@ -226,6 +232,13 @@ ghb_widget_value(GtkWidget *widget)
                bval = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
                value = ghb_boolean_value_new(bval);
        }
+       else if (type == GTK_TYPE_TOGGLE_BUTTON)
+       {
+               g_debug("\ttoggle_button");
+               gboolean bval;
+               bval = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+               value = ghb_boolean_value_new(bval);
+       }
        else if (type == GTK_TYPE_TOGGLE_ACTION)
        {
                g_debug("\ttoggle action");
@@ -450,6 +463,11 @@ update_widget(GtkWidget *widget, const GValue *value)
                g_debug("check button");
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), ival);
        }
+       else if (type == GTK_TYPE_TOGGLE_BUTTON)
+       {
+               g_debug("toggle button");
+               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), ival);
+       }
        else if (type == GTK_TYPE_TOGGLE_ACTION)
        {
                g_debug("toggle action");
@@ -465,7 +483,7 @@ update_widget(GtkWidget *widget, const GValue *value)
                GtkTreeModel *store;
                GtkTreeIter iter;
                gchar *shortOpt;
-               gint ivalue;
+               gdouble ivalue;
                gboolean foundit = FALSE;
 
                g_debug("combo (%s)", str);
@@ -491,7 +509,7 @@ update_widget(GtkWidget *widget, const GValue *value)
                        do
                        {
                                gtk_tree_model_get(store, &iter, 3, &ivalue, -1);
-                               if (ivalue == ival)
+                               if ((gint)ivalue == ival || ivalue == dval)
                                {
                                        gtk_combo_box_set_active_iter (
                                                GTK_COMBO_BOX(widget), &iter);
@@ -510,7 +528,7 @@ update_widget(GtkWidget *widget, const GValue *value)
                GtkTreeModel *store;
                GtkTreeIter iter;
                gchar *shortOpt;
-               gint ivalue;
+               gdouble ivalue;
                gboolean foundit = FALSE;
 
                g_debug("GTK_COMBO_BOX_ENTRY");
@@ -536,7 +554,7 @@ update_widget(GtkWidget *widget, const GValue *value)
                        do
                        {
                                gtk_tree_model_get(store, &iter, 3, &ivalue, -1);
-                               if (ivalue == ival)
+                               if ((gint)ivalue == ival || ivalue == dval)
                                {
                                        gtk_combo_box_set_active_iter (
                                                GTK_COMBO_BOX(widget), &iter);