From c701d94542173056de5056b44ab8353d5ec3df6d Mon Sep 17 00:00:00 2001 From: Lionel Le Folgoc Date: Fri, 1 Apr 2011 20:12:06 +0200 Subject: Improve vendor support for the default panel config In addition to /etc/xdg/xfce4/panel/default.xml, search for "xfce4/panel/default.xml" in XDG_CONFIG_DIRS. If the file found is not the default upstream one (e.g. /etc/xdg/xdg-xubuntu/xfce4/panel/default.xml instead of /etc/xdg/xfce4/panel/default.xml), and if there is no old 4.6 config to migrate, then do not display the config migration dialog, but directly apply the vendor setting found. Bug-Ubuntu: https://bugs.launchpad.net/bugs/747137 Forwarded: not-needed --- migrate/main.c | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/migrate/main.c b/migrate/main.c index 0893d0a..492818b 100644 --- a/migrate/main.c +++ b/migrate/main.c @@ -43,7 +43,7 @@ gint main (gint argc, gchar **argv) { - gchar *file; + gchar *file, *default_file; GError *error = NULL; GtkWidget *dialog; GtkWidget *button; @@ -73,6 +73,15 @@ main (gint argc, gchar **argv) /* lookup the old 4.6 config file */ file = xfce_resource_lookup (XFCE_RESOURCE_CONFIG, XFCE_46_CONFIG); + /* lookup the new default config file */ + if (!(default_file = xfce_resource_lookup (XFCE_RESOURCE_CONFIG, "xfce4/panel/default.xml"))) + default_file = g_strdup (DEFAULT_CONFIG); + /* if this default file isn't the upstream one, then it comes from the vendor + (xubuntu-default-settings, or linaro-default-settings, or else…), so skip + the dialog and apply it directly, when there's no old 4.6 config to migrate. */ + if (g_strcmp0 (DEFAULT_CONFIG, default_file) && !file) + goto apply_vendor_settings; + /* create question dialog */ dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Welcome to the first start of the panel")); @@ -94,7 +103,7 @@ main (gint argc, gchar **argv) button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("Use default config"), GTK_RESPONSE_YES); gtk_widget_set_tooltip_text (button, _("Load the default configuration")); - default_config_exists = g_file_test (DEFAULT_CONFIG, G_FILE_TEST_IS_REGULAR); + default_config_exists = g_file_test (default_file, G_FILE_TEST_IS_REGULAR); gtk_widget_set_sensitive (button, default_config_exists); if (default_config_exists && file == NULL) default_response = GTK_RESPONSE_YES; @@ -119,8 +128,9 @@ main (gint argc, gchar **argv) } else if (result == GTK_RESPONSE_YES && default_config_exists) { +apply_vendor_settings: /* apply default config */ - if (!migrate_default (DEFAULT_CONFIG, &error)) + if (!migrate_default (default_file, &error)) { xfce_dialog_show_error (NULL, error, _("Failed to load the default configuration")); g_error_free (error); @@ -128,6 +138,7 @@ main (gint argc, gchar **argv) } } + g_free (default_file); g_free (file); xfconf_shutdown ();