[totem/gnome-3-10] gst: Add RTL helpers



commit 9055f411d2332c43c725ccbb88f5f7c240885e91
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jul 30 18:01:40 2013 +0200

    gst: Add RTL helpers
    
    So as to avoid replicating the same code everywhere...

 configure.ac                |    1 +
 src/Makefile.am             |    7 +++--
 src/gst/Makefile.am         |   19 ++++++++++++-
 src/gst/totem-rtl-helpers.c |   61 +++++++++++++++++++++++++++++++++++++++++++
 src/gst/totem-rtl-helpers.h |   35 ++++++++++++++++++++++++
 5 files changed, 119 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e99ddd8..1143d59 100644
--- a/configure.ac
+++ b/configure.ac
@@ -287,6 +287,7 @@ PKG_CHECK_MODULES(PLAYER, $BACKEND_MODULES glib-2.0 >= $GLIB_REQS gio-2.0 >= $GI
 PKG_CHECK_MODULES(LIBPLAYER, glib-2.0 >= $GLIB_REQS gio-2.0 >= $GIO_REQS gtk+-3.0 >= $GTK_REQS gdk-x11-3.0 
= $GTK_REQS clutter-gtk-1.0)
 PKG_CHECK_MODULES(HELPER, gstreamer-1.0 gstreamer-tag-1.0)
 PKG_CHECK_MODULES(TIME_HELPER, glib-2.0)
+PKG_CHECK_MODULES(RTL_HELPER, glib-2.0 gtk+-3.0 >= $GTK_REQS)
 PKG_CHECK_MODULES(PIXBUF_HELPER, gdk-pixbuf-2.0 gstreamer-tag-1.0 >= $GSTPLUG_REQS gstreamer-video-1.0)
 PKG_CHECK_MODULES(THUMBNAILER, gtk+-3.0 >= $GTK_REQS totem-plparser >= $TOTEM_PLPARSER_REQS 
gstreamer-tag-1.0 >= $GSTPLUG_REQS gstreamer-video-1.0)
 PKG_CHECK_MODULES(PREVIEW, gstreamer-1.0 >= $GST_REQS gio-2.0 >= $GIO_REQS gdk-pixbuf-2.0)
diff --git a/src/Makefile.am b/src/Makefile.am
index 9222c7c..f4e9b1b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -48,9 +48,10 @@ libtotem_player_la_CPPFLAGS =                \
        -DG_LOG_DOMAIN=\""Totem"\"      \
        $(AM_CPPFLAGS)
 
-libtotem_player_la_LIBADD =    \
-       $(PLAYER_LIBS)          \
-       gst/libtotemtimehelpers.la
+libtotem_player_la_LIBADD =            \
+       $(PLAYER_LIBS)                  \
+       gst/libtotemtimehelpers.la      \
+       gst/libtotemrtlhelpers.la
 libtotem_player_la_CFLAGS =    \
        $(LIBPLAYER_CFLAGS)     \
        -I$(srcdir)/gst/        \
diff --git a/src/gst/Makefile.am b/src/gst/Makefile.am
index c5f1159..b3a8862 100644
--- a/src/gst/Makefile.am
+++ b/src/gst/Makefile.am
@@ -1,7 +1,8 @@
 noinst_LTLIBRARIES =                   \
        libtotemgsthelpers.la           \
        libtotemgstpixbufhelpers.la     \
-       libtotemtimehelpers.la
+       libtotemtimehelpers.la          \
+       libtotemrtlhelpers.la
 
 libtotemgsthelpers_la_SOURCES =        \
        totem-gst-helpers.c     \
@@ -51,6 +52,22 @@ libtotemtimehelpers_la_CFLAGS =      \
 libtotemtimehelpers_la_LIBADD = $(TIME_HELPER_LIBS)
 libtotemtimehelpers_la_LDFLAGS= -no-undefined
 
+libtotemrtlhelpers_la_SOURCES =        \
+       totem-rtl-helpers.c             \
+       totem-rtl-helpers.h
+
+libtotemrtlhelpers_la_CPPFLAGS =       \
+       -D_REENTRANT                    \
+       $(DISABLE_DEPRECATED)           \
+       $(AM_CPPFLAGS)
+
+libtotemrtlhelpers_la_CFLAGS = \
+       $(RTL_HELPER_CFLAGS)    \
+       $(AM_CFLAGS)
+
+libtotemrtlhelpers_la_LIBADD = $(RTL_HELPER_LIBS)
+libtotemrtlhelpers_la_LDFLAGS= -no-undefined
+
 EXTRA_DIST = totem-time-helpers.h
 
 -include $(top_srcdir)/git.mk
diff --git a/src/gst/totem-rtl-helpers.c b/src/gst/totem-rtl-helpers.c
new file mode 100644
index 0000000..0b62d6c
--- /dev/null
+++ b/src/gst/totem-rtl-helpers.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2013 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 <gtk/gtk.h>
+
+#include "totem-rtl-helpers.h"
+
+struct {
+       const char *orig;
+       const char *ltr;
+       const char *rtl;
+} icons[] = {
+       { "go-previous", "go-previous-symbolic", "go-previous-rtl-symbolic" },
+       { "media-playback-start", "media-playback-start-symbolic", "media-playback-start-rtl-symbolic" },
+       { "media-seek-forward", "media-seek-forward-symbolic", "media-seek-forward-rtl-symbolic" },
+       { "media-seek-backward", "media-seek-backward-symbolic", "media-seek-backward-rtl-symbolic" },
+       { "media-skip-forward", "media-skip-forward-symbolic", "media-skip-forward-rtl-symbolic" },
+       { "media-skip-backward", "media-skip-backward-symbolic", "media-skip-backward-rtl-symbolic" },
+};
+
+const char *
+totem_get_rtl_icon_name (const char *name)
+{
+       guint i;
+       gboolean rtl;
+
+       g_return_val_if_fail (name != NULL, NULL);
+
+       for (i = 0; i < G_N_ELEMENTS(icons); i++) {
+               if (g_str_equal (name, icons[i].orig)) {
+                       rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL);
+                       return rtl ? icons[i].rtl : icons[i].ltr;
+               }
+       }
+
+       return NULL;
+}
diff --git a/src/gst/totem-rtl-helpers.h b/src/gst/totem-rtl-helpers.h
new file mode 100644
index 0000000..eb99a36
--- /dev/null
+++ b/src/gst/totem-rtl-helpers.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2013 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_RTL_HELPERS_H_
+#define _TOTEM_RTL_HELPERS_H_
+
+#include <glib.h>
+
+const char *totem_get_rtl_icon_name (const char *name);
+
+#endif /* _TOTEM_RTL_HELPERS_H_ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]