← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ballogy/indicator-datetime/make-ccpanel-optional into lp:indicator-datetime

 

György Balló has proposed merging lp:~ballogy/indicator-datetime/make-ccpanel-optional into lp:indicator-datetime.

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

For more details, see:
https://code.launchpad.net/~ballogy/indicator-datetime/make-ccpanel-optional/+merge/83195

This change makes it possible to build indicator-datetime without the Control Center panel. It checks if libgnome-control-center and other dependences are available on build system, and automatically enables/disables it.

I'm working on integrate Unity into Arch Linux, and I want to avoid patching the upstream GNOME packages. I need to disable indicator-datetime's CC panel, because upstream developers of GNOME Control Center disallow external panels:
http://git.gnome.org/browse/gnome-control-center/commit/?id=606b6fd88d52268b4e7720e18035fe947df030cb
-- 
https://code.launchpad.net/~ballogy/indicator-datetime/make-ccpanel-optional/+merge/83195
Your team ayatana-commits is subscribed to branch lp:indicator-datetime.
=== modified file 'Makefile.am'
--- Makefile.am	2011-07-20 09:47:35 +0000
+++ Makefile.am	2011-11-23 17:11:29 +0000
@@ -1,7 +1,11 @@
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 
+if BUILD_CCPANEL
+LIBMAP_SUBDIR = libmap
+endif
+
 SUBDIRS = \
-	libmap \
+	$(LIBMAP_SUBDIR) \
 	src \
 	data \
 	tests \

=== modified file 'configure.ac'
--- configure.ac	2011-10-13 18:27:13 +0000
+++ configure.ac	2011-11-23 17:11:29 +0000
@@ -103,14 +103,34 @@
                            gdk-3.0 >= GDK_REQUIRED_VERSION
                            gconf-2.0 >= GCONF_REQUIRED_VERSION)
 
-PKG_CHECK_MODULES(PREF, gio-2.0 >= $GIO_REQUIRED_VERSION
-	                      gtk+-3.0 >= $GTK3_REQUIRED_VERSION
-	                      json-glib-1.0
-	                      libgnome-control-center
-	                      polkit-gobject-1)
-
-PKG_CHECK_MODULES(LIBMAP, gio-2.0 >= $GIO_REQUIRED_VERSION
-                          gtk+-3.0 >= $GTK3_REQUIRED_VERSION)
+###########################
+# Control Center panel
+###########################
+
+AC_ARG_WITH([ccpanel],
+            AS_HELP_STRING([--with-ccpanel], [enable Control Center panel]),,
+            with_ccpanel=auto)
+
+if test x"$with_ccpanel" != x"no" ; then
+   PKG_CHECK_MODULES(PREF, gio-2.0 >= $GIO_REQUIRED_VERSION
+	                          gtk+-3.0 >= $GTK3_REQUIRED_VERSION
+	                          json-glib-1.0
+	                          libgnome-control-center
+	                          polkit-gobject-1,
+	                          [have_ccpanel=yes],
+	                          [have_ccpanel=no])
+   if test x${have_ccpanel} = xyes; then
+      AC_DEFINE(HAVE_CCPANEL, 1, [Define to 1 to enable Control Center panel])
+      PKG_CHECK_MODULES(LIBMAP, gio-2.0 >= $GIO_REQUIRED_VERSION
+                                      gtk+-3.0 >= $GTK3_REQUIRED_VERSION)
+   fi
+   if test x${with_ccpanel} = xyes && test x${have_ccpanel} = xno; then
+     AC_MSG_ERROR([Control Center panel configured but not found])
+   fi
+else
+   have_ccpanel=no
+fi
+AM_CONDITIONAL(BUILD_CCPANEL, test x${have_ccpanel} = xyes)
 
 ###########################
 # Grab the GSettings Macros
@@ -151,16 +171,18 @@
 # Control Center Info
 ###########################
 
-AS_IF([test "x$with_localinstall" = "xyes"],
-	[
-	CCPANELDIR="${libdir}/control-center-1/panels/"
-	],
-	[
-	CCPANELDIR=`$PKG_CONFIG --variable=extensiondir libgnome-control-center`
+AS_IF([test "x$have_ccpanel" = "xyes"],
+	[
+	AS_IF([test "x$with_localinstall" = "xyes"],
+		[
+		CCPANELDIR="${libdir}/control-center-1/panels/"
+		],
+		[
+		CCPANELDIR=`$PKG_CONFIG --variable=extensiondir libgnome-control-center`
+		])
+
+	AC_SUBST(CCPANELDIR)
 	])
-
-AC_SUBST(CCPANELDIR)
-
 ###########################
 # DBus Service Info
 ###########################
@@ -224,5 +246,6 @@
 
 	Prefix:        $prefix
 	Indicator Dir: $INDICATORDIR
+	CC Panel:      $have_ccpanel
 	CC Panel Dir:  $CCPANELDIR
 ])

=== modified file 'data/Makefile.am'
--- data/Makefile.am	2011-03-10 17:25:19 +0000
+++ data/Makefile.am	2011-11-23 17:11:29 +0000
@@ -10,17 +10,23 @@
 %.service: %.service.in
 	sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
 
+EXTRA_DIST = \
+	$(gsettings_SCHEMAS) \
+	indicator-datetime.service.in
+
+CLEANFILES = indicator-datetime.service
+
+if BUILD_CCPANEL
 pkgdata_DATA = datetime-dialog.ui
 
 @INTLTOOL_DESKTOP_RULE@
 desktopdir = $(datadir)/applications
 desktop_DATA = indicator-datetime-preferences.desktop
 
-EXTRA_DIST = \
-	$(gsettings_SCHEMAS) \
+EXTRA_DIST += \
 	datetime-dialog.ui \
 	indicator-datetime-preferences.desktop \
-	indicator-datetime-preferences.desktop.in \
-	indicator-datetime.service.in
+	indicator-datetime-preferences.desktop.in
 
-CLEANFILES = indicator-datetime-preferences.desktop indicator-datetime.service
+CLEANFILES += indicator-datetime-preferences.desktop
+endif

=== modified file 'src/Makefile.am'
--- src/Makefile.am	2011-09-06 14:25:34 +0000
+++ src/Makefile.am	2011-11-23 17:11:29 +0000
@@ -1,6 +1,8 @@
 
+if BUILD_CCPANEL
 ccpaneldir = $(CCPANELDIR)
 ccpanel_LTLIBRARIES = libindicator-datetime.la
+endif
 
 libexec_PROGRAMS = indicator-datetime-service
 
@@ -42,6 +44,7 @@
 	-module \
 	-avoid-version
 
+if BUILD_CCPANEL
 libindicator_datetime_la_SOURCES =\
 	datetime-prefs.c \
 	datetime-prefs-locations.c \
@@ -62,6 +65,7 @@
 	 $(top_builddir)/libmap/libmap.la \
 	$(PREF_LIBS)
 libindicator_datetime_la_LDFLAGS = -module -avoid-version
+endif
 
 gen-%.xml.c: %.xml
 	@echo "Building $@ from $<"

=== modified file 'src/datetime-service.c'
--- src/datetime-service.c	2011-10-13 04:30:40 +0000
+++ src/datetime-service.c	2011-11-23 17:11:29 +0000
@@ -1146,7 +1146,11 @@
 		dbusmenu_menuitem_property_set     (settings, DBUSMENU_MENUITEM_PROP_LABEL, _("Time & Date Settings…"));
 		/* insensitive until we check for available apps */
 		dbusmenu_menuitem_property_set_bool(settings, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE);
+		#ifdef HAVE_CCPANEL
 		g_signal_connect(G_OBJECT(settings), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "gnome-control-center indicator-datetime");
+	 	#else
+		g_signal_connect(G_OBJECT(settings), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "gnome-control-center datetime");
+		#endif  /* HAVE_CCPANEL */
 		dbusmenu_menuitem_child_append(root, settings);
 		g_idle_add(check_for_timeadmin, NULL);
 	}


Follow ups