MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / ghb_widget_value

Function ghb_widget_value

gtk/src/settings.c:78–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78GhbValue*
79ghb_widget_value(GtkWidget *widget)
80{
81 GhbValue *value = NULL;
82 const gchar *name;
83 GType type;
84
85 if (widget == NULL)
86 {
87 g_debug("NULL widget");
88 return NULL;
89 }
90
91 type = G_OBJECT_TYPE(widget);
92 name = ghb_get_setting_key(widget);
93 if (type == GTK_TYPE_ENTRY)
94 {
95 const gchar *str = gtk_editable_get_text(GTK_EDITABLE(widget));
96 value = ghb_string_value_new(str);
97 }
98 else if (type == GTK_TYPE_CHECK_BUTTON)
99 {
100 gboolean bval;
101 bval = gtk_check_button_get_active(GTK_CHECK_BUTTON(widget));
102 value = ghb_bool_value_new(bval);
103 }
104 else if (type == GTK_TYPE_TOGGLE_BUTTON)
105 {
106 gboolean bval;
107 bval = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
108 value = ghb_bool_value_new(bval);
109 }
110 else if (type == GTK_TYPE_COMBO_BOX)
111 {
112 GtkTreeModel *store;
113 GtkTreeIter iter;
114 gchar *shortOpt;
115
116 store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
117 if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter))
118 {
119 gtk_tree_model_get(store, &iter, 2, &shortOpt, -1);
120 value = ghb_string_value_new(shortOpt);
121 g_free(shortOpt);
122 }
123 else if (gtk_combo_box_get_has_entry(GTK_COMBO_BOX(widget)))
124 {
125 const char *str;
126 GtkWidget *entry = gtk_combo_box_get_child(GTK_COMBO_BOX(widget));
127 str = gtk_editable_get_text(GTK_EDITABLE(entry));
128
129 if (str == NULL) str = "";
130 value = ghb_string_value_new(str);
131 }
132 else
133 {
134 value = ghb_string_value_new("");
135 }

Callers 15

subtitle_name_changed_cbFunction · 0.85
import_offset_changed_cbFunction · 0.85
when_complete_changed_cbFunction · 0.85
ghb_widget_stringFunction · 0.85
ghb_widget_doubleFunction · 0.85
ghb_widget_int64Function · 0.85
ghb_widget_intFunction · 0.85
ghb_widget_booleanFunction · 0.85

Calls 3

ghb_get_setting_keyFunction · 0.85

Tested by

no test coverage detected