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

Function activity_font_changed_cb

gtk/src/callbacks.c:5183–5214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5181}
5182
5183G_MODULE_EXPORT void
5184activity_font_changed_cb(GtkWidget *widget, gpointer data)
5185{
5186 signal_user_data_t *ud = ghb_ud();
5187
5188 ghb_widget_to_setting(ud->prefs, widget);
5189 const gchar *name = ghb_get_setting_key(widget);
5190 ghb_pref_set(ud->prefs, name);
5191
5192 int size = ghb_dict_get_int(ud->prefs, "ActivityFontSize");
5193 const char *font = ghb_dict_get_string(ud->prefs, "ActivityFontFamily");
5194
5195 const gchar *css_template =
5196 " \n\
5197 .ghb-monospace \n\
5198 { \n\
5199 font-family: %s; \n\
5200 font-size: %dpt; \n\
5201 } \n\
5202 ";
5203 char * css = g_strdup_printf(css_template, font, size);
5204 GtkCssProvider * provider = gtk_css_provider_new();
5205
5206 gtk_css_provider_load_from_data(provider, css, -1);
5207 GtkWidget * win = ghb_builder_widget("hb_window");
5208 GdkDisplay *dd = gtk_widget_get_display(win);
5209 gtk_style_context_add_provider_for_display(dd,
5210 GTK_STYLE_PROVIDER(provider),
5211 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
5212 g_object_unref(provider);
5213 g_free(css);
5214}
5215
5216// Changes the setting for the current session
5217// and also saves it for future sessions

Callers

nothing calls this directly

Calls 7

ghb_udFunction · 0.85
ghb_widget_to_settingFunction · 0.85
ghb_get_setting_keyFunction · 0.85
ghb_pref_setFunction · 0.85
ghb_dict_get_intFunction · 0.85
ghb_dict_get_stringFunction · 0.85
ghb_builder_widgetFunction · 0.85

Tested by

no test coverage detected