diff options
author | Nick Schermer <nick@xfce.org> | 2011-01-20 11:09:06 +0100 |
---|---|---|
committer | Nick Schermer <nick@xfce.org> | 2011-01-20 11:10:51 +0100 |
commit | 6485131ab512ab133c9a97411ba83e4ff16aa792 (patch) | |
tree | 88b620680d895bae6ca89a93202b1939078d6c19 /migrate | |
parent | 8b0c024c435b2cab825ceb2661e2589145e3b5ee (diff) |
Migrate monitor information (bug #7135).
Diffstat (limited to 'migrate')
-rw-r--r-- | 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 9f3dc272..2f9ebcc1 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) { |