static void
pluma_drawspaces_plugin_dispose (GObject *object)
{
	PlumaDrawspacesPlugin *plugin = PLUMA_DRAWSPACES_PLUGIN (object);

	pluma_debug_message (DEBUG_PLUGINS, "PlumaDrawspacesPlugin disposing");

	if (plugin->priv->connection_id != 0)
	{
		mateconf_client_notify_remove (plugin->priv->mateconf_client,
					    plugin->priv->connection_id);

		plugin->priv->connection_id = 0;
	}

	if (plugin->priv->mateconf_client != NULL)
	{
		mateconf_client_suggest_sync (plugin->priv->mateconf_client, NULL);

		g_object_unref (G_OBJECT (plugin->priv->mateconf_client));

		plugin->priv->mateconf_client = NULL;
	}

	G_OBJECT_CLASS (pluma_drawspaces_plugin_parent_class)->dispose (object);
}
Exemple #2
0
static char
*get_all_applets (void)
{
	MateConfClient *client;
	GError *error;
	GSList *list, *l;
	char *key, *oafiid, *name;
	GHashTable *hash_table;
	GString *string;

	error = NULL;
	hash_table = g_hash_table_new (g_str_hash, g_str_equal);
	insert_oafiids (hash_table);

	string = g_string_new ("");

	client = mateconf_client_get_default ();

	mateconf_client_suggest_sync (client, NULL);
	
	list = mateconf_client_all_dirs (client,
		"/apps/panel/applets",
		&error);

	if (error)
	{
		g_warning ("Error: %s", error->message);
		g_error_free (error);
		error = NULL;
	}

	for (l = list; l; l = l->next)
	{
	    key = g_strdup_printf ("%s/matecomponent_iid", (gchar *)l->data);
		oafiid = mateconf_client_get_string (client, key, &error);
		if (error)
		{
			g_warning ("Error: %s", error->message);
			g_error_free (error);
			error = NULL;
		}
		g_free (key);
	
		if (oafiid)
		{
			name = g_hash_table_lookup (hash_table, oafiid);
			if (name)
			{
				mateconf_client_recursive_unset (client, l->data,
					MATECONF_UNSET_INCLUDING_SCHEMA_NAMES,
					&error);
				if (error)
				{
					g_warning ("Error: %s", error->message);
					g_error_free (error);
					error = NULL;
				}
				g_string_append_printf (string,
						"    • %s\n", name);
			}
			g_free (oafiid);
		}
		g_free (l->data);
	}

	g_slist_free (list);
	g_hash_table_destroy (hash_table);
	
	return g_string_free (string, FALSE);
}