[Xfce4-commits] <xfce4-panel:devel> Make migration work with custom channel names.
Nick Schermer
noreply at xfce.org
Mon Feb 15 21:38:02 CET 2010
Updating branch refs/heads/devel
to addb00af9d7f5855d7da082a043e647ca7ee0f49 (commit)
from b34e7a509235dd66031095dcdd20613fefe33b7c (commit)
commit addb00af9d7f5855d7da082a043e647ca7ee0f49
Author: Nick Schermer <nick at xfce.org>
Date: Mon Feb 15 21:34:15 2010 +0100
Make migration work with custom channel names.
migrate/migrate-46.c | 64 ++++++++++++---------------------------------
migrate/migrate-default.c | 10 ++++++-
2 files changed, 26 insertions(+), 48 deletions(-)
diff --git a/migrate/migrate-46.c b/migrate/migrate-46.c
index 2a65d37..8050861 100644
--- a/migrate/migrate-46.c
+++ b/migrate/migrate-46.c
@@ -31,10 +31,10 @@
#include <xfconf/xfconf.h>
#include <libxfce4util/libxfce4util.h>
#include <migrate/migrate-46.h>
+#include <libxfce4panel/xfce-panel-macros.h>
-#define CHANNEL_NAME "xfce4-panel"
#define LAUNCHER_FOLDER "launcher"
@@ -75,58 +75,28 @@ typedef enum
}
SnapPosition;
-typedef enum
-{
- XFCE_SCREEN_POSITION_NONE,
-
- /* top */
- XFCE_SCREEN_POSITION_NW_H, /* North West Horizontal */
- XFCE_SCREEN_POSITION_N, /* North */
- XFCE_SCREEN_POSITION_NE_H, /* North East Horizontal */
-
- /* left */
- XFCE_SCREEN_POSITION_NW_V, /* North West Vertical */
- XFCE_SCREEN_POSITION_W, /* West */
- XFCE_SCREEN_POSITION_SW_V, /* South West Vertical */
-
- /* right */
- XFCE_SCREEN_POSITION_NE_V, /* North East Vertical */
- XFCE_SCREEN_POSITION_E, /* East */
- XFCE_SCREEN_POSITION_SE_V, /* South East Vertical */
-
- /* bottom */
- XFCE_SCREEN_POSITION_SW_H, /* South West Horizontal */
- XFCE_SCREEN_POSITION_S, /* South */
- XFCE_SCREEN_POSITION_SE_H, /* South East Horizontal */
-
- /* floating */
- XFCE_SCREEN_POSITION_FLOATING_H, /* Floating Horizontal */
- XFCE_SCREEN_POSITION_FLOATING_V /* Floating Vertical */
-}
-ScreenPosition;
-
typedef struct
{
- ParserState state;
- guint plugin_id_counter;
- guint panel_id_counter;
- XfconfChannel *channel;
-
- GPtrArray *panel_plugin_ids;
- gint panel_yoffset;
- gint panel_xoffset;
- ScreenPosition panel_screen_position;
- guint panel_transparency;
- gboolean panel_activetrans;
+ ParserState state;
+ guint plugin_id_counter;
+ guint panel_id_counter;
+ XfconfChannel *channel;
+
+ GPtrArray *panel_plugin_ids;
+ gint panel_yoffset;
+ gint panel_xoffset;
+ XfceScreenPosition panel_screen_position;
+ guint panel_transparency;
+ gboolean panel_activetrans;
}
ConfigParser;
static void
-migrate_46_panel_screen_position (ScreenPosition screen_position,
- SnapPosition *snap_position,
- gboolean *horizontal)
+migrate_46_panel_screen_position (XfceScreenPosition screen_position,
+ SnapPosition *snap_position,
+ gboolean *horizontal)
{
/* defaults */
*horizontal = FALSE;
@@ -602,7 +572,7 @@ migrate_46_panel_add_plugin (ConfigParser *parser,
/* open a panel with the propert base for the plugin */
g_snprintf (base, sizeof (base), "/plugins/plugin-%d", parser->plugin_id_counter);
- channel = xfconf_channel_new_with_property_base (CHANNEL_NAME, base);
+ channel = xfconf_channel_new_with_property_base (XFCE_PANEL_CHANNEL_NAME, base);
if (strcmp (name, "actions") == 0)
{
@@ -903,7 +873,7 @@ migrate_46 (const gchar *filename,
parser->state = START;
parser->plugin_id_counter = 0;
parser->panel_id_counter = 0;
- parser->channel = xfconf_channel_new (CHANNEL_NAME);
+ parser->channel = xfconf_channel_new (XFCE_PANEL_CHANNEL_NAME);
context = g_markup_parse_context_new (&markup_parser, 0, parser, NULL);
diff --git a/migrate/migrate-default.c b/migrate/migrate-default.c
index ee6f8c7..1c59d4c 100644
--- a/migrate/migrate-default.c
+++ b/migrate/migrate-default.c
@@ -31,6 +31,8 @@
#include <xfconf/xfconf.h>
#include <libxfce4util/libxfce4util.h>
#include <migrate/migrate-default.h>
+#include <libxfce4panel/xfce-panel-macros.h>
+
typedef struct
@@ -143,7 +145,13 @@ migrate_default_start_element_handler (GMarkupParseContext *context,
for (i = 0; attribute_names[i] != NULL; i++)
{
if (strcmp (attribute_names[i], "name") == 0)
- channel_name = attribute_values[i];
+ {
+ channel_name = attribute_values[i];
+
+ /* this is an xfce4-panel workaround to make it work
+ * with the custom channel names */
+ channel_name = XFCE_PANEL_CHANNEL_NAME;
+ }
}
}
More information about the Xfce4-commits
mailing list