application: Add CSS provider on startup
GTK isn't fully initialized on init, so move that to startup.
This commit is contained in:
parent
e42a819723
commit
15a67221a0
1 changed files with 7 additions and 8 deletions
|
@ -216,6 +216,7 @@ cc_application_startup (GApplication *application)
|
|||
{
|
||||
CcApplication *self = CC_APPLICATION (application);
|
||||
const gchar *help_accels[] = { "F1", NULL };
|
||||
g_autoptr(GtkCssProvider) provider = NULL;
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (self),
|
||||
cc_app_actions,
|
||||
|
@ -229,6 +230,12 @@ cc_application_startup (GApplication *application)
|
|||
|
||||
self->model = cc_shell_model_new ();
|
||||
self->window = cc_window_new (GTK_APPLICATION (application), self->model);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (provider, "/org/gnome/ControlCenter/gtk/style.css");
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -276,17 +283,9 @@ cc_application_class_init (CcApplicationClass *klass)
|
|||
static void
|
||||
cc_application_init (CcApplication *self)
|
||||
{
|
||||
g_autoptr(GtkCssProvider) provider = NULL;
|
||||
|
||||
cc_object_storage_initialize ();
|
||||
|
||||
g_application_add_main_option_entries (G_APPLICATION (self), all_options);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (provider, "/org/gnome/ControlCenter/gtk/style.css");
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
}
|
||||
|
||||
GtkApplication *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue