OSDN Git Service

forgot to checkin the new icon for picutre settings
[handbrake-jp/handbrake-jp-git.git] / gtk / src / settings.c
index e3bec95..20c1416 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,13 @@ 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));
 }
 
 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));
 }
@@ -290,8 +290,18 @@ ghb_widget_value(GtkWidget *widget)
        else if (type == GTK_TYPE_HSCALE)
        {
                gdouble dval;
+               gint digits;
+
+               digits = gtk_scale_get_digits(GTK_SCALE(widget));
                dval = gtk_range_get_value(GTK_RANGE(widget));
-               value = ghb_double_value_new(dval);
+               if (digits)
+               {
+                       value = ghb_double_value_new(dval);
+               }
+               else
+               {
+                       value = ghb_int_value_new(dval);
+               }
        }
        else if (type == GTK_TYPE_TEXT_VIEW)
        {
@@ -311,6 +321,12 @@ ghb_widget_value(GtkWidget *widget)
                str = gtk_label_get_text (GTK_LABEL(widget));
                value = ghb_string_value_new(str);
        }
+       else if (type == GTK_TYPE_FILE_CHOOSER_BUTTON)
+       {
+               const gchar *str;
+               str = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(widget));
+               value = ghb_string_value_new(str);
+       }
        else
        {
                g_debug("Attempt to set unknown widget type: %s\n", name);
@@ -559,6 +575,20 @@ update_widget(GtkWidget *widget, const GValue *value)
        {
                gtk_label_set_text (GTK_LABEL(widget), str);
        }
+       else if (type == GTK_TYPE_FILE_CHOOSER_BUTTON)
+       {
+               GtkFileChooserAction act;
+               act = gtk_file_chooser_get_action(GTK_FILE_CHOOSER(widget));
+               if (act == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
+                       act == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+               {
+                       gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(widget), str);
+               }
+               else
+               {
+                       gtk_file_chooser_set_filename (GTK_FILE_CHOOSER(widget), str);
+               }
+       }
        else
        {
                g_debug("Attempt to set unknown widget type");
@@ -587,76 +617,3 @@ ghb_ui_update(signal_user_data_t *ud, const gchar *name, const GValue *value)
        return 0;
 }
 
-gint
-ghb_pref_acount(GValue *settings)
-{
-       GValue *acodec;
-       acodec = ghb_settings_get_value(settings, "pref_audio_codec");
-       return ghb_array_len(acodec);
-}
-
-gint
-ghb_pref_acodec(GValue *settings, gint index)
-{
-       GValue *acodec;
-       gint count;
-
-       acodec = ghb_settings_get_value(settings, "pref_audio_codec");
-       count = ghb_array_len(acodec);
-       if (index >= count)
-               return 0;
-       return ghb_value_int(ghb_array_get_nth(acodec, index));
-}
-
-gint
-ghb_pref_bitrate(GValue *settings, gint index)
-{
-       GValue *bitrate;
-       gint count;
-
-       bitrate = ghb_settings_get_value(settings, "pref_audio_bitrate");
-       count = ghb_array_len(bitrate);
-       if (index >= count)
-               return 0;
-       return ghb_value_int(ghb_array_get_nth(bitrate, index));
-}
-
-gint
-ghb_pref_rate(GValue *settings, gint index)
-{
-       GValue *rate;
-       gint count;
-
-       rate = ghb_settings_get_value(settings, "pref_audio_rate");
-       count = ghb_array_len(rate);
-       if (index >= count)
-               return 0;
-       return ghb_value_int(ghb_array_get_nth(rate, index));
-}
-
-gint
-ghb_pref_mix(GValue *settings, gint index)
-{
-       GValue *mix;
-       gint count;
-
-       mix = ghb_settings_get_value(settings, "pref_audio_mix");
-       count = ghb_array_len(mix);
-       if (index >= count)
-               return 0;
-       return ghb_value_int(ghb_array_get_nth(mix, index));
-}
-
-gdouble
-ghb_pref_drc(GValue *settings, gint index)
-{
-       GValue *drc;
-       gint count;
-
-       drc = ghb_settings_get_value(settings, "pref_audio_drc");
-       count = ghb_array_len(drc);
-       if (index >= count)
-               return 0;
-       return ghb_value_double(ghb_array_get_nth(drc, index));
-}
-