css: Add support for Adwaita
This commit is contained in:
parent
d86c906848
commit
100428eaf9
|
@ -0,0 +1,17 @@
|
|||
.xed-window .primary-toolbar {
|
||||
border: 0px solid @borders;
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
|
||||
.xed-statusbar {
|
||||
border: 0px solid @borders;
|
||||
border-top-width: 1px;
|
||||
}
|
||||
|
||||
.xed-searchbar {
|
||||
box-shadow: inset 0 1px @borders;
|
||||
}
|
||||
|
||||
.xed-statusbar button {
|
||||
padding: 0 4px;
|
||||
}
|
|
@ -9,5 +9,6 @@
|
|||
<file preprocess="xml-stripblanks">ui/xed-shortcuts.ui</file>
|
||||
<file preprocess="xml-stripblanks">ui/xed-view-frame.ui</file>
|
||||
<file>css/xed-style.css</file>
|
||||
<file>css/xed.adwaita.css</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
|
|
@ -223,6 +223,54 @@ set_initial_theme_style (XedApp *app)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
theme_changed (GtkSettings *settings,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
static GtkCssProvider *provider;
|
||||
gchar *theme;
|
||||
GdkScreen *screen;
|
||||
|
||||
g_object_get (settings, "gtk-theme-name", &theme, NULL);
|
||||
screen = gdk_screen_get_default ();
|
||||
|
||||
if (g_str_equal (theme, "Adwaita"))
|
||||
{
|
||||
if (provider == NULL)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
file = g_file_new_for_uri ("resource:///org/x/editor/css/xed.adwaita.css");
|
||||
gtk_css_provider_load_from_file (provider, file, NULL);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
gtk_style_context_add_provider_for_screen (screen,
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
}
|
||||
else if (provider != NULL)
|
||||
{
|
||||
gtk_style_context_remove_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider));
|
||||
g_clear_object (&provider);
|
||||
}
|
||||
|
||||
g_free (theme);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_theme_extensions (void)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
|
||||
settings = gtk_settings_get_default ();
|
||||
g_signal_connect (settings, "notify::gtk-theme-name",
|
||||
G_CALLBACK (theme_changed), NULL);
|
||||
theme_changed (settings, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_app_startup (GApplication *application)
|
||||
{
|
||||
|
@ -251,6 +299,8 @@ xed_app_startup (GApplication *application)
|
|||
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), icon_dir);
|
||||
g_free (icon_dir);
|
||||
|
||||
setup_theme_extensions ();
|
||||
|
||||
#ifndef ENABLE_GVFS_METADATA
|
||||
/* Setup metadata-manager */
|
||||
cache_dir = xed_dirs_get_user_cache_dir ();
|
||||
|
|
Loading…
Reference in New Issue