summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2015-10-12 19:20:05 -0400
committerraveit65 <[email protected]>2015-10-13 21:46:57 +0200
commit0c639b38b246484bebd7ff3b58c3ecb7fbe43272 (patch)
treef44397021f9eedb3e02404a0e54fc73f0b42cf74
parent622b2ca03dcc1d1e4d1977462494d2b0311ea352 (diff)
downloadmate-media-0c639b38b246484bebd7ff3b58c3ecb7fbe43272.tar.bz2
mate-media-0c639b38b246484bebd7ff3b58c3ecb7fbe43272.tar.xz
GTK3: Support custom panel themes and transparency
This adds support for custom panel themes using the .mate-panel-menu-bar selector to control child widgets. The menus are controllled by .mate-panel-menu-bar .menu and most of the slider theme is that of the frame it is drawn in. The .mate-panel-menu-bar .frame selector will theme this frame, there is also an inner frame in the layout which will follow .mate-panel-menu-bar .frame .frame and otherwise display a second time anything specified in .mate-panel-menu-bar .frame. In most cases that can simply be set transparent. Themes can use alpha values for both menus and slider backgrounds.
-rw-r--r--mate-volume-control/gvc-stream-status-icon.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/mate-volume-control/gvc-stream-status-icon.c b/mate-volume-control/gvc-stream-status-icon.c
index 3ede4b1..07354f9 100644
--- a/mate-volume-control/gvc-stream-status-icon.c
+++ b/mate-volume-control/gvc-stream-status-icon.c
@@ -250,8 +250,21 @@ on_status_icon_popup_menu (GtkStatusIcon *status_icon,
GtkWidget *item;
menu = gtk_menu_new ();
- item = gtk_check_menu_item_new_with_mnemonic (_("_Mute"));
+#if GTK_CHECK_VERSION (3, 0, 0)
+ /*Set up theme and transparency support*/
+ GtkWidget *toplevel = gtk_widget_get_toplevel (menu);
+ /* Fix any failures of compiz/other wm's to communicate with gtk for transparency */
+ GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel));
+ GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
+ gtk_widget_set_visual(GTK_WIDGET(toplevel), visual);
+ /* Set menu and it's toplevel window to follow panel theme */
+ GtkStyleContext *context;
+ context = gtk_widget_get_style_context (GTK_WIDGET(toplevel));
+ gtk_style_context_add_class(context,"gnome-panel-menu-bar");
+ gtk_style_context_add_class(context,"mate-panel-menu-bar");
+#endif
+ item = gtk_check_menu_item_new_with_mnemonic (_("_Mute"));
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item),
mate_mixer_stream_control_get_mute (icon->priv->control));
g_signal_connect (G_OBJECT (item),
@@ -769,6 +782,19 @@ gvc_stream_status_icon_init (GvcStreamStatusIcon *icon)
gvc_channel_bar_set_orientation (GVC_CHANNEL_BAR (icon->priv->bar),
GTK_ORIENTATION_VERTICAL);
+
+#if GTK_CHECK_VERSION (3, 0, 0)
+ /* Set volume control frame, slider and toplevel window to follow panel theme */
+ GtkWidget *toplevel = gtk_widget_get_toplevel (icon->priv->dock);
+ GtkStyleContext *context;
+ context = gtk_widget_get_style_context (GTK_WIDGET(toplevel));
+ gtk_style_context_remove_class (context,GTK_STYLE_CLASS_BACKGROUND);
+ gtk_style_context_add_class(context,"mate-media-applet-slider");
+ /* Make transparency possible in gtk3 theme */
+ GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel));
+ GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
+ gtk_widget_set_visual(GTK_WIDGET(toplevel), visual);
+#endif
#if GTK_CHECK_VERSION (3, 0, 0)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);