[gupnp-tools] Use GtkSourceView for DIDL debug info if available



commit 17d821d06b1f4669aeaa03abd8706a312200b86c
Author: Jens Georg <mail jensge org>
Date:   Fri Jul 29 12:01:42 2011 +0200

    Use GtkSourceView for DIDL debug info if available
    
    https://bugzilla.gnome.org/show_bug.cgi?id=655579

 configure.ac                               |    6 ++++++
 data/Makefile.am                           |    4 ++--
 data/{gupnp-av-cp.ui => gupnp-av-cp.ui.in} |    2 +-
 src/av-cp/Makefile.am                      |    4 +++-
 src/av-cp/playlist-treeview.c              |   22 ++++++++++++++++++++++
 5 files changed, 34 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 181bfce..f791577 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,6 +17,7 @@ GTK_REQUIRED=3.0.0
 GTHREAD_REQUIRED=2.12
 GIO_REQUIRED=2.12
 ICON_THEME_REQUIRED=2.20
+GTKSOURCEVIEW_REQUIRED=3.0.0
 
 AC_MSG_CHECKING([for Win32])
 case "$host" in
@@ -35,6 +36,10 @@ PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)
 PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= $GTHREAD_REQUIRED)
 PKG_CHECK_MODULES(GNOME_ICON_THEME, gnome-icon-theme >= $ICON_THEME_REQUIRED)
 PKG_CHECK_MODULES(GIO, gio-2.0 >= $GIO_REQUIRED)
+PKG_CHECK_MODULES(GTKSOURCEVIEW, gtksourceview-3.0 >= GTKSOURCEVIEW_REQUIRED,
+                  AC_DEFINE([HAVE_GTK_SOURCEVIEW], [1], [Use GtkSourceView])
+                  AC_SUBST([TEXT_VIEW],[GtkSourceView]),
+                  AC_SUBST([TEXT_VIEW],[GtkTextView]))
 
 if test "x$os_win32" = "xno"; then
     PKG_CHECK_MODULES(UUID, uuid)
@@ -112,6 +117,7 @@ src/upload/Makefile
 data/Makefile
 data/gupnp-universal-cp.desktop.in
 data/gupnp-av-cp.desktop.in
+data/gupnp-av-cp.ui
 data/gupnp-network-light.desktop.in
 data/pixmaps/Makefile
 data/xml/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index de14f39..68224a7 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -11,7 +11,7 @@ desktop_in_files = gupnp-universal-cp.desktop.in \
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 
 if BUILD_AV
-dist_shared_DATA += gupnp-av-cp.ui
+shared_DATA = gupnp-av-cp.ui
 desktop_in_files += gupnp-av-cp.desktop.in
 endif
 
@@ -19,7 +19,7 @@ endif
 $(desktop_DATA): $(desktop_in_files) Makefile
 	@sed -e "s,\$${prefix},${prefix},g" $(@:.desktop=.desktop.in) > $@
 
-EXTRA_DIST = $(desktop_in_files:.desktop.in=.desktop.in.in)
+EXTRA_DIST = $(desktop_in_files:.desktop.in=.desktop.in.in) gupnp-av-cp.ui.in
 
 CLEANFILES = $(desktop_DATA)
 
diff --git a/data/gupnp-av-cp.ui b/data/gupnp-av-cp.ui.in
similarity index 99%
rename from data/gupnp-av-cp.ui
rename to data/gupnp-av-cp.ui.in
index 8e077f2..39cec79 100644
--- a/data/gupnp-av-cp.ui
+++ b/data/gupnp-av-cp.ui.in
@@ -91,7 +91,7 @@ Vinicius Depizzol &lt;vdepizzol gmail com&gt;</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <child>
-              <object class="GtkTextView" id="didl-textview">
+              <object class="@TEXT_VIEW@" id="didl-textview">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="editable">False</property>
diff --git a/src/av-cp/Makefile.am b/src/av-cp/Makefile.am
index 4747ce7..d59064d 100644
--- a/src/av-cp/Makefile.am
+++ b/src/av-cp/Makefile.am
@@ -8,6 +8,7 @@ AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
 	    $(LIBGUPNP_AV_CFLAGS) \
 	    $(GTK_CFLAGS) \
 	    $(GTHREAD_CFLAGS) \
+	    $(GTKSOURCEVIEW_CFLAGS) \
 	    -I$(top_srcdir) -DDATA_DIR='"$(shareddir)"' \
 	    -I$(top_srcdir)/src/common
 
@@ -28,7 +29,8 @@ gupnp_av_cp_LDADD = ../common/libutil.a \
 		    $(LIBGUPNP_LIBS) \
 		    $(LIBGUPNP_AV_LIBS) \
 		    $(GTK_LIBS) \
-		    $(GTHREAD_LIBS)
+		    $(GTHREAD_LIBS) \
+		    $(GTKSOURCEVIEW_LIBS)
 gupnp_av_cp_LDFLAGS = -export-dynamic
 
 if OS_WIN32
diff --git a/src/av-cp/playlist-treeview.c b/src/av-cp/playlist-treeview.c
index f23f297..52bdc86 100644
--- a/src/av-cp/playlist-treeview.c
+++ b/src/av-cp/playlist-treeview.c
@@ -23,6 +23,12 @@
 #include <config.h>
 #include <gmodule.h>
 
+#ifdef HAVE_GTK_SOURCEVIEW
+#include <gtksourceview/gtksourceview.h>
+#include <gtksourceview/gtksourcelanguagemanager.h>
+#include <gtksourceview/gtksourcelanguage.h>
+#endif
+
 #include "playlist-treeview.h"
 #include "renderer-combo.h"
 #include "renderer-controls.h"
@@ -346,6 +352,22 @@ setup_playlist_treeview (GtkBuilder *builder)
                                                           "didl-dialog"));
         didl_textview = GTK_WIDGET (gtk_builder_get_object (builder,
                                                           "didl-textview"));
+#ifdef HAVE_GTK_SOURCEVIEW
+        GtkSourceLanguageManager *manager =
+                                gtk_source_language_manager_get_default ();
+        GtkSourceLanguage *language =
+                gtk_source_language_manager_guess_language (manager,
+                                                            NULL,
+                                                            "text/xml");
+
+        GtkSourceBuffer *buffer = gtk_source_buffer_new_with_language (language);
+        gtk_source_buffer_set_highlight_syntax (buffer, TRUE);
+        gtk_source_view_set_show_line_numbers (GTK_SOURCE_VIEW (didl_textview),
+                                               TRUE);
+
+        gtk_text_view_set_buffer (GTK_TEXT_VIEW (didl_textview),
+                                  GTK_TEXT_BUFFER (buffer));
+#endif
 
         model = create_playlist_treemodel ();
         g_assert (model != NULL);



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