[totem] gst: Add helper to remove shadows from popovers
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] gst: Add helper to remove shadows from popovers
- Date: Thu, 20 Feb 2014 15:46:15 +0000 (UTC)
commit d727a816b9e8b159817b3fc775fcf8fde020a3ac
Author: Bastien Nocera <hadess hadess net>
Date: Thu Feb 20 15:56:34 2014 +0100
gst: Add helper to remove shadows from popovers
As they don't behave well with clutter-gtk, and we get huge
gray masses around the popup.
src/gst/Makefile.am | 19 ++++++++++++-
src/gst/totem-style-helpers.c | 58 +++++++++++++++++++++++++++++++++++++++++
src/gst/totem-style-helpers.h | 35 ++++++++++++++++++++++++
3 files changed, 111 insertions(+), 1 deletions(-)
---
diff --git a/src/gst/Makefile.am b/src/gst/Makefile.am
index 4529192..2c2124f 100644
--- a/src/gst/Makefile.am
+++ b/src/gst/Makefile.am
@@ -2,7 +2,8 @@ noinst_LTLIBRARIES = \
libtotemgsthelpers.la \
libtotemgstpixbufhelpers.la \
libtotemtimehelpers.la \
- libtotemrtlhelpers.la
+ libtotemrtlhelpers.la \
+ libtotemstylehelpers.la
libtotemgsthelpers_la_SOURCES = \
totem-gst-helpers.c \
@@ -52,6 +53,22 @@ libtotemtimehelpers_la_CFLAGS = \
libtotemtimehelpers_la_LIBADD = $(TIME_HELPER_LIBS)
libtotemtimehelpers_la_LDFLAGS= -no-undefined
+libtotemstylehelpers_la_SOURCES = \
+ totem-style-helpers.c \
+ totem-style-helpers.h
+
+libtotemstylehelpers_la_CPPFLAGS = \
+ -D_REENTRANT \
+ $(DISABLE_DEPRECATED) \
+ $(AM_CPPFLAGS)
+
+libtotemstylehelpers_la_CFLAGS = \
+ $(RTL_HELPER_CFLAGS) \
+ $(AM_CFLAGS)
+
+libtotemstylehelpers_la_LIBADD = $(RTL_HELPER_LIBS)
+libtotemstylehelpers_la_LDFLAGS= -no-undefined
+
libtotemrtlhelpers_la_SOURCES = \
totem-rtl-helpers.c \
totem-rtl-helpers.h
diff --git a/src/gst/totem-style-helpers.c b/src/gst/totem-style-helpers.c
new file mode 100644
index 0000000..5419569
--- /dev/null
+++ b/src/gst/totem-style-helpers.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright © 2014 Bastien Nocera <hadess hadess net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * The Totem project hereby grant permission for non-gpl compatible GStreamer
+ * plugins to be used and distributed together with GStreamer and Totem. This
+ * permission is above and beyond the permissions granted by the GPL license
+ * Totem is covered by.
+ *
+ * Monday 7th February 2005: Christian Schaller: Add exception clause.
+ * See license_change file for details.
+ *
+ */
+
+#include "totem-style-helpers.h"
+
+void
+totem_set_popover_no_shadow (GtkWidget *widget)
+{
+ GtkWidget *popover;
+ GtkStyleContext *context;
+ GtkCssProvider *provider;
+ const gchar css[] =
+ "GtkPopover {\n"
+ " border-radius: 0px;\n"
+ " margin: 0px;\n"
+ " padding: 0px;\n"
+ "}";
+
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ if (GTK_IS_SCALE_BUTTON (widget))
+ popover = gtk_scale_button_get_popup (GTK_SCALE_BUTTON (widget));
+ else if (GTK_IS_MENU_BUTTON (widget))
+ popover = GTK_WIDGET (gtk_menu_button_get_popover (GTK_MENU_BUTTON (widget)));
+ else
+ g_assert_not_reached();
+
+ context = gtk_widget_get_style_context (popover);
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider, css, -1, NULL);
+ gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (provider);
+}
diff --git a/src/gst/totem-style-helpers.h b/src/gst/totem-style-helpers.h
new file mode 100644
index 0000000..f505c47
--- /dev/null
+++ b/src/gst/totem-style-helpers.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2014 Bastien Nocera <hadess hadess net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * The Totem project hereby grant permission for non-gpl compatible GStreamer
+ * plugins to be used and distributed together with GStreamer and Totem. This
+ * permission is above and beyond the permissions granted by the GPL license
+ * Totem is covered by.
+ *
+ * Monday 7th February 2005: Christian Schaller: Add exception clause.
+ * See license_change file for details.
+ *
+ */
+
+#ifndef _TOTEM_STYLE_HELPERS_H_
+#define _TOTEM_STYLE_HELPERS_H_
+
+#include <gtk/gtk.h>
+
+void totem_set_popover_no_shadow (GtkWidget *widget);
+
+#endif /* _TOTEM_STYLE_HELPERS_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]