← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~mterry/indicator-session/gtk3 into lp:indicator-session

 

Michael Terry has proposed merging lp:~mterry/indicator-session/gtk3 into lp:indicator-session.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)

For more details, see:
https://code.launchpad.net/~mterry/indicator-session/gtk3/+merge/62515

This branch builds with gtk3 instead of gtk2.  It also adds a configure flag to build with a gtk2 indicator instead if desired (though the daemon and such continue to use gtk3 in this case).

I also fixed a minor issue with the Makefile.am that prevented compilation if the built xml files were not in the same directory as the source.  (necessary for building a deb that runs configure twice with two different build directories)

This approach to gtk3 support will let the deb packaging build both versions and make for an easier transition.
-- 
https://code.launchpad.net/~mterry/indicator-session/gtk3/+merge/62515
Your team ayatana-commits is subscribed to branch lp:indicator-session.
=== modified file 'configure.ac'
--- configure.ac	2011-04-14 20:57:46 +0000
+++ configure.ac	2011-05-26 16:47:42 +0000
@@ -26,28 +26,44 @@
 ###########################
 
 GTK_REQUIRED_VERSION=2.12
+GTK3_REQUIRED_VERSION=3.0
 INDICATOR_REQUIRED_VERSION=0.3.19
 DBUSMENUGTK_REQUIRED_VERSION=0.3.91
 POLKIT_REQUIRED_VERSION=0.92
 
-PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
-                          indicator >= $INDICATOR_REQUIRED_VERSION
-                          dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION)
+AC_ARG_WITH([indicator-gtk],
+  [AS_HELP_STRING([--with-indicator-gtk],
+    [Which version of gtk to use for the indicator @<:@default=3@:>@])],
+  [],
+  [with_indicator_gtk=3])
+
+AS_IF([test "x$with_indicator_gtk" = x3],
+        [PKG_CHECK_MODULES(APPLET, gtk+-3.0 >= $GTK3_REQUIRED_VERSION
+                                   indicator3 >= $INDICATOR_REQUIRED_VERSION
+                                   dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION)
+        ],
+      [test "x$with_indicator_gtk" = x2],
+         [PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
+                                    indicator >= $INDICATOR_REQUIRED_VERSION
+                                    dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION)
+        ],
+      [AC_MSG_FAILURE([Value for --with-indicator-gtk was neither 2 nor 3])]
+)
 AC_SUBST(APPLET_CFLAGS)
 AC_SUBST(APPLET_LIBS)
 
 DBUSMENUGLIB_REQUIRED_VERSION=0.1.1
 
 PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
-                                  dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
+                                  dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
                                   dbus-glib-1
                                   gio-unix-2.0
-                                  indicator >= $INDICATOR_REQUIRED_VERSION)
+                                  indicator3 >= $INDICATOR_REQUIRED_VERSION)
 
 AC_SUBST(SESSIONERVICE_CFLAGS)
 AC_SUBST(SESSIONERVICE_LIBS)
 
-PKG_CHECK_MODULES(GTKLOGOUTHELPER, gtk+-2.0 >= $GTK_REQUIRED_VERSION
+PKG_CHECK_MODULES(GTKLOGOUTHELPER, gtk+-3.0 >= $GTK3_REQUIRED_VERSION
                                    polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION)
 
 
@@ -78,9 +94,12 @@
 if test "x$with_localinstall" = "xyes"; then
 	INDICATORDIR="${libdir}/indicators/2/"
 	INDICATORICONSDIR="${datadir}/indicator-applet/icons/"
-else
+elif test "x$with_indicator_gtk" = x2; then
 	INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator`
 	INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator`
+else
+	INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator3`
+	INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator3`
 fi
 AC_SUBST(INDICATORDIR)
 AC_SUBST(INDICATORICONSDIR)
@@ -159,4 +178,5 @@
 SUS Indicator Configuration:
 
 	Prefix:        $prefix
+	Indicator GTK: $with_indicator_gtk
 ])

=== modified file 'src/Makefile.am'
--- src/Makefile.am	2011-01-17 17:12:35 +0000
+++ src/Makefile.am	2011-05-26 16:47:42 +0000
@@ -69,13 +69,13 @@
 
 gen-%.xml.c: %.xml
 	@echo "Building $@ from $<"
-	@echo "const char * _$(subst -,_,$(subst .,_,$(basename $<))) = " > $@
+	@echo "const char * _$(subst -,_,$(subst .,_,$(basename $(notdir $<)))) = " > $@
 	@sed -e "s:\":\\\\\":g" -e s:^:\": -e s:\$$:\\\\n\": $< >> $@
 	@echo ";" >> $@
 
 gen-%.xml.h: %.xml
 	@echo "Building $@ from $<"
-	@echo "extern const char * _$(subst -,_,$(subst .,_,$(basename $<)));" > $@
+	@echo "extern const char * _$(subst -,_,$(subst .,_,$(basename $(notdir $<))));" > $@
 
 #################
 # Session Stuff

=== modified file 'src/indicator-session.c'
--- src/indicator-session.c	2011-04-05 03:59:32 +0000
+++ src/indicator-session.c	2011-05-26 16:47:42 +0000
@@ -29,7 +29,12 @@
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 #include <gio/gio.h>
+
+#if GTK_CHECK_VERSION(3, 0, 0)
+#include <libdbusmenu-gtk3/menu.h>
+#else
 #include <libdbusmenu-gtk/menu.h>
+#endif
 
 #include <libindicator/indicator.h>
 #include <libindicator/indicator-object.h>

=== modified file 'src/session-service.c'
--- src/session-service.c	2011-03-10 21:49:10 +0000
+++ src/session-service.c	2011-05-26 16:47:42 +0000
@@ -36,7 +36,7 @@
 #include <libdbusmenu-glib/server.h>
 #include <libdbusmenu-glib/menuitem.h>
 #include <libdbusmenu-glib/client.h>
-#include <libdbusmenu-gtk/menuitem.h>
+#include <libdbusmenu-gtk3/menuitem.h>
 
 #include <libindicator/indicator-service.h>
 


Follow ups