György Balló has proposed merging lp:~ballogy/indicator-session/make-gtklogouthelper-and-apt-optional into lp:indicator-session.
Requested reviews: Indicator Applet Developers (indicator-applet-developers) For more details, see: https://code.launchpad.net/~ballogy/indicator-session/make-gtklogouthelper-and-apt-optional/+merge/83228 This change makes it possible to disable GTK Logout Helper and APT support by --disable-gtklogouthelper and --disable-apt configure switches: 1. The GTK Logout Helper requres a patch, which not accepted by upstream yet[1]. Currently if RequestShutdown and RequestReboot DBus API is not available, then it could fall back to using ConsoleKit. But ConsoleKit is not takes care about unsaved documents, which makes this method risky. My patch adds a build option to disable gtklogouthelper, and use the upstream dialog (gnome-session-quit) for logout/reboot/shutdown tasks. 2. APT is a Debian/Ubuntu specific package manager, and it's not available in other systems. Since I'm working on integrate Unity into Arch Linux, I would like to disable this functionality. My patch does it optionally, and also disables calling Ubuntu-related Software Center if Simple Scan or Cheese are not installed. [1] https://bugzilla.gnome.org/show_bug.cgi?id=575880 -- https://code.launchpad.net/~ballogy/indicator-session/make-gtklogouthelper-and-apt-optional/+merge/83228 Your team ayatana-commits is subscribed to branch lp:indicator-session.
=== modified file 'configure.ac' --- configure.ac 2011-10-28 15:27:45 +0000 +++ configure.ac 2011-11-23 22:30:34 +0000 @@ -77,21 +77,55 @@ 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) ########################### +# APT support +########################### +AC_ARG_ENABLE([apt], + AC_HELP_STRING([--disable-apt], [disable APT support]),, + [enable_apt=yes]) +AM_CONDITIONAL([BUILD_APT], [test "x$enable_apt" != "xno"]) + +if test "x$enable_apt" != "xno"; then + AC_DEFINE(HAVE_APT, 1, [Define to 1 to enable APT support]) +fi + +########################### # Check to see if we're local ########################### @@ -192,4 +226,6 @@ Prefix: $prefix Indicator Dir: $INDICATORDIR Indicator GTK: $with_gtk + Logout Helper: $have_gtklogouthelper + APT support: $enable_apt ]) === modified file 'data/Makefile.am' --- data/Makefile.am 2011-08-23 20:28:24 +0000 +++ data/Makefile.am 2011-11-23 22:30:34 +0000 @@ -18,6 +18,15 @@ 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_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 === modified file 'src/Makefile.am' --- src/Makefile.am 2011-08-19 18:13:57 +0000 +++ src/Makefile.am 2011-11-23 22:30:34 +0000 @@ -1,7 +1,11 @@ libexec_PROGRAMS = \ - indicator-session-service \ + indicator-session-service + +if BUILD_GTKLOGOUTHELPER +libexec_PROGRAMS += \ gtk-logout-helper +endif ################### # Indicator Stuff @@ -103,13 +107,18 @@ user-menu-mgr.c \ device-menu-mgr.h \ device-menu-mgr.c \ + udev-mgr.h \ + udev-mgr.c \ + sane-rules.h + +if BUILD_APT +indicator_session_service_SOURCES += \ apt-watcher.h \ apt-watcher.c \ apt-transaction.h \ - apt-transaction.c \ - udev-mgr.h \ - udev-mgr.c \ - sane-rules.h + apt-transaction.c +endif + indicator_session_service_CFLAGS = \ $(SESSIONSERVICE_CFLAGS) \ $(GCONF_CFLAGS) \ @@ -124,6 +133,7 @@ # GTK Logout Stuff ################# +if BUILD_GTKLOGOUTHELPER gtk_logout_helper_SOURCES = \ gtk-logout-helper.c \ settings-helper.c \ @@ -142,6 +152,7 @@ $(SESSIONSERVICE_LIBS) \ $(GTKLOGOUTHELPER_LIBS) \ $(GCONF_LIBS) +endif ############### === modified file 'src/device-menu-mgr.c' --- src/device-menu-mgr.c 2011-08-31 14:51:16 +0000 +++ src/device-menu-mgr.c 2011-11-23 22:30:34 +0000 @@ -17,6 +17,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <config.h> #include <libdbusmenu-glib/client.h> #include <libdbusmenu-gtk3/menuitem.h> @@ -26,7 +27,11 @@ #include "dbusmenu-shared.h" #include "lock-helper.h" #include "upower-client.h" + +#ifdef HAVE_APT #include "apt-watcher.h" +#endif /* HAVE_APT */ + #include "udev-mgr.h" #define UP_ADDRESS "org.freedesktop.UPower" @@ -40,7 +45,9 @@ GObject parent_instance; DbusmenuMenuitem* root_item; SessionDbus* session_dbus_interface; +#ifdef HAVE_APT AptWatcher* apt_watcher; +#endif /* HAVE_APT */ UdevMgr* udev_mgr; }; @@ -50,7 +57,9 @@ static DbusmenuMenuitem *system_settings_menuitem = NULL; static DbusmenuMenuitem *display_settings_menuitem = NULL; static DbusmenuMenuitem *login_settings_menuitem = NULL; +#ifdef HAVE_APT static DbusmenuMenuitem *software_updates_menuitem = NULL; +#endif /* HAVE_APT */ static DbusmenuMenuitem *printers_menuitem = NULL; static DbusmenuMenuitem *scanners_menuitem = NULL; static DbusmenuMenuitem *webcam_menuitem = NULL; @@ -102,7 +111,9 @@ static void device_menu_mgr_init (DeviceMenuMgr *self) { +#ifdef HAVE_APT self->apt_watcher = NULL; +#endif /* HAVE_APT */ self->root_item = dbusmenu_menuitem_new (); setup_up(self); g_idle_add(lock_screen_setup, NULL); @@ -410,7 +421,11 @@ 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); @@ -480,12 +495,14 @@ { g_warning("Unable to launch simple-scan: %s", error->message); g_error_free(error); +#ifdef HAVE_APT if (!g_spawn_command_line_async("software-center simple-scan", &error)) { g_warning ("Unable to launch software-centre simple-scan: %s", error->message); g_error_free(error); } +#endif /* HAVE_APT */ } } @@ -498,12 +515,14 @@ { g_warning("Unable to launch cheese: %s", error->message); g_error_free(error); +#ifdef HAVE_APT if (!g_spawn_command_line_async("software-center cheese", &error)) { g_warning ("Unable to launch software-centre cheese: %s", error->message); g_error_free(error); } +#endif /* HAVE_APT */ } } @@ -542,6 +561,7 @@ dbusmenu_menuitem_child_add_position(self->root_item, login_settings_menuitem, 2); +#ifdef HAVE_APT software_updates_menuitem = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set (software_updates_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, @@ -549,6 +569,7 @@ dbusmenu_menuitem_child_add_position(self->root_item, software_updates_menuitem, 3); +#endif /* HAVE_APT */ DbusmenuMenuitem * separator1 = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set (separator1, @@ -726,7 +747,11 @@ 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; @@ -778,9 +803,11 @@ DeviceMenuMgr* device_mgr = g_object_new (DEVICE_TYPE_MENU_MGR, NULL); device_mgr->session_dbus_interface = session_dbus; device_menu_mgr_build_static_items (device_mgr, greeter_mode); +#ifdef HAVE_APT if (software_updates_menuitem != NULL) { device_mgr->apt_watcher = apt_watcher_new (session_dbus, software_updates_menuitem); } +#endif /* HAVE_APT */ return device_mgr; }
_______________________________________________ Mailing list: https://launchpad.net/~ayatana-commits Post to : ayatana-commits@lists.launchpad.net Unsubscribe : https://launchpad.net/~ayatana-commits More help : https://help.launchpad.net/ListHelp