diff options
author | jstebbins <[email protected]> | 2015-03-05 20:28:11 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2015-03-05 20:28:11 +0000 |
commit | 61f752e2436c34bbb36d5f50df95bf48b1932b4c (patch) | |
tree | a469546211dbbce716554e465bb8cd9e661c1a3f /gtk/src | |
parent | e008f370034803a0ca3d1389d919f2a145c0d605 (diff) |
LinGui: random clean-ups
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6964 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src')
-rw-r--r-- | gtk/src/audiohandler.c | 14 | ||||
-rw-r--r-- | gtk/src/ghb-3.12.ui | 6 | ||||
-rw-r--r-- | gtk/src/ghb-3.14.ui | 6 | ||||
-rw-r--r-- | gtk/src/ghb.ui | 6 | ||||
-rw-r--r-- | gtk/src/main.c | 4 | ||||
-rw-r--r-- | gtk/src/settings.c | 33 | ||||
-rw-r--r-- | gtk/src/subtitlehandler.c | 16 | ||||
-rw-r--r-- | gtk/src/values.c | 34 |
8 files changed, 53 insertions, 66 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c index 3d164ae82..4fea404aa 100644 --- a/gtk/src/audiohandler.c +++ b/gtk/src/audiohandler.c @@ -740,7 +740,7 @@ audio_get_selected_settings(signal_user_data_t *ud, int *index) GValue *asettings = NULL; const GValue *audio_list; - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list_view")); ts = gtk_tree_view_get_selection (tv); if (gtk_tree_selection_get_selected(ts, &tm, &ti)) { @@ -924,7 +924,7 @@ ghb_audio_list_refresh_selected(signal_user_data_t *ud) const GValue *audio_list; g_debug("ghb_audio_list_refresh_selected ()"); - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list_view")); ts = gtk_tree_view_get_selection (tv); if (gtk_tree_selection_get_selected(ts, &tm, &ti)) { @@ -954,7 +954,7 @@ audio_refresh_list_ui(signal_user_data_t *ud) GtkTreeModel *tm; GtkTreeIter ti; - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list_view")); tm = gtk_tree_view_get_model(tv); tm_count = gtk_tree_model_iter_n_children(tm, NULL); @@ -1312,7 +1312,7 @@ ghb_clear_audio_list_ui(GtkBuilder *builder) GtkTreeSelection *tsel; g_debug("clear_audio_list_ui ()"); - tv = GTK_TREE_VIEW(GHB_WIDGET(builder, "audio_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(builder, "audio_list_view")); ts = GTK_TREE_STORE(gtk_tree_view_get_model(tv)); // Clear tree selection so that updates are not triggered // that cause a recursive attempt to clear the tree selection (crasher) @@ -1332,7 +1332,7 @@ ghb_add_audio_to_ui(signal_user_data_t *ud, const GValue *asettings) if (asettings == NULL) return; - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list_view")); ts = gtk_tree_view_get_selection (tv); tm = gtk_tree_view_get_model(tv); @@ -1513,7 +1513,7 @@ audio_edit_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) GtkTreeSelection *ts; GtkTreeIter ti; - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list_view")); ts = gtk_tree_view_get_selection(tv); tm = gtk_tree_view_get_model(tv); tp = gtk_tree_path_new_from_string (path); @@ -1562,7 +1562,7 @@ audio_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) gint *indices; GValue *audio_list; - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list_view")); ts = gtk_tree_view_get_selection(tv); tm = gtk_tree_view_get_model(tv); tp = gtk_tree_path_new_from_string (path); diff --git a/gtk/src/ghb-3.12.ui b/gtk/src/ghb-3.12.ui index 2f8f6da8d..09a4621fb 100644 --- a/gtk/src/ghb-3.12.ui +++ b/gtk/src/ghb-3.12.ui @@ -624,7 +624,7 @@ libx264 authors: </object> </child> <child> - <object class="GtkMenuItem" id="destination"> + <object class="GtkMenuItem" id="destination_menu_item"> <property name="label" translatable="yes">_Destination</property> <property name="visible">True</property> <property name="can_focus">False</property> @@ -4536,7 +4536,7 @@ This permits DTS-HD passthru to be selected when automatic passthru selection is <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <object class="GtkTreeView" id="audio_list"> + <object class="GtkTreeView" id="audio_list_view"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> @@ -5028,7 +5028,7 @@ Only one subtitle track can be burned! Since conflicts can occur, the first chos <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <object class="GtkTreeView" id="subtitle_list"> + <object class="GtkTreeView" id="subtitle_list_view"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> diff --git a/gtk/src/ghb-3.14.ui b/gtk/src/ghb-3.14.ui index 47275859d..c57021d17 100644 --- a/gtk/src/ghb-3.14.ui +++ b/gtk/src/ghb-3.14.ui @@ -625,7 +625,7 @@ libx264 authors: </object> </child> <child> - <object class="GtkMenuItem" id="destination"> + <object class="GtkMenuItem" id="destination_menu_item"> <property name="label" translatable="yes">_Destination</property> <property name="visible">True</property> <property name="can_focus">False</property> @@ -4537,7 +4537,7 @@ This permits DTS-HD passthru to be selected when automatic passthru selection is <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <object class="GtkTreeView" id="audio_list"> + <object class="GtkTreeView" id="audio_list_view"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> @@ -5032,7 +5032,7 @@ Only one subtitle track can be burned! Since conflicts can occur, the first chos <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <object class="GtkTreeView" id="subtitle_list"> + <object class="GtkTreeView" id="subtitle_list_view"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index 3d3bfcc62..ba28677d6 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -624,7 +624,7 @@ libx264 authors: </object> </child> <child> - <object class="GtkMenuItem" id="destination"> + <object class="GtkMenuItem" id="destination_menu_item"> <property name="label" translatable="yes">_Destination</property> <property name="visible">True</property> <property name="can_focus">False</property> @@ -4536,7 +4536,7 @@ This permits DTS-HD passthru to be selected when automatic passthru selection is <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <object class="GtkTreeView" id="audio_list"> + <object class="GtkTreeView" id="audio_list_view"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> @@ -5028,7 +5028,7 @@ Only one subtitle track can be burned! Since conflicts can occur, the first chos <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <object class="GtkTreeView" id="subtitle_list"> + <object class="GtkTreeView" id="subtitle_list_view"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> diff --git a/gtk/src/main.c b/gtk/src/main.c index 730a95775..92f770015 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -327,7 +327,7 @@ bind_audio_tree_model(signal_user_data_t *ud) GtkTreeSelection *selection; g_debug("bind_audio_tree_model()\n"); - treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list")); + treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list_view")); selection = gtk_tree_view_get_selection(treeview); treestore = gtk_tree_store_new(6, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, @@ -392,7 +392,7 @@ bind_subtitle_tree_model(signal_user_data_t *ud) GtkTreeSelection *selection; g_debug("bind_subtitle_tree_model()\n"); - treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list")); + treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list_view")); selection = gtk_tree_view_get_selection(treeview); treestore = gtk_tree_store_new(6, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, diff --git a/gtk/src/settings.c b/gtk/src/settings.c index 5e7bcee20..2c6a7157c 100644 --- a/gtk/src/settings.c +++ b/gtk/src/settings.c @@ -224,7 +224,6 @@ ghb_widget_value(GtkWidget *widget) type = G_OBJECT_TYPE(widget); name = ghb_get_setting_key(widget); - g_debug("ghb_widget_value widget (%s)\n", name); if (type == GTK_TYPE_ENTRY) { const gchar *str = gtk_entry_get_text(GTK_ENTRY(widget)); @@ -232,7 +231,6 @@ ghb_widget_value(GtkWidget *widget) } else if (type == GTK_TYPE_RADIO_BUTTON) { - g_debug("\tradio_button"); gboolean bval; bval = gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON(widget)); if (bval) @@ -247,35 +245,30 @@ ghb_widget_value(GtkWidget *widget) } else if (type == GTK_TYPE_CHECK_BUTTON) { - g_debug("\tcheck_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_TOOL_BUTTON) { - g_debug("\ttoggle_tool_button"); gboolean bval; bval = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_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_CHECK_MENU_ITEM) { - g_debug("\tcheck_menu_item"); gboolean bval; bval = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); value = ghb_boolean_value_new(bval); } else if (type == GTK_TYPE_COMBO_BOX) { - g_debug("\tcombo_box"); GtkTreeModel *store; GtkTreeIter iter; gchar *shortOpt; @@ -360,7 +353,7 @@ ghb_widget_value(GtkWidget *widget) } else { - g_debug("Attempt to set unknown widget type: %s\n", name); + g_warning("Attempt to set unknown widget type: %s\n", name); g_free(value); value = NULL; } @@ -453,49 +446,46 @@ void ghb_update_widget(GtkWidget *widget, const GValue *value) { GType type; - gchar *str; + gchar *str, *tmp; gint ival; gdouble dval; - g_debug("ghb_update_widget"); + char *name = ghb_get_setting_key(widget); type = G_VALUE_TYPE(value); if (type == ghb_array_get_type() || type == ghb_dict_get_type()) return; if (value == NULL) return; - str = ghb_value_string(value); + str = tmp = ghb_value_string(value); ival = ghb_value_int(value); dval = ghb_value_double(value); type = G_OBJECT_TYPE(widget); + if (str == NULL) + str = ""; + if (type == GTK_TYPE_ENTRY) { - g_debug("entry"); gtk_entry_set_text((GtkEntry*)widget, str); } else if (type == GTK_TYPE_RADIO_BUTTON) { - g_debug("radio button"); if (ival) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), !!ival); } else if (type == GTK_TYPE_CHECK_BUTTON) { - g_debug("check button"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), ival); } else if (type == GTK_TYPE_TOGGLE_TOOL_BUTTON) { - g_debug("toggle button"); gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_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_CHECK_MENU_ITEM) { - g_debug("check menu item"); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), ival); } else if (type == GTK_TYPE_COMBO_BOX) @@ -506,7 +496,6 @@ ghb_update_widget(GtkWidget *widget, const GValue *value) gdouble ivalue; gboolean foundit = FALSE; - g_debug("combo (%s)", str); store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget)); if (gtk_tree_model_get_iter_first (store, &iter)) { @@ -560,22 +549,18 @@ ghb_update_widget(GtkWidget *widget, const GValue *value) } else if (type == GTK_TYPE_SPIN_BUTTON) { - g_debug("spin (%s)", str); gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), dval); } else if (type == GTK_TYPE_SCALE) { - g_debug("hscale"); gtk_range_set_value(GTK_RANGE(widget), dval); } else if (type == GTK_TYPE_SCALE_BUTTON) { - g_debug("scale_button"); gtk_scale_button_set_value(GTK_SCALE_BUTTON(widget), dval); } else if (type == GTK_TYPE_TEXT_VIEW) { - g_debug("textview (%s)", str); GtkTextBuffer *buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(widget)); gtk_text_buffer_set_text (buffer, str, -1); @@ -627,9 +612,9 @@ ghb_update_widget(GtkWidget *widget, const GValue *value) } else { - g_debug("Attempt to set unknown widget type"); + g_warning("Attempt to set unknown widget type %s", name); } - g_free(str); + g_free(tmp); } int diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c index d584474f8..ff7a8ec79 100644 --- a/gtk/src/subtitlehandler.c +++ b/gtk/src/subtitlehandler.c @@ -126,7 +126,7 @@ subtitle_refresh_list_ui_from_settings(signal_user_data_t *ud, GValue *settings) GtkTreeModel *tm; GtkTreeIter ti; - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list_view")); tm = gtk_tree_view_get_model(tv); tm_count = gtk_tree_model_iter_n_children(tm, NULL); @@ -675,7 +675,7 @@ ghb_selected_subtitle_row(signal_user_data_t *ud) gint row = -1; g_debug("ghb_selected_subtitle_row ()"); - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list_view")); ts = gtk_tree_view_get_selection(tv); if (gtk_tree_selection_get_selected(ts, &tm, &iter)) { @@ -702,7 +702,7 @@ subtitle_get_selected_settings(signal_user_data_t *ud, int *index) const GValue *subtitle_list; g_debug("get_selected_settings ()"); - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list_view")); ts = gtk_tree_view_get_selection(tv); if (gtk_tree_selection_get_selected(ts, &tm, &iter)) { @@ -939,7 +939,7 @@ ghb_subtitle_list_refresh_selected(signal_user_data_t *ud) const GValue *subtitle_list; g_debug("subtitle_list_refresh_selected()"); - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list_view")); ts = gtk_tree_view_get_selection(tv); if (gtk_tree_selection_get_selected(ts, &tm, &ti)) { @@ -1058,7 +1058,7 @@ ghb_clear_subtitle_list_ui(GtkBuilder *builder) GtkTreeStore *ts; GtkTreeSelection *tsel; - tv = GTK_TREE_VIEW(GHB_WIDGET(builder, "subtitle_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(builder, "subtitle_list_view")); ts = GTK_TREE_STORE(gtk_tree_view_get_model(tv)); // Clear tree selection so that updates are not triggered // that cause a recursive attempt to clear the tree selection (crasher) @@ -1075,7 +1075,7 @@ add_to_subtitle_list_ui(signal_user_data_t *ud, GValue *subsettings) GtkTreeModel *tm; GtkTreeSelection *ts; - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list_view")); ts = gtk_tree_view_get_selection(tv); tm = gtk_tree_view_get_model(tv); @@ -1598,7 +1598,7 @@ subtitle_edit_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) GtkTreeSelection *ts; GtkTreeIter ti; - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list_view")); ts = gtk_tree_view_get_selection(tv); tm = gtk_tree_view_get_model(tv); tp = gtk_tree_path_new_from_string (path); @@ -1647,7 +1647,7 @@ subtitle_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *u gint *indices; GValue *subtitle_list; - tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list")); + tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list_view")); ts = gtk_tree_view_get_selection(tv); tm = gtk_tree_view_get_model(tv); tp = gtk_tree_path_new_from_string (path); diff --git a/gtk/src/values.c b/gtk/src/values.c index 39f7303d8..966fda8fe 100644 --- a/gtk/src/values.c +++ b/gtk/src/values.c @@ -323,14 +323,7 @@ ghb_string_value(const gchar *str) static GValue gval = {0,}; if (!G_IS_VALUE(&gval)) g_value_init(&gval, G_TYPE_STRING); - if (str == NULL) - { - g_value_set_string(&gval, ""); - } - else - { - g_value_set_string(&gval, str); - } + g_value_set_string(&gval, str); return &gval; } @@ -377,7 +370,6 @@ ghb_boolean_value(gboolean bval) GValue* ghb_string_value_new(const gchar *str) { - if (str == NULL) str = ""; GValue *gval = ghb_value_new(G_TYPE_STRING); g_value_set_string(gval, str); return gval; @@ -739,9 +731,13 @@ xform_string_int(const GValue *sval, GValue *ival) gchar *end; const gchar *str = g_value_get_string(sval); - gint val = g_strtod(str, &end); - if (*end) - val = (guint)(~0)>>1; + gint val = 0; + if (str != NULL) + { + val = g_strtod(str, &end); + if (*end) + val = (guint)(~0)>>1; + } g_value_set_int(ival, val); } @@ -750,9 +746,13 @@ xform_string_int64(const GValue *sval, GValue *ival) { gchar *end; const gchar *str = g_value_get_string(sval); - gint64 val = g_strtod(str, &end); - if (*end) - val = (guint64)(~0L)>>1; + gint64 val = 0; + if (str != NULL) + { + val = g_strtod(str, &end); + if (*end) + val = (guint64)(~0L)>>1; + } g_value_set_int64(ival, val); } @@ -760,7 +760,9 @@ static void xform_string_double(const GValue *sval, GValue *dval) { const gchar *str = g_value_get_string(sval); - double val = g_strtod(str, NULL); + double val = 0.0; + if (str != NULL) + val = g_strtod(str, NULL); g_value_set_double(dval, val); } |