~ubuntu-branches/ubuntu/saucy/xfce4-panel/saucy

« back to all changes in this revision

Viewing changes to migrate/migrate-config.c

  • Committer: Package Import Robot
  • Author(s): Lionel Le Folgoc
  • Date: 2012-05-22 22:31:35 UTC
  • Revision ID: package-import@ubuntu.com-20120522223135-bkdjkxr30batuhp0
Tags: 4.10.0-1ubuntu1
* debian/patches:
  - xubuntu_migrate-tasklist-separator.patch: added, try to be smart and
    work around the non-expandable tasklist plugin from 4.10 by setting
    as expandable the separator next to it (should work with the default
    panel layouts from Xubuntu, Mythbuntu and UbuntuStudio).

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 
54
54
 
55
55
static void
 
56
xubuntu_migrate_tasklist (GHashTable    *plugins,
 
57
                          XfconfChannel *channel)
 
58
{
 
59
  const GValue *value;
 
60
  GPtrArray    *array;
 
61
  guint         j;
 
62
  gint          plugin_id, tsk_index, sep_index;
 
63
 
 
64
  /* First, check that plugin-2 and plugin-3 still match the default xubuntu
 
65
   * settings */
 
66
  value = g_hash_table_lookup (plugins, "/plugins/plugin-2");
 
67
  if (!G_VALUE_HOLDS_STRING (value)
 
68
      || g_strcmp0 (g_value_get_string (value), "tasklist") != 0)
 
69
    return;
 
70
  value = g_hash_table_lookup (plugins, "/plugins/plugin-3");
 
71
  if (!G_VALUE_HOLDS_STRING (value)
 
72
      || g_strcmp0 (g_value_get_string (value), "separator") != 0)
 
73
    return;
 
74
 
 
75
  /* Then, check that plugin-2 (tasklist) and plugin-3 (separator) are on the
 
76
   * first same panel as expected */
 
77
  array = xfconf_channel_get_arrayv (XFCONF_CHANNEL (channel), "/panels/panel-0/plugin-ids");
 
78
  if (array == NULL)
 
79
    return;
 
80
 
 
81
  tsk_index = sep_index = 0;
 
82
  for (j = 0; j < array->len; j++)
 
83
    {
 
84
      /* get the plugin id */
 
85
      value = g_ptr_array_index (array, j);
 
86
      if (value == NULL)
 
87
        continue;
 
88
 
 
89
      plugin_id = g_value_get_int (value);
 
90
      if (plugin_id == 2)
 
91
        tsk_index = j;
 
92
      else if (plugin_id == 3)
 
93
        sep_index = j;
 
94
    }
 
95
  xfconf_array_free (array);
 
96
 
 
97
  if (tsk_index == 0
 
98
      || sep_index == 0
 
99
      || sep_index != tsk_index + 1)
 
100
    return;
 
101
 
 
102
  /* Apparently this is the default xubuntu layout, so expand the
 
103
   * separator to workaround non-expanding tasklist in 4.10 */
 
104
  xfconf_channel_set_bool (XFCONF_CHANNEL (channel), "/plugins/plugin-3/expand", TRUE);
 
105
}
 
106
 
 
107
 
 
108
 
 
109
static void
56
110
migrate_config_session_menu (gpointer key,
57
111
                             gpointer value,
58
112
                             gpointer channel)
187
241
 
188
242
      /* migrate old action plugins */
189
243
      g_hash_table_foreach (plugins, migrate_config_action_48, channel);
 
244
 
 
245
      /* hack for Xubuntu: expand the separator next to the tasklist */
 
246
      xubuntu_migrate_tasklist (plugins, channel);
190
247
    }
191
248
 
192
249
  /* migrate horizontal to mode property */