OSDN Git Service

LinGui: fix problem with writing null values to presets file
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 11 Feb 2009 00:34:03 +0000 (00:34 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 11 Feb 2009 00:34:03 +0000 (00:34 +0000)
git-svn-id: svn://localhost/HandBrake/trunk@2137 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/src/presets.c
gtk/src/values.c
gtk/src/values.h

index 5cbab83..dd186f8 100644 (file)
@@ -139,37 +139,6 @@ ghb_preset_path_string(const GValue *path)
        return str;
 }
 
-static void
-debug_show_type(GType tp)
-{
-       const gchar *str = "unknown";
-       if (tp == G_TYPE_STRING)
-       {
-               str ="string";
-       }
-       else if (tp == G_TYPE_INT)
-       {
-               str ="int";
-       }
-       else if (tp == G_TYPE_INT64)
-       {
-               str ="int64";
-       }
-       else if (tp == G_TYPE_BOOLEAN)
-       {
-               str ="bool";
-       }
-       else if (tp == ghb_array_get_type())
-       {
-               str ="array";
-       }
-       else if (tp == ghb_dict_get_type())
-       {
-               str ="dict";
-       }
-       g_message("Type: %s", str);
-}
-
 void
 dump_preset_path(const gchar *msg, const GValue *path)
 {
@@ -1941,29 +1910,21 @@ export_value_xlat(GValue *dict)
        gval = export_value_xlat2(detel_xlat, lin_val, G_TYPE_INT);
        if (gval)
                ghb_dict_insert(dict, g_strdup(key), gval);
-       else
-               ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(lin_val));
        key = "PictureDecomb";
        lin_val = ghb_dict_lookup(dict, key);
        gval = export_value_xlat2(decomb_xlat, lin_val, G_TYPE_INT);
        if (gval)
                ghb_dict_insert(dict, g_strdup(key), gval);
-       else
-               ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(lin_val));
        key = "PictureDeinterlace";
        lin_val = ghb_dict_lookup(dict, key);
        gval = export_value_xlat2(deint_xlat, lin_val, G_TYPE_INT);
        if (gval)
                ghb_dict_insert(dict, g_strdup(key), gval);
-       else
-               ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(lin_val));
        key = "PictureDenoise";
        lin_val = ghb_dict_lookup(dict, key);
        gval = export_value_xlat2(denoise_xlat, lin_val, G_TYPE_INT);
        if (gval)
                ghb_dict_insert(dict, g_strdup(key), gval);
-       else
-               ghb_dict_insert(dict, g_strdup(key), ghb_value_dup(lin_val));
        key = "Subtitles";
        lin_val = ghb_dict_lookup(dict, key);
        gval = export_subtitle_xlat2(lin_val);
index ad723ee..a888d0a 100644 (file)
@@ -77,7 +77,43 @@ debug_show_type(GType tp)
        {
                str ="dict";
        }
-       g_debug("%s", str);
+       g_debug("Type %s", str);
+}
+
+void
+debug_show_value(GValue *gval)
+{
+       GType tp;
+
+       tp = G_VALUE_TYPE(gval);
+       if (tp == G_TYPE_STRING)
+       {
+               g_message("Type %s value %s", "string", g_value_get_string(gval));
+       }
+       else if (tp == G_TYPE_INT)
+       {
+               g_message("Type %s value %d", "int", g_value_get_int(gval));
+       }
+       else if (tp == G_TYPE_INT64)
+       {
+               g_message("Type %s value %ld", "int64", g_value_get_int64(gval));
+       }
+       else if (tp == G_TYPE_DOUBLE)
+       {
+               g_message("Type %s value %f", "double", g_value_get_double(gval));
+       }
+       else if (tp == G_TYPE_BOOLEAN)
+       {
+               g_message("Type %s value %d", "boolean", g_value_get_boolean(gval));
+       }
+       else if (tp == ghb_array_get_type())
+       {
+               g_message("Type %s", "boolean");
+       }
+       else if (tp == ghb_dict_get_type())
+       {
+               g_message("Type %s", "dict");
+       }
 }
 
 gint
index ecf676c..d28727f 100644 (file)
@@ -71,5 +71,7 @@ GValue* ghb_dict_lookup(const GValue *gval, const gchar *key);
 gboolean ghb_dict_remove(GValue *gval, const gchar *key);
 void ghb_register_transforms(void);
 
+void debug_show_value(GValue *gval);
+void debug_show_type(GType tp);
 
 #endif // _GHB_VALUES_H_