static PanelAppletInfo *
panel_applets_manager_dbus_get_applet_info (PanelAppletsManager *manager,
        const gchar         *iid)
{
    PanelAppletFactoryInfo *info;
    GList                  *l;

    info = get_applet_factory_info (manager, iid);
    if (!info)
        return NULL;

    for (l = info->applet_list; l; l = g_list_next (l)) {
        PanelAppletInfo *ainfo = (PanelAppletInfo *) l->data;

        if (g_strcmp0 (panel_applet_info_get_iid (ainfo), iid) == 0)
            return ainfo;
    }

    return NULL;
}
Esempio n. 2
0
gchar *
panel_compatibility_get_applet_iid (GSettings   *settings,
				    const gchar *id)
{
	PanelAppletInfo *info;
	gchar *object_iid;
	gboolean needs_migration;
	const char *iid;

	needs_migration = FALSE;

	object_iid = g_settings_get_string (settings, PANEL_OBJECT_IID_KEY);
	if (PANEL_GLIB_STR_EMPTY (object_iid)) {
		g_free (object_iid);
		return NULL;
	}

	info = panel_applets_manager_get_applet_info_from_old_id (object_iid);
	if (!info)
		info = panel_applets_manager_get_applet_info (object_iid);

	if (!info) {
		g_free (object_iid);
		return NULL;
	}

	iid = panel_applet_info_get_iid (info);

	/* migrate if the iid in the configuration is different than the real
	 * iid that will get used */
	if (!g_str_equal (iid, object_iid))
		needs_migration = TRUE;

	g_free (object_iid);

	if (needs_migration)
		g_settings_set_string (settings, PANEL_OBJECT_IID_KEY, iid);

	return g_strdup (iid);
}