Skip to content

Commit 45b2541

Browse files
lukefromdcraveit65
authored andcommitted
Theme: consistant theming for applet drag handles in all themes
* applet drag-handle: use a symbolic image for the default drag handle image * Use an .svg image with --gtk-recolor (like a symbolic icon), load it from the same directory as the css file so the css parser can find it, and use the theme fg color on it for good contrast * load a css file to use the recolorable image globally for the panel, not for each applet to ensure only one cssprovider is loaded
1 parent b060d2a commit 45b2541

File tree

6 files changed

+208
-64
lines changed

6 files changed

+208
-64
lines changed

‎data/Makefile.am‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ layout_DATA = \
77
opensuse.layout \
88
ubuntu.layout
99

10+
matepaneldir = $(datadir)/mate-panel
11+
matepanel_DATA = \
12+
mate-panel.css \
13+
panel-grid-symbolic.svg
14+
1015
@INTLTOOL_XML_NOMERGE_RULE@
1116

1217
gsettings_ENUM_NAMESPACE = org.mate.panel

‎data/mate-panel.css‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
MatePanelAppletFrameDBus > MatePanelAppletFrameDBus {
3+
border-style: none;
4+
background-repeat: no-repeat;
5+
background-position: left;
6+
color: @theme_fg_color;
7+
background-image: -gtk-recolor(url("panel-grid-symbolic.svg"));
8+
background-size: 12px 22px;
9+
}
10+

‎data/panel-grid-symbolic.svg‎

Lines changed: 173 additions & 0 deletions
Loading

‎mate-panel/Makefile.am‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ AM_CPPFLAGS = \
1515
-DMATELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
1616
-DBUILDERDIR=\""$(uidir)"\" \
1717
-DPANELDATADIR=\""$(datadir)/mate-panel"\" \
18+
-DDATADIR=\""$(datadir)"\"
1819
-DICONDIR=\""$(datadir)/mate-panel/pixmaps"\" \
1920
$(DISABLE_DEPRECATED_CFLAGS)
2021

‎mate-panel/libmate-panel-applet-private/panel-applet-frame-dbus.c‎

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,6 @@ mate_panel_applet_frame_dbus_change_background (MatePanelAppletFrame *frame,
245245
MatePanelAppletFrameDBus *dbus_frame = MATE_PANEL_APPLET_FRAME_DBUS (frame);
246246
MatePanelAppletFrameDBusPrivate *priv = dbus_frame->priv;
247247
char *bg_str;
248-
gchar *theme_name;
249-
GtkSettings *settings;
250248

251249
bg_str = _mate_panel_applet_frame_get_background_string (
252250
frame, PANEL_WIDGET (gtk_widget_get_parent (GTK_WIDGET (frame))), type);
@@ -264,67 +262,6 @@ mate_panel_applet_frame_dbus_change_background (MatePanelAppletFrame *frame,
264262

265263
g_free (bg_str);
266264
}
267-
GtkCssProvider *provider;
268-
provider = gtk_css_provider_new ();
269-
270-
settings = gtk_settings_get_default();
271-
g_object_get (settings, "gtk-theme-name", &theme_name, NULL);
272-
273-
/*Special case the GNOME high contrast themes*/
274-
if (g_strcmp0 (theme_name, "HighContrast") == 0 ||
275-
g_strcmp0 (theme_name, "HighContrastInverse") == 0){
276-
gtk_css_provider_load_from_data (provider,
277-
"MatePanelAppletFrameDBus > MatePanelAppletFrameDBus { \n"
278-
"border-style: solid; \n"
279-
"border-width: 3px; \n"
280-
"border-color: @theme_bg_color; \n"
281-
"background-repeat: no-repeat; \n"
282-
"background-position: left; \n"
283-
"background-image: linear-gradient(to bottom, \n"
284-
"@theme_fg_color, \n"
285-
"@theme_fg_color 25%, \n"
286-
"@theme_bg_color 28%, \n"
287-
"@theme_bg_color 33%, \n"
288-
"@theme_fg_color 34%, \n"
289-
"@theme_fg_color 65%, \n"
290-
"@theme_bg_color 66%, \n"
291-
"@theme_bg_color 72%, \n"
292-
"@theme_fg_color 75%, \n"
293-
"@theme_fg_color); \n"
294-
"}",
295-
-1, NULL);
296-
}
297-
else{
298-
gtk_css_provider_load_from_data (provider,
299-
"MatePanelAppletFrameDBus > MatePanelAppletFrameDBus { \n"
300-
"border-style: solid; \n"
301-
"border-width: 3px; \n"
302-
"border-color: transparent; \n"
303-
"background-repeat: no-repeat; \n"
304-
"background-position: left; \n"
305-
"background-image: linear-gradient(to bottom, \n"
306-
"transparent, \n"
307-
"transparent 20%, \n"
308-
"alpha (#999999, 0.6) 21%, \n"
309-
"alpha (#999999, 0.6) 29%, \n"
310-
"transparent 30%, \n"
311-
"transparent 45%, \n"
312-
"alpha (#999999, 0.6) 46%, \n"
313-
"alpha (#999999, 0.6) 54%, \n"
314-
"transparent 55%, \n"
315-
"transparent 70%, \n"
316-
"alpha (#999999, 0.6) 71%, \n"
317-
"alpha (#999999, 0.6) 79%, \n"
318-
"transparent 80%, \n"
319-
"transparent); \n"
320-
"}",
321-
-1, NULL);
322-
}
323-
gtk_style_context_add_provider (gtk_widget_get_style_context(GTK_WIDGET(frame)),
324-
GTK_STYLE_PROVIDER (provider),
325-
GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);
326-
g_object_unref (provider);
327-
g_free (theme_name);
328265
}
329266

330267
static void

‎mate-panel/main.c‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ main (int argc, char **argv)
6060
{
6161
char *desktopfile;
6262
GOptionContext *context;
63-
GError *error;
63+
GError *error, *error2;
64+
GtkCssProvider *provider;
6465

6566
bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
6667
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -166,6 +167,23 @@ main (int argc, char **argv)
166167
* connecting to the session manager */
167168
panel_session_init ();
168169

170+
/*Load a css file from a path so the drag handle image can be loaded*/
171+
error2 = NULL;
172+
provider = gtk_css_provider_new ();
173+
gtk_css_provider_load_from_path (provider,
174+
DATADIR "/mate-panel/" "mate-panel.css", &error2);
175+
176+
if (error2 != NULL) {
177+
g_warning ("Can't parse mate-panel CSS custom description: %s\n", error2->message);
178+
g_error_free (error2);
179+
}
180+
else {
181+
gtk_style_context_add_provider_for_screen (gdk_screen_get_default(),
182+
GTK_STYLE_PROVIDER (provider),
183+
GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);
184+
}
185+
g_object_unref (provider);
186+
169187
gtk_main ();
170188

171189
panel_lockdown_finalize ();

0 commit comments

Comments
 (0)