From e83d06386d0bb69de97a61a1b85ab37824b72cdb Mon Sep 17 00:00:00 2001 From: PERIER Romain Date: Mon, 13 Apr 2009 19:36:47 +0200 Subject: [PATCH] gconf-editor: Fixed static PolicyKit support and added policykit USE flag to the ebuild --- gnome-extra/gconf-editor/Manifest | 3 +- .../gconf-editor-2.26.0-optional-policykit.patch | 237 ++++++++++++++++++++ .../gconf-editor/gconf-editor-2.26.0.ebuild | 15 +- 3 files changed, 250 insertions(+), 5 deletions(-) create mode 100644 gnome-extra/gconf-editor/files/gconf-editor-2.26.0-optional-policykit.patch diff --git a/gnome-extra/gconf-editor/Manifest b/gnome-extra/gconf-editor/Manifest index 804df40..b0ade86 100644 --- a/gnome-extra/gconf-editor/Manifest +++ b/gnome-extra/gconf-editor/Manifest @@ -1,2 +1,3 @@ +AUX gconf-editor-2.26.0-optional-policykit.patch 8494 RMD160 dede64e81b4a9d9b268b6a60a0773766850354b0 SHA1 3d516d7daab043a10c23e913ce205fc286e7bd04 SHA256 6015e37b7d7818c4b033525e2643abd78b9597d9b4958b5d2a1736a539ae86ba DIST gconf-editor-2.26.0.tar.bz2 1262213 RMD160 ef5a446bb99617208d2f6de374f9d2c764a29bc9 SHA1 8b0369a747394f2ee0bec225dab561477b1531c6 SHA256 2801ff7d595039292850d4f7d87b3f7c950e92dbcb39facfe62c6fb184640e1f -EBUILD gconf-editor-2.26.0.ebuild 844 RMD160 1e593859947f136912c168ea3dcf4a0355130346 SHA1 272a15c3c183e0486e2e694ed04b16f83b7039c0 SHA256 77062b56e61be85cf1f3addb78ab6e2007b14c12f2b5e8a320908a964a433303 +EBUILD gconf-editor-2.26.0.ebuild 1026 RMD160 1d19527a8903fcc679c189647b9b1e7bab759db3 SHA1 fd61856de217c254937b0e858fa4d7879fd09816 SHA256 ad900d866cdd58280dd883e33a68f3eae1021a79ac3cd7d9cd1164a1eb74b5a5 diff --git a/gnome-extra/gconf-editor/files/gconf-editor-2.26.0-optional-policykit.patch b/gnome-extra/gconf-editor/files/gconf-editor-2.26.0-optional-policykit.patch new file mode 100644 index 0000000..7dbe813 --- /dev/null +++ b/gnome-extra/gconf-editor/files/gconf-editor-2.26.0-optional-policykit.patch @@ -0,0 +1,237 @@ + configure.in | 18 +++++++++++- + src/Makefile.am | 9 ++++-- + src/gconf-editor-window.c | 62 +++++++++++++++++++++++++++++++++++--------- + 3 files changed, 71 insertions(+), 18 deletions(-) + +diff --git a/configure.in b/configure.in +index 671fa15..5bf3948 100644 +--- a/configure.in ++++ b/configure.in +@@ -55,6 +55,19 @@ GNOME_COMMON_INIT + GNOME_COMPILE_WARNINGS([maximum]) + GNOME_MAINTAINER_MODE_DEFINES + ++dnl Enable or not the policykit support ++AC_ARG_WITH([policykit], ++ AC_HELP_STRING([--with-policykit], ++ [Compile with policykit support @<:@default=yes@:>@]), ++ [with_polkit=$withval], ++ [with_polkit=yes]) ++ ++if test x$with_polkit = xyes; then ++ AC_DEFINE([HAVE_POLICYKIT], 1, [PolicyKit support is required]) ++fi ++ ++AM_CONDITIONAL([HAVE_POLICYKIT], [test x$with_polkit = xyes]) ++ + dnl Get the GConf defaults source, and sed it to make the mandatory source. + GCONF_DEFAULTS_SOURCE=`gconftool-2 --get-default-source` + AC_ARG_WITH(gconf-defaults-source, +@@ -86,5 +99,6 @@ AC_OUTPUT + + echo " + Configuration Sources: +-GConf default values source: ${GCONF_DEFAULTS_SOURCE} +-GConf mandatory values source: ${GCONF_MANDATORY_SOURCE}" ++GConf default values source: ${GCONF_DEFAULTS_SOURCE} ++GConf mandatory values source: ${GCONF_MANDATORY_SOURCE} ++PolicyKit support: ${with_polkit}" +diff --git a/src/Makefile.am b/src/Makefile.am +index ae5cef3..4d240dc 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -10,7 +10,7 @@ bin_PROGRAMS = gconf-editor + gconf_editor_built_headers = gconf-marshal.h + gconf_editor_built_cfiles = gconf-marshal.c + +-gconf_editor_SOURCES = \ ++gconf_editor_SOURCES = \ + gconf-bookmarks.c \ + gconf-bookmarks.h \ + gconf-bookmarks-dialog.c \ +@@ -33,8 +33,6 @@ gconf_editor_SOURCES = \ + gconf-util.h \ + gedit-output-window.c \ + gedit-output-window.h \ +- gconf-policykit.c \ +- gconf-policykit.h \ + gconf-search.h \ + gconf-search.c \ + gconf-search-dialog.h \ +@@ -43,6 +41,11 @@ gconf_editor_SOURCES = \ + $(gconf_editor_built_headers) \ + $(gconf_editor_built_cfiles) + ++if HAVE_POLICYKIT ++gconf_editor_SOURCES += gconf-policykit.h \ ++ gconf-policykit.c ++endif ++ + ## we just punt on built sources, and check them into svn, manually updating + ## when required. + regenerate-built-sources: +diff --git a/src/gconf-editor-window.c b/src/gconf-editor-window.c +index 0c6094b..74e3795 100644 +--- a/src/gconf-editor-window.c ++++ b/src/gconf-editor-window.c +@@ -27,7 +27,9 @@ + #include "gconf-cell-renderer.h" + #include "gconf-editor-application.h" + #include "gconf-key-editor.h" +-#include "gconf-policykit.h" ++#ifdef HAVE_POLICYKIT ++# include "gconf-policykit.h" ++#endif + #include "gconf-stock-icons.h" + #include "gconf-util.h" + #include "gedit-output-window.h" +@@ -640,26 +642,34 @@ gconf_editor_window_row_expanded (GtkTreeView *tree_view, + gdk_display_flush (gtk_widget_get_display (GTK_WIDGET (gconfwindow))); + } + ++#ifdef HAVE_POLICYKIT ++/* QA Warning: Only used with policykit support , ++ so avoiding ' defined but not used' warning ++*/ + static void + gconf_editor_popup_policykit_callback (GtkWindow *window, GError *error) + { + if (error) + gconf_editor_window_popup_error_dialog (window, _("Could not set value. Error was:\n%s"), error); + } ++#endif + + static void + gconf_editor_popup_window_set_as_default (GtkAction *action, GtkWidget *callback_data) + { + GConfEditorWindow *gconfwindow = GCONF_EDITOR_WINDOW (callback_data); +- GtkWindow *window = GTK_WINDOW (callback_data); + + GtkTreeIter iter; + GConfValue *value; + char *path = NULL; ++ ++#ifdef HAVE_POLICYKIT ++ /* QA Warning: unsed variable if policykit is disable */ ++ GtkWindow *window = GTK_WINDOW (callback_data); + gboolean can_use_pk; + + can_use_pk = (gconfwindow->type == GCONF_EDITOR_WINDOW_TYPE_NORMAL); +- ++#endif + gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (gconfwindow->list_view)), + NULL, &iter); + gtk_tree_model_get (gconfwindow->sorted_list_model, &iter, +@@ -680,12 +690,13 @@ gconf_editor_popup_window_set_as_default (GtkAction *action, GtkWidget *callback + + if (!error) + return; +- ++#ifdef HAVE_POLICYKIT + if (!can_use_pk) + gconf_editor_window_popup_error_dialog (window, _("Could not sync value. Error was:\n%s"), error); ++#endif + } + } +- ++#ifdef HAVE_POLICYKIT + if (can_use_pk) { + gconf_client_suggest_sync (gconfwindow->client, NULL); + gconf_pk_set_default_async (path, +@@ -693,21 +704,24 @@ gconf_editor_popup_window_set_as_default (GtkAction *action, GtkWidget *callback + (GFunc) gconf_editor_popup_policykit_callback, + g_object_ref (window), g_object_unref); + } ++#endif + } + + static void + gconf_editor_popup_window_set_as_mandatory (GtkAction *action, GtkWidget *callback_data) + { + GConfEditorWindow *gconfwindow = GCONF_EDITOR_WINDOW (callback_data); +- GtkWindow *window = GTK_WINDOW (callback_data); + + GtkTreeIter iter; + GConfValue *value; + char *path = NULL; ++#ifdef HAVE_POLICYKIT ++ /* QA Warning */ ++ GtkWindow *window = GTK_WINDOW (callback_data); + gboolean can_use_pk; + + can_use_pk = (gconfwindow->type == GCONF_EDITOR_WINDOW_TYPE_NORMAL); +- ++#endif + gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (gconfwindow->list_view)), + NULL, &iter); + gtk_tree_model_get (gconfwindow->sorted_list_model, &iter, +@@ -728,12 +742,13 @@ gconf_editor_popup_window_set_as_mandatory (GtkAction *action, GtkWidget *callba + + if (!error) + return; +- ++#ifdef HAVE_POLICYKIT + if (!can_use_pk) + gconf_editor_window_popup_error_dialog (window, _("Could not sync value. Error was:\n%s"), error); ++#endif + } + } +- ++#ifdef HAVE_POLICYKIT + if (can_use_pk) { + gconf_client_suggest_sync (gconfwindow->client, NULL); + gconf_pk_set_mandatory_async (path, +@@ -741,6 +756,7 @@ gconf_editor_popup_window_set_as_mandatory (GtkAction *action, GtkWidget *callba + (GFunc) gconf_editor_popup_policykit_callback, + g_object_ref (window), g_object_unref); + } ++#endif + } + + static GtkActionEntry entries[] = { +@@ -934,10 +950,20 @@ list_view_button_press_event (GtkTreeView *tree_view, GdkEventButton *event, GCo + window->type != GCONF_EDITOR_WINDOW_TYPE_DEFAULTS); + gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->ui_manager, "/GConfKeyPopupMenu/DefaultKey"), + (gconf_util_can_edit_defaults () && window->type != GCONF_EDITOR_WINDOW_TYPE_DEFAULTS) || +- (gconf_pk_can_set_default () && window->type == GCONF_EDITOR_WINDOW_TYPE_NORMAL)); ++#ifdef HAVE_POLICYKIT ++ (gconf_pk_can_set_default () && ++#else ++ ( ++#endif ++ window->type == GCONF_EDITOR_WINDOW_TYPE_NORMAL)); + gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->ui_manager, "/GConfKeyPopupMenu/MandatoryKey"), + (gconf_util_can_edit_mandatory () && window->type != GCONF_EDITOR_WINDOW_TYPE_MANDATORY) || +- (gconf_pk_can_set_mandatory () && window->type == GCONF_EDITOR_WINDOW_TYPE_NORMAL)); ++#ifdef HAVE_POLICYKIT ++ (gconf_pk_can_set_mandatory () && ++#else ++ ( ++#endif ++window->type == GCONF_EDITOR_WINDOW_TYPE_NORMAL)); + + gtk_tree_path_free (path); + } +@@ -1037,10 +1063,20 @@ gconf_editor_window_list_view_popup_menu (GtkWidget *widget, GConfEditorWindow * + window->type != GCONF_EDITOR_WINDOW_TYPE_DEFAULTS); + gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->ui_manager, "/GConfKeyPopupMenu/DefaultKey"), + (gconf_util_can_edit_defaults () && window->type != GCONF_EDITOR_WINDOW_TYPE_DEFAULTS) || +- (gconf_pk_can_set_default () && window->type == GCONF_EDITOR_WINDOW_TYPE_NORMAL)); ++#ifdef HAVE_POLICYKIT ++ (gconf_pk_can_set_default () && ++#else ++ ( ++#endif ++window->type == GCONF_EDITOR_WINDOW_TYPE_NORMAL)); + gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->ui_manager, "/GConfKeyPopupMenu/MandatoryKey"), + (gconf_util_can_edit_mandatory () && window->type != GCONF_EDITOR_WINDOW_TYPE_MANDATORY) || +- (gconf_pk_can_set_mandatory () && window->type == GCONF_EDITOR_WINDOW_TYPE_NORMAL)); ++#ifdef HAVE_POLICYKIT ++ (gconf_pk_can_set_mandatory () && ++#else ++ ( ++#endif ++window->type == GCONF_EDITOR_WINDOW_TYPE_NORMAL)); + + } + else { diff --git a/gnome-extra/gconf-editor/gconf-editor-2.26.0.ebuild b/gnome-extra/gconf-editor/gconf-editor-2.26.0.ebuild index 9d6049c..a22a1e0 100644 --- a/gnome-extra/gconf-editor/gconf-editor-2.26.0.ebuild +++ b/gnome-extra/gconf-editor/gconf-editor-2.26.0.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/gnome-extra/gconf-editor/gconf-editor-2.24.1.ebuild,v 1.2 2009/01/29 22:44:19 eva Exp $ -inherit gnome2 +inherit eutils gnome2 autotools DESCRIPTION="An editor to the GNOME 2 config system" HOMEPAGE="http://www.gnome.org/" @@ -10,11 +10,11 @@ HOMEPAGE="http://www.gnome.org/" LICENSE="GPL-2" SLOT="0" KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd" -IUSE="test" +IUSE="policykit test" RDEPEND=">=x11-libs/gtk+-2.6 >=gnome-base/gconf-2.12.0 - >=sys-auth/policykit-0.7 + policykit? ( >=sys-auth/policykit-0.7 ) >=dev-libs/dbus-glib-0.71" DEPEND="${RDEPEND} app-text/scrollkeeper @@ -27,5 +27,12 @@ DEPEND="${RDEPEND} DOCS="AUTHORS ChangeLog NEWS README" pkg_setup() { - G2CONF="${G2CONF} --disable-scrollkeeper" + G2CONF="${G2CONF} --disable-scrollkeeper $(use_with policykit)" +} + +src_unpack() { + gnome2_src_unpack + + epatch "${FILESDIR}/${P}-optional-policykit.patch" + eautoreconf } -- 1.6.2.3