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

Function ghb_application_activate

gtk/src/application.c:717–898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715}
716
717static void
718ghb_application_activate (GApplication *app)
719{
720 GhbApplication *self = GHB_APPLICATION(app);
721 GtkWindow *window = gtk_application_get_active_window(GTK_APPLICATION(app));
722
723 if (window)
724 {
725 gtk_window_present(window);
726 return;
727 }
728
729 signal_user_data_t *ud = self->ud = g_malloc0(sizeof(signal_user_data_t));
730 g_autoptr(GtkCssProvider) provider = gtk_css_provider_new();
731
732 gtk_css_provider_load_from_resource(provider, "/fr/handbrake/ghb/ui/custom.css");
733 color_scheme_set_async(APP_PREFERS_LIGHT);
734
735 GdkDisplay *dd = gdk_display_get_default();
736 gtk_style_context_add_provider_for_display(dd,
737 GTK_STYLE_PROVIDER(provider),
738 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
739 ghb_resource_init();
740 gtk_icon_theme_add_resource_path(gtk_icon_theme_get_for_display(gdk_display_get_default()),
741 "/fr/handbrake/ghb/icons");
742
743 // map application actions (menu callbacks)
744 map_actions(GTK_APPLICATION(app), ud);
745
746 ud->prefs = ghb_dict_new();
747 ud->settings_array = ghb_array_new();
748 ud->settings = ghb_dict_new();
749 ghb_array_append(ud->settings_array, ud->settings);
750
751 // Load preferences before builder is created so language
752 // preference is taken into account when building the UI.
753 // Some preset defaults may depend on preference settings.
754 // First load default values
755 ghb_settings_init(ud->prefs, "Preferences");
756 ghb_settings_init(ud->settings, "Initialization");
757 ghb_settings_init(ud->settings, "OneTimeInitialization");
758 // Load user preferences file
759 ghb_prefs_load(ud);
760 // Store user preferences into ud->prefs
761 ghb_prefs_to_settings(ud->prefs);
762
763 const char *ui_language = ghb_dict_get_string(ud->prefs, "UiLanguage");
764 if (ui_language && ui_language[0])
765 {
766 // Set the LANGUAGE environment variable for gettext.
767 // This accepts short locale codes (e.g. "fr", "de", "pt_BR")
768 // that match the .po filenames in gtk/po/.
769 g_setenv("LANGUAGE", ui_language, TRUE);
770 }
771
772 self->builder = create_builder_or_die(BUILDER_NAME);
773
774 // Initialize D-Bus connections to monitor power settings

Callers 1

ghb_application_openFunction · 0.85

Calls 15

color_scheme_set_asyncFunction · 0.85
ghb_resource_initFunction · 0.85
map_actionsFunction · 0.85
ghb_settings_initFunction · 0.85
ghb_prefs_loadFunction · 0.85
ghb_prefs_to_settingsFunction · 0.85
ghb_dict_get_stringFunction · 0.85
create_builder_or_dieFunction · 0.85
ghb_power_manager_initFunction · 0.85
video_file_drop_initFunction · 0.85
watch_volumesFunction · 0.85

Tested by

no test coverage detected