Commit b335ac66 authored by Guido Gunther's avatar Guido Gunther Committed by Zander Brown

shell: Simplify css loading

gtk_css_provider_load_from_resource is simpler and prints
enough error information even without connecting to "parsing-error":

  (phosh:157249): Gtk-WARNING **: 17:18:36.290: Theme parsing error: <broken file>:1:0: Failed to import: The resource at “/resource:/sm/puri/phosh/style.cs” does not exist

Prompted by calls!235
Signed-off-by: Guido Gunther's avatarGuido Günther <>
parent e56f79bd
......@@ -254,22 +254,11 @@ panels_dispose (PhoshShell *self)
static void
css_setup (PhoshShell *self)
GtkCssProvider *provider;
GFile *file;
GError *error = NULL;
g_autoptr (GtkCssProvider) provider = gtk_css_provider_new ();
provider = gtk_css_provider_new ();
file = g_file_new_for_uri ("resource:///sm/puri/phosh/style.css");
if (!gtk_css_provider_load_from_file (provider, file, &error)) {
g_warning ("Failed to load CSS file: %s", error->message);
g_clear_error (&error);
g_object_unref (file);
gtk_css_provider_load_from_resource (provider, "/sm/puri/phosh/style.css");
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider), 600);
g_object_unref (file);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment