summaryrefslogtreecommitdiff
path: root/libslab/mate-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libslab/mate-utils.c')
-rw-r--r--libslab/mate-utils.c180
1 files changed, 0 insertions, 180 deletions
diff --git a/libslab/mate-utils.c b/libslab/mate-utils.c
index 11bcfdce..f3c31c42 100644
--- a/libslab/mate-utils.c
+++ b/libslab/mate-utils.c
@@ -109,186 +109,6 @@ load_desktop_item_by_unknown_id (const gchar * id)
return NULL;
}
-gpointer
-get_mateconf_value (const gchar * key)
-{
- MateConfClient *client;
- MateConfValue *value;
- GError *error = NULL;
-
- gpointer retval = NULL;
-
- GList *list;
- GSList *slist;
-
- MateConfValue *value_i;
- GSList *node;
-
- client = mateconf_client_get_default ();
- value = mateconf_client_get (client, key, &error);
-
- if (error || ! value)
- {
- handle_g_error (&error, "%s: error getting %s", G_STRFUNC, key);
-
- goto exit;
- }
-
- switch (value->type)
- {
- case MATECONF_VALUE_STRING:
- retval = (gpointer) g_strdup (mateconf_value_get_string (value));
- break;
-
- case MATECONF_VALUE_INT:
- retval = GINT_TO_POINTER (mateconf_value_get_int (value));
- break;
-
- case MATECONF_VALUE_BOOL:
- retval = GINT_TO_POINTER (mateconf_value_get_bool (value));
- break;
-
- case MATECONF_VALUE_LIST:
- list = NULL;
- slist = mateconf_value_get_list (value);
-
- for (node = slist; node; node = node->next)
- {
- value_i = (MateConfValue *) node->data;
-
- if (value_i->type == MATECONF_VALUE_STRING)
- list = g_list_append (list,
- g_strdup (mateconf_value_get_string (value_i)));
- else if (value_i->type == MATECONF_VALUE_INT)
- list = g_list_append (list,
- GINT_TO_POINTER (mateconf_value_get_int (value_i)));
- else
- g_assert_not_reached ();
- }
-
- retval = (gpointer) list;
-
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-
- exit:
-
- g_object_unref (client);
- if(value)
- mateconf_value_free (value);
-
- return retval;
-}
-
-void
-set_mateconf_value (const gchar * key, gconstpointer data)
-{
- MateConfClient *client;
- MateConfValue *value;
-
- MateConfValueType type;
- MateConfValueType list_type;
-
- GSList *slist = NULL;
-
- GError *error = NULL;
-
- MateConfValue *value_i;
- GList *node;
-
- client = mateconf_client_get_default ();
- value = mateconf_client_get (client, key, &error);
-
- if (error)
- {
- handle_g_error (&error, "%s: error getting %s", G_STRFUNC, key);
-
- goto exit;
- }
-
- type = value->type;
- list_type =
- (type ==
- MATECONF_VALUE_LIST ? mateconf_value_get_list_type (value) : MATECONF_VALUE_INVALID);
-
- mateconf_value_free (value);
- value = mateconf_value_new (type);
-
- if (type == MATECONF_VALUE_LIST)
- mateconf_value_set_list_type (value, list_type);
-
- switch (type)
- {
- case MATECONF_VALUE_STRING:
- mateconf_value_set_string (value, g_strdup ((gchar *) data));
- break;
-
- case MATECONF_VALUE_INT:
- mateconf_value_set_int (value, GPOINTER_TO_INT (data));
- break;
-
- case MATECONF_VALUE_BOOL:
- mateconf_value_set_bool (value, GPOINTER_TO_INT (data));
- break;
-
- case MATECONF_VALUE_LIST:
- for (node = (GList *) data; node; node = node->next)
- {
- value_i = mateconf_value_new (list_type);
-
- if (list_type == MATECONF_VALUE_STRING)
- mateconf_value_set_string (value_i, (const gchar *) node->data);
- else if (list_type == MATECONF_VALUE_INT)
- mateconf_value_set_int (value_i, GPOINTER_TO_INT (node->data));
- else
- g_assert_not_reached ();
-
- slist = g_slist_append (slist, value_i);
- }
-
- mateconf_value_set_list_nocopy (value, slist);
-
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-
- mateconf_client_set (client, key, value, &error);
-
- if (error)
- handle_g_error (&error, "%s: error setting %s", G_STRFUNC, key);
-
- exit:
-
- mateconf_value_free (value);
- g_object_unref (client);
-}
-
-guint
-connect_mateconf_notify (const gchar * key, MateConfClientNotifyFunc cb, gpointer user_data)
-{
- MateConfClient *client;
- guint conn_id;
-
- GError *error = NULL;
-
- client = mateconf_client_get_default ();
- conn_id = mateconf_client_notify_add (client, key, cb, user_data, NULL, &error);
-
- if (error)
- handle_g_error (&error, "%s: error adding notify for (%s)", G_STRFUNC, key);
-
- g_object_unref (client);
-
- return conn_id;
-}
-
void
handle_g_error (GError ** error, const gchar * msg_format, ...)
{