~ubuntu-branches/ubuntu/vivid/xfce4-panel/vivid

« back to all changes in this revision

Viewing changes to migrate/main.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2011-04-01 20:43:00 UTC
  • Revision ID: james.westby@ubuntu.com-20110401204300-sq45qhoziet0nc6l
Tags: 4.8.2-1ubuntu1
* debian/patches:
  - xubuntu_support-multiple-vendor-default-configs.patch: search for the
    default.xml default config in XDG_CONFIG_DIRS as well, and do not
    display the chooser dialog in this case.                      lp: #747137
  - 0001-Tasklist-add-button-release-event-to-proxy-item-bug-.patch: taken
    from upstream git 'xfce-4.8' branch, fixes window switching with a
    drop down selector.                                           lp: #743689
  - series: added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
gint
44
44
main (gint argc, gchar **argv)
45
45
{
46
 
  gchar     *file;
 
46
  gchar     *file, *default_file;
47
47
  GError    *error = NULL;
48
48
  GtkWidget *dialog;
49
49
  GtkWidget *button;
73
73
  /* lookup the old 4.6 config file */
74
74
  file = xfce_resource_lookup (XFCE_RESOURCE_CONFIG, XFCE_46_CONFIG);
75
75
 
 
76
  /* lookup the new default config file */
 
77
  if (!(default_file = xfce_resource_lookup (XFCE_RESOURCE_CONFIG, "xfce4/panel/default.xml")))
 
78
    default_file = g_strdup (DEFAULT_CONFIG);
 
79
  /* if this default file isn't the upstream one, then it comes from the vendor
 
80
     (xubuntu-default-settings, or linaro-default-settings, or else…), so skip
 
81
     the dialog and apply it directly, when there's no old 4.6 config to migrate. */
 
82
  if (g_strcmp0 (DEFAULT_CONFIG, default_file) && !file)
 
83
    goto apply_vendor_settings;
 
84
 
76
85
  /* create question dialog */
77
86
  dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
78
87
                                   _("Welcome to the first start of the panel"));
94
103
 
95
104
  button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("Use default config"), GTK_RESPONSE_YES);
96
105
  gtk_widget_set_tooltip_text (button, _("Load the default configuration"));
97
 
  default_config_exists = g_file_test (DEFAULT_CONFIG, G_FILE_TEST_IS_REGULAR);
 
106
  default_config_exists = g_file_test (default_file, G_FILE_TEST_IS_REGULAR);
98
107
  gtk_widget_set_sensitive (button, default_config_exists);
99
108
  if (default_config_exists && file == NULL)
100
109
    default_response = GTK_RESPONSE_YES;
119
128
    }
120
129
  else if (result == GTK_RESPONSE_YES && default_config_exists)
121
130
    {
 
131
apply_vendor_settings:
122
132
      /* apply default config */
123
 
      if (!migrate_default (DEFAULT_CONFIG, &error))
 
133
      if (!migrate_default (default_file, &error))
124
134
        {
125
135
          xfce_dialog_show_error (NULL, error, _("Failed to load the default configuration"));
126
136
          g_error_free (error);
128
138
        }
129
139
    }
130
140
 
 
141
  g_free (default_file);
131
142
  g_free (file);
132
143
 
133
144
  xfconf_shutdown ();