aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Terry <michael.terry@canonical.com>2011-05-26 11:54:30 -0400
committerMichael Terry <michael.terry@canonical.com>2011-05-26 11:54:30 -0400
commit6eb44e9133dc234ce48cf27454575a3cebf0376d (patch)
tree49324cf5c205a332b1541b9b0e5c9eae8d1c1da1
parentf133202143adf833bc8f6de78826a1325932a13e (diff)
downloadayatana-indicator-session-6eb44e9133dc234ce48cf27454575a3cebf0376d.tar.gz
ayatana-indicator-session-6eb44e9133dc234ce48cf27454575a3cebf0376d.tar.bz2
ayatana-indicator-session-6eb44e9133dc234ce48cf27454575a3cebf0376d.zip
port to gtk3; allow building with gtk2
-rw-r--r--configure.ac34
-rw-r--r--src/Makefile.am4
-rw-r--r--src/indicator-session.c5
-rw-r--r--src/session-service.c2
4 files changed, 35 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index a882555..cf4a298 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,28 +26,44 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
###########################
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 @@ AC_ARG_ENABLE(localinstall, AS_HELP_STRING([--enable-localinstall], [install all
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 @@ AC_MSG_NOTICE([
SUS Indicator Configuration:
Prefix: $prefix
+ Indicator GTK: $with_indicator_gtk
])
diff --git a/src/Makefile.am b/src/Makefile.am
index 4fa43b9..0317de7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -69,13 +69,13 @@ users-service-marshal.c: $(srcdir)/users-service.list
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
diff --git a/src/indicator-session.c b/src/indicator-session.c
index e8a2f97..c9617c4 100644
--- a/src/indicator-session.c
+++ b/src/indicator-session.c
@@ -29,7 +29,12 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#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>
diff --git a/src/session-service.c b/src/session-service.c
index dc53f74..ddcb7cb 100644
--- a/src/session-service.c
+++ b/src/session-service.c
@@ -36,7 +36,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#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>