diff options
Diffstat (limited to 'libslab/libslab-utils.c')
-rw-r--r-- | libslab/libslab-utils.c | 196 |
1 files changed, 0 insertions, 196 deletions
diff --git a/libslab/libslab-utils.c b/libslab/libslab-utils.c index 80bf6472..fa96b260 100644 --- a/libslab/libslab-utils.c +++ b/libslab/libslab-utils.c @@ -11,7 +11,6 @@ #include <sys/stat.h> #include <sys/resource.h> #include <sys/time.h> -#include <mateconf/mateconf-value.h> #include <gtk/gtk.h> #define DESKTOP_ITEM_TERMINAL_EMULATOR_FLAG "TerminalEmulator" @@ -273,201 +272,6 @@ libslab_strlen (const gchar *a) return strlen (a); } -gpointer -libslab_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) - libslab_handle_g_error (& error, "%s: error getting %s", G_STRFUNC, key); - else { - 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 - ; - } - - retval = (gpointer) list; - - break; - - default: - break; - } - } - - g_object_unref (client); - - if (value) - mateconf_value_free (value); - - return retval; -} - -void -libslab_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) { - libslab_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: - break; - } - - mateconf_client_set (client, key, value, & error); - - if (error) - libslab_handle_g_error (&error, "%s: error setting %s", G_STRFUNC, key); - -exit: - - mateconf_value_free (value); - g_object_unref (client); -} - -guint -libslab_mateconf_notify_add (const gchar *key, MateConfClientNotifyFunc callback, gpointer user_data) -{ - MateConfClient *client; - guint conn_id; - - GError *error = NULL; - - - client = mateconf_client_get_default (); - conn_id = mateconf_client_notify_add (client, key, callback, user_data, NULL, & error); - - if (error) - libslab_handle_g_error ( - & error, "%s: error adding mateconf notify for (%s)", G_STRFUNC, key); - - g_object_unref (client); - - return conn_id; -} - -void -libslab_mateconf_notify_remove (guint conn_id) -{ - MateConfClient *client; - - GError *error = NULL; - - - if (conn_id == 0) - return; - - client = mateconf_client_get_default (); - mateconf_client_notify_remove (client, conn_id); - - if (error) - libslab_handle_g_error ( - & error, "%s: error removing mateconf notify", G_STRFUNC); - - g_object_unref (client); -} - void libslab_handle_g_error (GError **error, const gchar *msg_format, ...) { |