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

Function ghb_update_widget

gtk/src/settings.c:293–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291}
292
293void
294ghb_update_widget(GtkWidget *widget, const GhbValue *value)
295{
296 GType type;
297 gchar *str, *tmp;
298 gint ival;
299 gdouble dval;
300
301 const char *name = ghb_get_setting_key(widget);
302 type = ghb_value_type(value);
303 if (type == GHB_DICT)
304 return;
305 if (value == NULL) return;
306 str = tmp = ghb_value_get_string_xform(value);
307 ival = ghb_value_get_int(value);
308 dval = ghb_value_get_double(value);
309 type = G_OBJECT_TYPE(widget);
310
311 if (str == NULL)
312 str = g_strdup("");
313
314 if (type == GTK_TYPE_ENTRY)
315 {
316 gtk_editable_set_text(GTK_EDITABLE(widget), str);
317 }
318 else if (type == GTK_TYPE_CHECK_BUTTON)
319 {
320 gtk_check_button_set_active(GTK_CHECK_BUTTON(widget), ival);
321 }
322 else if (type == GTK_TYPE_TOGGLE_BUTTON)
323 {
324 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), ival);
325 }
326 else if (type == GTK_TYPE_COMBO_BOX)
327 {
328 GtkTreeModel *store;
329 GtkTreeIter iter;
330 gchar *shortOpt;
331 gdouble ivalue;
332 gboolean foundit = FALSE;
333
334 store = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
335 if (gtk_tree_model_get_iter_first (store, &iter))
336 {
337 do
338 {
339 gtk_tree_model_get(store, &iter, 2, &shortOpt, -1);
340 if (strcasecmp(shortOpt, str) == 0)
341 {
342 gtk_combo_box_set_active_iter (
343 GTK_COMBO_BOX(widget), &iter);
344 g_free(shortOpt);
345 foundit = TRUE;
346 break;
347 }
348 g_free(shortOpt);
349 } while (gtk_tree_model_iter_next (store, &iter));
350 }

Callers 9

vcodec_changed_cbFunction · 0.85
ghb_ui_updateFunction · 0.85
ghb_ui_settings_updateFunction · 0.85
audio_def_update_widgetsFunction · 0.85
audio_def_drc_changed_cbFunction · 0.85

Calls 3

ghb_get_setting_keyFunction · 0.85

Tested by

no test coverage detected