Load custom css file

parent 7bf6da08
......@@ -415,6 +415,9 @@ gedit_app_startup (GApplication *application)
const gchar *cache_dir;
gchar *metadata_filename;
#endif
GError *error = NULL;
GFile *css_file;
GtkCssProvider *provider;
G_APPLICATION_CLASS (gedit_app_parent_class)->startup (application);
......@@ -465,7 +468,6 @@ gedit_app_startup (GApplication *application)
{
GtkBuilder *builder;
GAction *action;
GError *error = NULL;
g_action_map_add_action_entries (G_ACTION_MAP (app),
app_entries,
......@@ -557,6 +559,22 @@ gedit_app_startup (GApplication *application)
"<Control><Alt>Page_Down",
"win.next_document", NULL);
/* Load custom css */
error = NULL;
css_file = g_file_new_for_uri ("resource:///org/gnome/gedit/ui/gedit-style.css");
provider = gtk_css_provider_new ();
if (gtk_css_provider_load_from_file (provider, css_file, &error))
{
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
else
{
g_warning ("Could not load css provider: %s", error->message);
g_error_free (error);
}
/*
* We use the default gtksourceview style scheme manager so that plugins
* can obtain it easily without a gedit specific api, but we need to
......
.gedit-titlebar-left:dir(ltr),
.gedit-titlebar-right:dir(rtl) {
border-top-right-radius: 0;
}
.gedit-titlebar-right:dir(ltr),
.gedit-titlebar-left:dir(rtl) {
border-top-left-radius: 0;
}
......@@ -14,5 +14,6 @@
<file preprocess="xml-stripblanks">gedit-view-frame.ui</file>
<file preprocess="xml-stripblanks">gedit-highlight-mode-dialog.ui</file>
<file preprocess="xml-stripblanks">gedit-window.ui</file>
<file>gedit-style.css</file>
</gresource>
</gresources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment