From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark H Weaver Subject: [PATCH 1/2] gnu: xfce4-panel: Support panel plugins from other packages Date: Sun, 14 Dec 2014 02:34:48 -0500 Message-ID: <877fxu3crr.fsf@netris.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y03hv-0003Q8-V2 for guix-devel@gnu.org; Sun, 14 Dec 2014 02:35:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y03hr-0002OA-0z for guix-devel@gnu.org; Sun, 14 Dec 2014 02:35:11 -0500 Received: from world.peace.net ([50.252.239.5]:36490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y03hq-000256-R7 for guix-devel@gnu.org; Sun, 14 Dec 2014 02:35:06 -0500 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org --=-=-= Content-Type: text/plain Hi Guix, Currently, xfce4-panel looks for plugins only in its own /gnu/store directory, so it is not possible to add extra panel plugins or even to use the trash plugin that comes with thunar (xfce's file manager). In the past, xfce4-panel had a way to configure paths for per-user plugin directories, but later this was changed to use only compile-time constant paths, for reasons described here: https://bugzilla.xfce.org/show_bug.cgi?id=5455 Nix's current solution is simply to change the compile-time constant paths to /run/current-system/sw/..., which I found unsatisfying. http://lists.science.uu.nl/pipermail/nix-dev/2012-October/009956.html The following patch modifies xfce4-panel to search for panel plugins in directories specified by the XDG_DATA_DIRS and X_XFCE4_LIB_DIRS environment variables. That latter name is my own invention, and I've waffled a bit on what to call it and how much of the pathname prefixes it should contain. Here's how I configure these variables in my ~/.bash_profile: --8<---------------cut here---------------start------------->8--- export XDG_DATA_DIRS=$HOME/.guix-profile/share:/run/current-system/profile/share export XDG_CONFIG_DIRS=$HOME/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg export X_XFCE4_LIB_DIRS=$HOME/.guix-profile/lib/xfce4:/run/current-system/profile/lib/xfce4 --8<---------------cut here---------------end--------------->8--- Anyway, here's the patch. It's what I needed to make the second patch work (packaging xfce4-battery-plugin), which was my original goal here. I'll post that patch in another message. Comments and suggestions welcome. Mark --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-gnu-xfce4-panel-Support-panel-plugins-from-other-pac.patch Content-Transfer-Encoding: quoted-printable Content-Description: [PATCH 1/2] gnu: xfce4-panel: Support panel plugins from other packages >From ffc34f08feb9175c140e7ee7d9dcfef07b0cb751 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sat, 13 Dec 2014 20:50:00 -0500 Subject: [PATCH 1/2] gnu: xfce4-panel: Support panel plugins from other packages. * gnu/packages/patches/xfce4-panel-plugins.patch: New file. * gnu-system.am (dist_patch_DATA): Add it. * gnu/packages/xfce.scm (xfce4-panel): Add the patch, and a native search path specification for X_XFCE4_LIB_DIRS. --- gnu-system.am | 1 + gnu/packages/patches/xfce4-panel-plugins.patch | 115 +++++++++++++++++++++= ++++ gnu/packages/xfce.scm | 12 ++- 3 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/xfce4-panel-plugins.patch diff --git a/gnu-system.am b/gnu-system.am index e828c01..08b1ecd 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -451,6 +451,7 @@ dist_patch_DATA =3D \ gnu/packages/patches/wmctrl-64-fix.patch \ gnu/packages/patches/xf86-input-synaptics-glibc-2.20.patch \ gnu/packages/patches/xf86-video-openchrome-includes.patch \ + gnu/packages/patches/xfce4-panel-plugins.patch \ gnu/packages/patches/xmodmap-asprintf.patch =20 bootstrapdir =3D $(guilemoduledir)/gnu/packages/bootstrap diff --git a/gnu/packages/patches/xfce4-panel-plugins.patch b/gnu/packages/= patches/xfce4-panel-plugins.patch new file mode 100644 index 0000000..df5a0a9 --- /dev/null +++ b/gnu/packages/patches/xfce4-panel-plugins.patch @@ -0,0 +1,115 @@ +Search for xfce4 panel plugins in the directories specified +in XDG_DATA_DIRS and X_XFCE4_LIB_DIRS. For discussion of the +relevant issues, see: + + https://bugzilla.xfce.org/show_bug.cgi?id=3D5455 + +Patch by Mark H Weaver + +--- xfce4-panel-4.10.0/panel/panel-module.c.orig 2012-04-28 16:31:35.00000= 0000 -0400 ++++ xfce4-panel-4.10.0/panel/panel-module.c 2014-12-14 01:31:55.728107386 = -0500 +@@ -35,8 +35,14 @@ + #include + #include +=20 +-#define PANEL_PLUGINS_LIB_DIR (LIBDIR G_DIR_SEPARATOR_S "panel" G_DIR_SEP= ARATOR_S "plugins") +-#define PANEL_PLUGINS_LIB_DIR_OLD (LIBDIR G_DIR_SEPARATOR_S "panel-plugin= s") ++#define PANEL_PLUGINS_LIB_DIR_TAIL (G_DIR_SEPARATOR_S "panel" G_DIR_SEPAR= ATOR_S "plugins") ++#define PANEL_PLUGINS_LIB_DIR_TAIL_OLD (G_DIR_SEPARATOR_S "panel-plugins") ++ ++static const gchar *plugins_lib_dir_tails[] =3D ++{ ++ PANEL_PLUGINS_LIB_DIR_TAIL, ++ PANEL_PLUGINS_LIB_DIR_TAIL_OLD ++}; +=20 +=20 + typedef enum _PanelModuleRunMode PanelModuleRunMode; +@@ -335,21 +341,39 @@ + /* show a messsage if the old module path key still exists */ + g_message ("Plugin %s: The \"X-XFCE-Module-Path\" key is " + "ignored in \"%s\", the panel will look for the " +- "module in %s. See bug #5455 why this decision was m= ade", +- name, filename, PANEL_PLUGINS_LIB_DIR); ++ "module in DIR%s for each DIR in $X_XFCE4_LIB_DIRS " ++ "(%s by default). See bug #5455 for discussion.", ++ name, filename, PANEL_PLUGINS_LIB_DIR_TAIL, LIBDIR); + } + #endif +=20 +- path =3D g_module_build_path (PANEL_PLUGINS_LIB_DIR, module_name); +- found =3D g_file_test (path, G_FILE_TEST_EXISTS); ++ /* search for module */ ++ { ++ gchar *dirs_string; ++ gchar **dirs; ++ int i, j; ++ ++ dirs_string =3D (gchar *) g_getenv ("X_XFCE4_LIB_DIRS"); ++ if (!dirs_string) ++ dirs_string =3D LIBDIR; ++ dirs =3D g_strsplit (dirs_string, G_SEARCHPATH_SEPARATOR_S, 0); ++ ++ found =3D FALSE; ++ path =3D NULL; ++ ++ for (i =3D 0; !found && dirs[i] !=3D NULL; i++) ++ for (j =3D 0; !found && j < G_N_ELEMENTS (plugins_lib_dir_tails= ); j++) ++ { ++ gchar *dir =3D g_strconcat (dirs[i], plugins_lib_dir_tails[= j], NULL); ++ ++ g_free (path); ++ path =3D g_module_build_path (dir, module_name); ++ found =3D g_file_test (path, G_FILE_TEST_EXISTS); ++ g_free (dir); ++ } +=20 +- if (!found) +- { +- /* deprecated location for module plugin directories */ +- g_free (path); +- path =3D g_module_build_path (PANEL_PLUGINS_LIB_DIR_OLD, module= _name); +- found =3D g_file_test (path, G_FILE_TEST_EXISTS); +- } ++ g_strfreev (dirs); ++ } +=20 + if (G_LIKELY (found)) + { +--- xfce4-panel-4.10.0/panel/panel-module-factory.c.orig 2012-04-28 16:31:= 35.000000000 -0400 ++++ xfce4-panel-4.10.0/panel/panel-module-factory.c 2014-12-13 23:55:27.43= 9404812 -0500 +@@ -42,6 +42,11 @@ + #define PANEL_PLUGINS_DATA_DIR (DATADIR G_DIR_SEPARATOR_S "panel" G_D= IR_SEPARATOR_S "plugins") + #define PANEL_PLUGINS_DATA_DIR_OLD (DATADIR G_DIR_SEPARATOR_S "panel-plug= ins") +=20 ++static const gchar *plugins_data_dir_tails[] =3D ++{ ++ (G_DIR_SEPARATOR_S "xfce4" G_DIR_SEPARATOR_S "panel" G_DIR_SEPARATOR_S = "plugins"), ++ (G_DIR_SEPARATOR_S "xfce4" G_DIR_SEPARATOR_S "panel-plugins") ++}; +=20 +=20 + static void panel_module_factory_finalize (GObject = *object); +@@ -223,8 +228,22 @@ + panel_module_factory_load_modules (PanelModuleFactory *factory, + gboolean warn_if_known) + { ++ const gchar * const * system_data_dirs; ++ int i, j; ++ + panel_return_if_fail (PANEL_IS_MODULE_FACTORY (factory)); +=20 ++ system_data_dirs =3D g_get_system_data_dirs (); ++ for (i =3D 0; system_data_dirs[i] !=3D NULL; i++) ++ for (j =3D 0; j < G_N_ELEMENTS (plugins_data_dir_tails); j++) ++ { ++ gchar *dir; ++ ++ dir =3D g_strconcat (system_data_dirs[i], plugins_data_dir_tails[j]= , NULL); ++ panel_module_factory_load_modules_dir (factory, dir, warn_if_known); ++ g_free (dir); ++ } ++ + /* load from the new and old location */ + panel_module_factory_load_modules_dir (factory, PANEL_PLUGINS_DATA_DIR,= warn_if_known); + panel_module_factory_load_modules_dir (factory, PANEL_PLUGINS_DATA_DIR_= OLD, warn_if_known); diff --git a/gnu/packages/xfce.scm b/gnu/packages/xfce.scm index 69776fc..b23ac79 100644 --- a/gnu/packages/xfce.scm +++ b/gnu/packages/xfce.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2014 Sou Bunnbu +;;; Copyright =C2=A9 2014 Mark H Weaver ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,7 @@ #:use-module (guix download) #:use-module (guix utils) #:use-module (guix build-system gnu) + #:use-module (gnu packages) #:use-module (gnu packages pkg-config) #:use-module (gnu packages glib) #:use-module (gnu packages gtk) @@ -249,7 +251,8 @@ management D-Bus specification.") "/src/" name "-" version ".tar.bz2")) (sha256 (base32 - "1f8903nx6ivzircl8d8s9zna4vjgfy0qhjk5d2x19g9bmycgj89k")))) + "1f8903nx6ivzircl8d8s9zna4vjgfy0qhjk5d2x19g9bmycgj89k")) + (patches (list (search-patch "xfce4-panel-plugins.patch"))))) (build-system gnu-build-system) (native-inputs `(("pkg-config" ,pkg-config) @@ -261,6 +264,13 @@ management D-Bus specification.") ("garcon", garcon) ("libwnck" ,libwnck-1) ("libxfce4ui" ,libxfce4ui))) + + ;; XXX This probably belongs somewhere else. + (native-search-paths + (list (search-path-specification + (variable "X_XFCE4_LIB_DIRS") + (directories '("lib/xfce4"))))) + (home-page "http://www.xfce.org/") (synopsis "Xfce desktop panel") (description --=20 2.1.2 --=-=-=--