Hello community,

here is the log from the commit of package gnome-panel for openSUSE:Factory
checked in at Thu Oct 13 12:21:59 CEST 2011.



--------
--- openSUSE:Factory/gnome-panel/gnome-panel.changes    2011-10-02 
10:07:09.000000000 +0200
+++ gnome-panel/gnome-panel.changes     2011-10-11 18:36:16.000000000 +0200
@@ -1,0 +2,7 @@
+Tue Oct 11 15:34:27 UTC 2011 - vu...@opensuse.org
+
+- Add gnome-panel-improved-default-layout-handling.patch: improve
+  the default layout handling. This enables us to add a launcher
+  for the installer easily in the live session (bnc#702671).
+
+-------------------------------------------------------------------

calling whatdependson for head-i586


New:
----
  gnome-panel-improved-default-layout-handling.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ gnome-panel.spec ++++++
--- /var/tmp/diff_new_pack.c4qIuJ/_old  2011-10-13 12:21:54.000000000 +0200
+++ /var/tmp/diff_new_pack.c4qIuJ/_new  2011-10-13 12:21:54.000000000 +0200
@@ -27,6 +27,8 @@
 Group:          System/GUI/GNOME
 Source:         
http://download.gnome.org/sources/gnome-panel/3.2/%{name}-%{version}.tar.bz2
 Source99:       baselibs.conf
+# PATCH-FEATURE-UPSTREAM gnome-panel-improved-default-layout-handling.patch 
vu...@opensuse.org -- Improve default layout handling, so that we can load it 
from the user dir
+Patch0:         gnome-panel-improved-default-layout-handling.patch
 # PATCH-FIX-UPSTREAM gnome-panel-recent-check-exists.patch -- Show an error 
when clicking on a recent item that doesn't exist anymore
 Patch25:        gnome-panel-recent-check-exists.patch
 # PATCH-FIX-UPSTREAM gnome-panel-beagle-search.patch bgo336726 -- Use nautilus 
search instead of gnome-search-tool
@@ -193,6 +195,7 @@
 %setup -q
 translation-update-upstream
 gnome-patch-translation-prepare
+%patch0 -p1
 %patch25 -p0
 %patch34
 %patch40

++++++ gnome-panel-improved-default-layout-handling.patch ++++++
>From 317d4a21dd28081a93e955a2e4a94f192231f7c8 Mon Sep 17 00:00:00 2001
From: Vincent Untz <vu...@gnome.org>
Date: Tue, 11 Oct 2011 16:35:11 +0200
Subject: [PATCH 1/5] panel: Add helper API to write directly to dconf

This will be used for initial setup of panel, for GSettings keys
applying to a specific path, while we don't really have the schema yet.
---
 gnome-panel/libpanel-util/panel-dconf.c |   16 ++++++++++++++++
 gnome-panel/libpanel-util/panel-dconf.h |    4 ++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/gnome-panel/libpanel-util/panel-dconf.c 
b/gnome-panel/libpanel-util/panel-dconf.c
index 63a1c48..6d09dd6 100644
--- a/gnome-panel/libpanel-util/panel-dconf.c
+++ b/gnome-panel/libpanel-util/panel-dconf.c
@@ -36,6 +36,22 @@ panel_dconf_client_get (void)
 }
 
 gboolean
+panel_dconf_write_sync (const gchar  *key,
+                        GVariant     *value,
+                        GError      **error)
+{
+        gboolean     ret;
+        DConfClient *client = panel_dconf_client_get ();
+
+        ret = dconf_client_write (client, key, value,
+                                  NULL, NULL, error);
+
+        g_object_unref (client);
+
+        return ret;
+}
+
+gboolean
 panel_dconf_recursive_reset (const gchar  *dir,
                              GError      **error)
 {
diff --git a/gnome-panel/libpanel-util/panel-dconf.h 
b/gnome-panel/libpanel-util/panel-dconf.h
index 0cf8b35..e4ef1e4 100644
--- a/gnome-panel/libpanel-util/panel-dconf.h
+++ b/gnome-panel/libpanel-util/panel-dconf.h
@@ -29,6 +29,10 @@
 
 G_BEGIN_DECLS
 
+gboolean panel_dconf_write_sync (const gchar  *key,
+                                 GVariant     *value,
+                                 GError      **error);
+
 gboolean panel_dconf_recursive_reset (const gchar  *dir,
                                       GError     **error);
 
-- 
1.7.7


>From 8fecde1a4067f9177aea611c9b73f543096d7b6e Mon Sep 17 00:00:00 2001
From: Vincent Untz <vu...@gnome.org>
Date: Tue, 11 Oct 2011 16:36:15 +0200
Subject: [PATCH 2/5] panel: Support instance configuration of objects in
 default layout

It's now possible to change some settings of the objects in the default
layout. For instance, for a launcher, we would add this to the group of
the launcher in the default layout file to set the .desktop file being
used:

@instance-config/location="foo.desktop"

Syntax is:
 - @instance-config/ prefix
 - value of the key is a GVariant-parsable string
---
 gnome-panel/panel-layout.c |   98 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 98 insertions(+), 0 deletions(-)

diff --git a/gnome-panel/panel-layout.c b/gnome-panel/panel-layout.c
index d52a6a0..4045c4c 100644
--- a/gnome-panel/panel-layout.c
+++ b/gnome-panel/panel-layout.c
@@ -48,6 +48,7 @@ static GSettings *layout_settings = NULL;
 
 #define PANEL_LAYOUT_ERROR panel_layout_error_quark ()
 #define PANEL_LAYOUT_OBJECT_GCONF_PATH_TEMPLATE "/apps/panel3-applets/%s"
+#define PANEL_LAYOUT_INSTANCE_CONFIG_SUBPATH "@instance-config/"
 
 static void panel_layout_load_toplevel    (const char *toplevel_id);
 static void panel_layout_load_object      (const char *object_id);
@@ -277,6 +278,81 @@ panel_layout_find_free_id (const char *id_list_key,
 }
 
 static gboolean
+panel_layout_maybe_append_object_instance_config (GKeyFile    *keyfile,
+                                                  const char  *group,
+                                                  const char  *key,
+                                                  const char  *path_prefix,
+                                                  const char  *unique_id,
+                                                  gboolean     dry_run,
+                                                  gboolean    *key_handled,
+                                                  GError     **error)
+{
+        char       *value_str;
+        const char *keyname;
+        GVariant   *variant;
+
+        *key_handled = FALSE;
+
+        if (!g_str_has_prefix(key, PANEL_LAYOUT_INSTANCE_CONFIG_SUBPATH))
+                return TRUE;
+
+        *key_handled = TRUE;
+
+        value_str = g_key_file_get_string (
+                                keyfile,
+                                group, key,
+                                error);
+        if (!value_str)
+                return FALSE;
+
+        variant = g_variant_parse (NULL, value_str,
+                                   NULL, NULL, error);
+
+        if (!variant) {
+                g_free (value_str);
+                return FALSE;
+        }
+
+        keyname = key + strlen (PANEL_LAYOUT_INSTANCE_CONFIG_SUBPATH);
+
+        if (dry_run) {
+                /* the key can actually be in a subdirectory
+                 * like instance-config/foo/key, so we split
+                 * the tokens to validate all of them */
+                char **tokens;
+                char **token;
+
+                tokens = g_strsplit (keyname, "/", -1);
+
+                for (token = tokens; *token; token++) {
+                        if (!panel_gsettings_is_valid_keyname (*token,
+                                                               error)) {
+                                g_strfreev (tokens);
+                                g_variant_unref (variant);
+                                g_free (value_str);
+                                return FALSE;
+                        }
+                }
+
+                g_strfreev (tokens);
+        } else {
+                char *key;
+
+                key = g_strdup_printf ("%s%s/%s%s",
+                                       path_prefix, unique_id,
+                                       PANEL_LAYOUT_OBJECT_CONFIG_SUFFIX,
+                                       keyname);
+                panel_dconf_write_sync (key, variant, NULL);
+                g_free (key);
+        }
+
+        g_variant_unref (variant);
+        g_free (value_str);
+
+        return TRUE;
+}
+
+static gboolean
 panel_layout_append_group_helper (GKeyFile                  *keyfile,
                                   const char                *group,
                                   int                        set_screen_to,
@@ -292,6 +368,7 @@ panel_layout_append_group_helper (GKeyFile                  
*keyfile,
                                   const char                
*type_for_error_message)
 {
         gboolean    retval = FALSE;
+        gboolean    appending_object;
         const char *id;
         char       *unique_id = NULL;
         char       *path = NULL;
@@ -304,6 +381,8 @@ panel_layout_append_group_helper (GKeyFile                  
*keyfile,
 
         g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
+        appending_object = (g_strcmp0 (schema, PANEL_OBJECT_SCHEMA) == 0);
+
         /* Try to extract an id from the group, by stripping the prefix,
          * and create a unique id out of that */
         id = group + strlen (group_prefix);
@@ -339,6 +418,25 @@ panel_layout_append_group_helper (GKeyFile                 
 *keyfile,
         for (i = 0; keyfile_keys[i] != NULL; i++) {
                 gboolean found = FALSE;
 
+                /* special case keys of the instance config of an object */
+                if (appending_object) {
+                        gboolean handled;
+
+                        if (!panel_layout_maybe_append_object_instance_config (
+                                                        keyfile,
+                                                        group,
+                                                        keyfile_keys[i],
+                                                        path_prefix,
+                                                        unique_id,
+                                                        dry_run,
+                                                        &handled,
+                                                        error))
+                                goto out;
+
+                        if (handled)
+                                continue;
+                }
+
                 for (j = 0; j < key_definitions_len; j++) {
                         if (g_strcmp0 (keyfile_keys[i],
                                        key_definitions[j].name) == 0) {
-- 
1.7.7


>From 077891cdfae7f0b247c1285de22d753d966712be Mon Sep 17 00:00:00 2001
From: Vincent Untz <vu...@gnome.org>
Date: Tue, 11 Oct 2011 16:41:34 +0200
Subject: [PATCH 3/5] panel: Do not assert on error when using default layout

Asserting is wrong: the default layout could be badly formatted, and in
that case we should not abort but fail with a nice error. It turns out
we already had the code for that, except that we never reached it since
we asserted before :-)
---
 gnome-panel/panel-layout.c |   15 +++++----------
 gnome-panel/panel-layout.h |    3 +--
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/gnome-panel/panel-layout.c b/gnome-panel/panel-layout.c
index 4045c4c..596d97f 100644
--- a/gnome-panel/panel-layout.c
+++ b/gnome-panel/panel-layout.c
@@ -571,8 +571,7 @@ panel_layout_append_group (GKeyFile    *keyfile,
 
 static void
 panel_layout_append_from_file_real (const char *layout_file,
-                                    int         screen_for_toplevels,
-                                    gboolean    error_fatal)
+                                    int         screen_for_toplevels)
 {
         GError    *error = NULL;
         GKeyFile  *keyfile = NULL;
@@ -620,9 +619,6 @@ out:
                 g_printerr ("Error while parsing default layout from '%s': 
%s\n",
                             layout_file, error->message);
                 g_error_free (error);
-
-                if (error_fatal)
-                        g_assert_not_reached ();
         }
 
         if (groups)
@@ -638,14 +634,13 @@ panel_layout_append_from_file_for_screen (const char 
*layout_file,
 {
         int screen_n = gdk_screen_get_number (screen);
 
-        panel_layout_append_from_file_real (layout_file, screen_n, FALSE);
+        panel_layout_append_from_file_real (layout_file, screen_n);
 }
 
 void
-panel_layout_append_from_file (const char *layout_file,
-                               gboolean    error_fatal)
+panel_layout_append_from_file (const char *layout_file)
 {
-        panel_layout_append_from_file_real (layout_file, -1, error_fatal);
+        panel_layout_append_from_file_real (layout_file, -1);
 }
 
 
@@ -1193,7 +1188,7 @@ panel_layout_load (void)
                 }
 
                 default_layout_file = panel_layout_get_default_layout_file ();
-                panel_layout_append_from_file (default_layout_file, TRUE);
+                panel_layout_append_from_file (default_layout_file);
                 g_free (default_layout_file);
 
                 toplevels = g_settings_get_strv (layout_settings,
diff --git a/gnome-panel/panel-layout.h b/gnome-panel/panel-layout.h
index 70ba81e..455be3a 100644
--- a/gnome-panel/panel-layout.h
+++ b/gnome-panel/panel-layout.h
@@ -32,8 +32,7 @@
 
 G_BEGIN_DECLS
 
-void panel_layout_append_from_file (const char *layout_file,
-                                    gboolean    error_fatal);
+void panel_layout_append_from_file (const char *layout_file);
 
 gboolean panel_layout_load         (void);
 
-- 
1.7.7


>From 464c8666f20e885b22f255884580746aa8339b18 Mon Sep 17 00:00:00 2001
From: Vincent Untz <vu...@gnome.org>
Date: Tue, 11 Oct 2011 17:24:00 +0200
Subject: [PATCH 4/5] panel: Add helper API to get file in the user config
 directory for panel

This just returns ~/.config/gnome-panel/$foo (with $foo optional, and
respecting $XDG_CONFIG_HOME).
---
 gnome-panel/panel-util.c |   10 ++++++++--
 gnome-panel/panel-util.h |    2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gnome-panel/panel-util.c b/gnome-panel/panel-util.c
index d8b08ad..1172af4 100644
--- a/gnome-panel/panel-util.c
+++ b/gnome-panel/panel-util.c
@@ -333,11 +333,17 @@ panel_load_icon (GtkIconTheme  *icon_theme,
        return retval;
 }
 
+char *
+panel_util_get_from_personal_path (const char *file)
+{
+       return g_build_filename (g_get_user_config_dir (),
+                                "gnome-panel", file, NULL);
+}
+
 static char *
 panel_launcher_get_personal_path (void)
 {
-       return g_build_filename (g_get_user_config_dir (),
-                                "gnome-panel", "launchers", NULL);
+       return panel_util_get_from_personal_path ("launchers");
 }
 
 gboolean
diff --git a/gnome-panel/panel-util.h b/gnome-panel/panel-util.h
index fc8e9de..6856a6c 100644
--- a/gnome-panel/panel-util.h
+++ b/gnome-panel/panel-util.h
@@ -30,6 +30,8 @@ GdkPixbuf *     panel_load_icon         (GtkIconTheme  
*icon_theme,
                                         int            desired_height,
                                         char         **error_msg);
 
+char       *panel_util_get_from_personal_path  (const char *file);
+
 GFile      *panel_launcher_get_gfile           (const char *location);
 char       *panel_launcher_get_uri             (const char *location);
 char       *panel_launcher_get_filename        (const char *location);
-- 
1.7.7


>From bc6beed1c7562f92a3993a720061a6e2f584646e Mon Sep 17 00:00:00 2001
From: Vincent Untz <vu...@gnome.org>
Date: Tue, 11 Oct 2011 17:25:26 +0200
Subject: [PATCH 5/5] panel: Make it possible to load a default layout from
 the user config

If ~/.config/gnome-panel/panel-default-layout.layout exists, use it in
favor of /usr/share/gnome-panel/panel-default-layout.layout.
---
 gnome-panel/panel-layout.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/gnome-panel/panel-layout.c b/gnome-panel/panel-layout.c
index 596d97f..cd4ca37 100644
--- a/gnome-panel/panel-layout.c
+++ b/gnome-panel/panel-layout.c
@@ -41,12 +41,15 @@
 #include "panel-object-loader.h"
 #include "panel-schemas.h"
 #include "panel-toplevel.h"
+#include "panel-util.h"
 
 #include "panel-layout.h"
 
 static GSettings *layout_settings = NULL;
 
 #define PANEL_LAYOUT_ERROR panel_layout_error_quark ()
+
+#define PANEL_LAYOUT_DEFAULT_LAYOUT_FILE "panel-default-layout.layout"
 #define PANEL_LAYOUT_OBJECT_GCONF_PATH_TEMPLATE "/apps/panel3-applets/%s"
 #define PANEL_LAYOUT_INSTANCE_CONFIG_SUBPATH "@instance-config/"
 
@@ -1114,8 +1117,17 @@ panel_layout_load_object (const char *object_id)
 static char *
 panel_layout_get_default_layout_file (void)
 {
+        char *user_file;
+
+        user_file = panel_util_get_from_personal_path 
(PANEL_LAYOUT_DEFAULT_LAYOUT_FILE);
+
+        if (g_file_test (user_file, G_FILE_TEST_IS_REGULAR))
+                return user_file;
+
+        g_free (user_file);
+
         return g_build_filename (PANELDATADIR,
-                                 "panel-default-layout.layout",
+                                 PANEL_LAYOUT_DEFAULT_LAYOUT_FILE,
                                  NULL);
 }
 
-- 
1.7.7

continue with "q"...



Remember to have fun...

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to