From 5a3df0dde62593659e792f92236a8142087080f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gy=C3=B6rgy=20Ball=C3=B3?= Date: Wed, 23 Nov 2011 22:58:41 +0100 Subject: Make GTK Logout Helper optional --- configure.ac | 41 ++++++++++++++++++++++++++++++++--------- data/Makefile.am | 20 ++++++++++++-------- src/Makefile.am | 8 +++++++- src/device-menu-mgr.c | 9 +++++++++ 4 files changed, 60 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index 0e20a91..a6ea42f 100644 --- a/configure.ac +++ b/configure.ac @@ -77,16 +77,38 @@ AS_IF([test "x$with_gtk" = x3], AC_SUBST(SESSIONERVICE_CFLAGS) AC_SUBST(SESSIONERVICE_LIBS) -AS_IF([test "x$with_gtk" = x3], - [PKG_CHECK_MODULES(GTKLOGOUTHELPER, gtk+-3.0 >= $GTK3_REQUIRED_VERSION - polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION) - ], - [test "x$with_gtk" = x2], - [PKG_CHECK_MODULES(GTKLOGOUTHELPER, gtk+-2.0 >= $GTK_REQUIRED_VERSION - polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION) - ] -) +########################### +# GTK Logout Helper +########################### +AC_ARG_ENABLE([gtklogouthelper], + AS_HELP_STRING([--enable-gtklogouthelper], [enable GTK Logout Helper]),, + enable_gtklogouthelper=auto) + +if test x"$enable_gtklogouthelper" != x"no" ; then + AS_IF([test "x$with_gtk" = x3], + [PKG_CHECK_MODULES(GTKLOGOUTHELPER, gtk+-3.0 >= $GTK3_REQUIRED_VERSION + polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION, + [have_gtklogouthelper=yes], + [have_gtklogouthelper=no]) + ], + [test "x$with_gtk" = x2], + [PKG_CHECK_MODULES(GTKLOGOUTHELPER, gtk+-2.0 >= $GTK_REQUIRED_VERSION + polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION, + [have_gtklogouthelper=yes], + [have_gtklogouthelper=no]) + ] + ) + if test x${have_gtklogouthelper} = xyes; then + AC_DEFINE(HAVE_GTKLOGOUTHELPER, 1, [Define to 1 to enable GTK Logout Helper]) + fi + if test x${enable_gtklogouthelper} = xyes && test x${have_gtklogouthelper} = xno; then + AC_MSG_ERROR([GTK Logout Helper configured but polkit-gobject not found]) + fi +else + have_gtklogouthelper=no +fi +AM_CONDITIONAL(BUILD_GTKLOGOUTHELPER, test x${have_gtklogouthelper} = xyes) AC_SUBST(GTKLOGOUTHELPER_CFLAGS) AC_SUBST(GTKLOGOUTHELPER_LIBS) @@ -192,4 +214,5 @@ SUS Indicator Configuration: Prefix: $prefix Indicator Dir: $INDICATORDIR Indicator GTK: $with_gtk + Logout Helper: $have_gtklogouthelper ]) diff --git a/data/Makefile.am b/data/Makefile.am index 7e851a7..3b8de1f 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -18,6 +18,15 @@ gsettings_SCHEMAS = com.canonical.indicator.session.gschema.xml convertdir = $(datadir)/GConf/gsettings dist_convert_DATA = indicator-session.convert +EXTRA_DIST = \ + $(service_in_files) \ + $(gsettings_SCHEMAS:.xml=.xml.in) + +CLEANFILES = \ + $(dbus_services_DATA) \ + $(gsettings_SCHEMAS) + +if BUILD_GTKLOGOUTHELPER @INTLTOOL_DESKTOP_RULE@ %.desktop.in: %.desktop.in.in @@ -37,14 +46,9 @@ logout_helper_desktop_files = \ $(logout_helper_desktop_in_in_files:.desktop.in.in=.desktop) logout_helper_DATA = $(logout_helper_desktop_files) -EXTRA_DIST = \ - $(service_in_files) \ - $(gsettings_SCHEMAS:.xml=.xml.in) \ +EXTRA_DIST += \ $(logout_helper_desktop_in_in_files) - -CLEANFILES = \ - $(dbus_services_DATA) \ - $(gsettings_SCHEMAS) \ +CLEANFILES += \ $(logout_helper_desktop_files) - +endif diff --git a/src/Makefile.am b/src/Makefile.am index dba0a9e..5209869 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,11 @@ libexec_PROGRAMS = \ - indicator-session-service \ + indicator-session-service + +if BUILD_GTKLOGOUTHELPER +libexec_PROGRAMS += \ gtk-logout-helper +endif ################### # Indicator Stuff @@ -124,6 +128,7 @@ indicator_session_service_LDADD = \ # GTK Logout Stuff ################# +if BUILD_GTKLOGOUTHELPER gtk_logout_helper_SOURCES = \ gtk-logout-helper.c \ settings-helper.c \ @@ -142,6 +147,7 @@ gtk_logout_helper_LDADD = \ $(SESSIONSERVICE_LIBS) \ $(GTKLOGOUTHELPER_LIBS) \ $(GCONF_LIBS) +endif ############### diff --git a/src/device-menu-mgr.c b/src/device-menu-mgr.c index 5a63be3..926090f 100644 --- a/src/device-menu-mgr.c +++ b/src/device-menu-mgr.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include #include #include @@ -410,7 +411,11 @@ static void show_dialog (DbusmenuMenuitem * mi, guint timestamp, gchar * type) { +#ifdef HAVE_GTKLOGOUTHELPER gchar * helper = g_build_filename(LIBEXECDIR, "gtk-logout-helper", NULL); +#else + gchar * helper = g_build_filename("gnome-session-quit", NULL); +#endif /* HAVE_GTKLOGOUTHELPER */ gchar * dialog_line = g_strdup_printf("%s --%s", helper, type); g_free(helper); @@ -726,7 +731,11 @@ device_menu_mgr_build_static_items (DeviceMenuMgr* self, gboolean greeter_mode) dbusmenu_menuitem_child_append (self->root_item, shutdown_mi); g_signal_connect (G_OBJECT(shutdown_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, +#ifdef HAVE_GTKLOGOUTHELPER G_CALLBACK(show_dialog), "shutdown"); +#else + G_CALLBACK(show_dialog), "power-off"); +#endif /* HAVE_GTKLOGOUTHELPER */ RestartShutdownLogoutMenuItems * restart_shutdown_logout_mi = g_new0 (RestartShutdownLogoutMenuItems, 1); restart_shutdown_logout_mi->logout_mi = logout_mi; -- cgit v1.2.3