all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: guix-devel@gnu.org
Subject: [PATCH 1/2] gnu: xfce4-panel: Support panel plugins from other packages
Date: Sun, 14 Dec 2014 02:34:48 -0500	[thread overview]
Message-ID: <877fxu3crr.fsf@netris.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1646 bytes --]

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



[-- Attachment #2: [PATCH 1/2] gnu: xfce4-panel: Support panel plugins from other packages --]
[-- Type: text/x-patch, Size: 7907 bytes --]

From ffc34f08feb9175c140e7ee7d9dcfef07b0cb751 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
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 =						\
   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
 
 bootstrapdir = $(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=5455
+
+Patch by Mark H Weaver <mhw@netris.org>
+
+--- xfce4-panel-4.10.0/panel/panel-module.c.orig	2012-04-28 16:31:35.000000000 -0400
++++ xfce4-panel-4.10.0/panel/panel-module.c	2014-12-14 01:31:55.728107386 -0500
+@@ -35,8 +35,14 @@
+ #include <panel/panel-plugin-external-wrapper.h>
+ #include <panel/panel-plugin-external-46.h>
+ 
+-#define PANEL_PLUGINS_LIB_DIR (LIBDIR G_DIR_SEPARATOR_S "panel" G_DIR_SEPARATOR_S "plugins")
+-#define PANEL_PLUGINS_LIB_DIR_OLD (LIBDIR G_DIR_SEPARATOR_S "panel-plugins")
++#define PANEL_PLUGINS_LIB_DIR_TAIL (G_DIR_SEPARATOR_S "panel" G_DIR_SEPARATOR_S "plugins")
++#define PANEL_PLUGINS_LIB_DIR_TAIL_OLD (G_DIR_SEPARATOR_S "panel-plugins")
++
++static const gchar *plugins_lib_dir_tails[] =
++{
++  PANEL_PLUGINS_LIB_DIR_TAIL,
++  PANEL_PLUGINS_LIB_DIR_TAIL_OLD
++};
+ 
+ 
+ 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 made",
+-                     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
+ 
+-      path = g_module_build_path (PANEL_PLUGINS_LIB_DIR, module_name);
+-      found = g_file_test (path, G_FILE_TEST_EXISTS);
++      /* search for module */
++      {
++        gchar   *dirs_string;
++        gchar  **dirs;
++        int      i, j;
++
++        dirs_string = (gchar *) g_getenv ("X_XFCE4_LIB_DIRS");
++        if (!dirs_string)
++          dirs_string = LIBDIR;
++        dirs = g_strsplit (dirs_string, G_SEARCHPATH_SEPARATOR_S, 0);
++
++        found = FALSE;
++        path = NULL;
++
++        for (i = 0; !found && dirs[i] != NULL; i++)
++          for (j = 0; !found && j < G_N_ELEMENTS (plugins_lib_dir_tails); j++)
++            {
++              gchar *dir = g_strconcat (dirs[i], plugins_lib_dir_tails[j], NULL);
++
++              g_free (path);
++              path = g_module_build_path (dir, module_name);
++              found = g_file_test (path, G_FILE_TEST_EXISTS);
++              g_free (dir);
++            }
+ 
+-      if (!found)
+-        {
+-          /* deprecated location for module plugin directories */
+-          g_free (path);
+-          path = g_module_build_path (PANEL_PLUGINS_LIB_DIR_OLD, module_name);
+-          found = g_file_test (path, G_FILE_TEST_EXISTS);
+-        }
++        g_strfreev (dirs);
++      }
+ 
+       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.439404812 -0500
+@@ -42,6 +42,11 @@
+ #define PANEL_PLUGINS_DATA_DIR     (DATADIR G_DIR_SEPARATOR_S "panel" G_DIR_SEPARATOR_S "plugins")
+ #define PANEL_PLUGINS_DATA_DIR_OLD (DATADIR G_DIR_SEPARATOR_S "panel-plugins")
+ 
++static const gchar *plugins_data_dir_tails[] =
++{
++  (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")
++};
+ 
+ 
+ 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));
+ 
++  system_data_dirs = g_get_system_data_dirs ();
++  for (i = 0; system_data_dirs[i] != NULL; i++)
++    for (j = 0; j < G_N_ELEMENTS (plugins_data_dir_tails); j++)
++    {
++      gchar *dir;
++
++      dir = 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 © 2014 Sou Bunnbu <iyzsong@gmail.com>
+;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;;
 ;;; 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
-- 
2.1.2


             reply	other threads:[~2014-12-14  7:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-14  7:34 Mark H Weaver [this message]
2014-12-14 16:46 ` [PATCH 1/2] gnu: xfce4-panel: Support panel plugins from other packages Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877fxu3crr.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.