[Xfce4-commits] <xfce4-panel:xfce-4.8> Migrate monitor information (bug #7135).
Nick Schermer
noreply at xfce.org
Sat Jan 29 21:26:03 CET 2011
Updating branch refs/heads/xfce-4.8
to 6485131ab512ab133c9a97411ba83e4ff16aa792 (commit)
from 8b0c024c435b2cab825ceb2661e2589145e3b5ee (commit)
commit 6485131ab512ab133c9a97411ba83e4ff16aa792
Author: Nick Schermer <nick at xfce.org>
Date: Thu Jan 20 11:09:06 2011 +0100
Migrate monitor information (bug #7135).
migrate/migrate-46.c | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/migrate/migrate-46.c b/migrate/migrate-46.c
index 9f3dc27..2f9ebcc 100644
--- a/migrate/migrate-46.c
+++ b/migrate/migrate-46.c
@@ -180,7 +180,10 @@ migrate_46_panel_set_property (ConfigParser *parser,
const gchar *value,
GError **error)
{
- gchar prop[128];
+ gchar prop[128];
+ GdkDisplay *display;
+ gchar *name;
+ gint num;
if (strcmp (property_name, "size") == 0)
{
@@ -200,17 +203,29 @@ migrate_46_panel_set_property (ConfigParser *parser,
}
else if (strcmp (property_name, "xoffset") == 0)
{
- /* TODO test this */
parser->panel_xoffset = MAX (0, atoi (value));
}
else if (strcmp (property_name, "yoffset") == 0)
{
- /* TODO test this */
parser->panel_yoffset = MAX (0, atoi (value));
}
else if (strcmp (property_name, "monitor") == 0)
{
- /* TODO */
+ /* in 4.4 and 4.6 we only use monitor and make no difference between monitors
+ * and screen's, so check the setup of the user to properly convert this */
+ num = MAX (0, atoi (value));
+ if (G_LIKELY (num > 0))
+ {
+ display = gdk_display_get_default ();
+ if (display != NULL && gdk_display_get_n_screens (display) > 1)
+ name = g_strdup_printf ("screen-%d", num);
+ else
+ name = g_strdup_printf ("monitor-%d", num);
+
+ g_snprintf (prop, sizeof (prop), "/panels/panel-%u/output", parser->panel_id_counter);
+ xfconf_channel_set_string (parser->channel, prop, name);
+ g_free (name);
+ }
}
else if (strcmp (property_name, "handlestyle") == 0)
{
More information about the Xfce4-commits
mailing list