summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/capplet/mate-notification-properties.c75
-rw-r--r--src/daemon/daemon.c32
-rw-r--r--src/daemon/daemon.h15
-rw-r--r--src/daemon/engines.c11
4 files changed, 37 insertions, 96 deletions
diff --git a/src/capplet/mate-notification-properties.c b/src/capplet/mate-notification-properties.c
index 5cd07bb..2c5612e 100644
--- a/src/capplet/mate-notification-properties.c
+++ b/src/capplet/mate-notification-properties.c
@@ -24,22 +24,20 @@
#include <glib/gi18n.h>
#include <glib.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <string.h>
#include <libmatenotify/notify.h>
#include "stack.h"
-#define MATECONF_KEY_DAEMON "/apps/mate-notification-daemon"
-#define MATECONF_KEY_THEME MATECONF_KEY_DAEMON "/theme"
-#define MATECONF_KEY_POPUP_LOCATION MATECONF_KEY_DAEMON "/popup_location"
-
-#define N_LISTENERS 2
+#define GSETTINGS_SCHEMA "org.mate.NotificationDaemon"
+#define GSETTINGS_KEY_THEME "theme"
+#define GSETTINGS_KEY_POPUP_LOCATION "popup-location"
#define NOTIFICATION_UI_FILE "mate-notification-properties.ui"
typedef struct {
- MateConfClient* client;
+ GSettings* gsettings;
GtkWidget* dialog;
GtkWidget* position_combo;
@@ -47,10 +45,6 @@ typedef struct {
GtkWidget* preview_button;
NotifyNotification* preview;
-
- guint listeners[N_LISTENERS];
- int n_listeners;
- int expected_listeners;
} NotificationAppletDialog;
enum {
@@ -66,19 +60,14 @@ enum {
N_COLUMNS_THEME
};
-static void notification_properties_location_notify(MateConfClient* client, guint cnx_id, MateConfEntry* entry, NotificationAppletDialog* dialog)
+static void notification_properties_location_notify(GSettings *settings, gchar *key, NotificationAppletDialog* dialog)
{
GtkTreeModel* model;
GtkTreeIter iter;
const char* location;
gboolean valid;
- if (!entry->value || entry->value->type != MATECONF_VALUE_STRING)
- {
- return;
- }
-
- location = mateconf_value_get_string(entry->value);
+ location = g_settings_get_string(dialog->gsettings, key);
model = gtk_combo_box_get_model(GTK_COMBO_BOX(dialog->position_combo));
valid = gtk_tree_model_get_iter_first(model, &iter);
@@ -114,7 +103,7 @@ static void notification_properties_location_changed(GtkComboBox* widget, Notifi
gtk_tree_model_get(model, &iter, NOTIFY_POSITION_NAME, &location, -1);
- mateconf_client_set_string(dialog->client, MATECONF_KEY_POPUP_LOCATION, location, NULL);
+ g_settings_set_string (dialog->gsettings, GSETTINGS_KEY_POPUP_LOCATION, location);
g_free(location);
}
@@ -128,7 +117,7 @@ static void notification_properties_dialog_setup_positions(NotificationAppletDia
model = gtk_combo_box_get_model(GTK_COMBO_BOX(dialog->position_combo));
g_signal_connect(dialog->position_combo, "changed", G_CALLBACK(notification_properties_location_changed), dialog);
- location = mateconf_client_get_string(dialog->client, MATECONF_KEY_POPUP_LOCATION, NULL);
+ location = g_settings_get_string(dialog->gsettings, GSETTINGS_KEY_POPUP_LOCATION);
for (valid = gtk_tree_model_get_iter_first(model, &iter); valid; valid = gtk_tree_model_iter_next(model, &iter))
{
@@ -146,19 +135,13 @@ static void notification_properties_dialog_setup_positions(NotificationAppletDia
g_free(key);
}
- dialog->listeners[dialog->n_listeners] = mateconf_client_notify_add(dialog->client, MATECONF_KEY_POPUP_LOCATION, (MateConfClientNotifyFunc) notification_properties_location_notify, dialog, NULL, NULL);
- dialog->n_listeners++;
+ g_signal_connect (dialog->gsettings, "changed::" GSETTINGS_KEY_POPUP_LOCATION, G_CALLBACK (notification_properties_location_notify), dialog);
g_free(location);
}
-static void notification_properties_theme_notify(MateConfClient* client, guint cnx_id, MateConfEntry* entry, NotificationAppletDialog* dialog)
+static void notification_properties_theme_notify(GSettings *settings, gchar *key, NotificationAppletDialog* dialog)
{
- if (!entry->value || entry->value->type != MATECONF_VALUE_STRING)
- {
- return;
- }
-
- const char* theme = mateconf_value_get_string(entry->value);
+ const char* theme = g_settings_get_string(dialog->gsettings, key);
GtkTreeModel* model = gtk_combo_box_get_model(GTK_COMBO_BOX(dialog->theme_combo));
@@ -195,7 +178,7 @@ static void notification_properties_theme_changed(GtkComboBox* widget, Notificat
}
gtk_tree_model_get(model, &iter, NOTIFY_THEME_NAME, &theme, -1);
- mateconf_client_set_string(dialog->client, MATECONF_KEY_THEME, theme, NULL);
+ g_settings_set_string(dialog->gsettings, GSETTINGS_KEY_THEME, theme);
g_free(theme);
}
@@ -267,8 +250,7 @@ static void notification_properties_dialog_setup_themes(NotificationAppletDialog
g_warning("Error opening themes dir");
}
-
- theme = mateconf_client_get_string(dialog->client, MATECONF_KEY_THEME, NULL);
+ theme = g_settings_get_string(dialog->gsettings, GSETTINGS_KEY_THEME);
for (valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter); valid; valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter))
{
@@ -286,8 +268,7 @@ static void notification_properties_dialog_setup_themes(NotificationAppletDialog
g_free(key);
}
- dialog->listeners[dialog->n_listeners] = mateconf_client_notify_add(dialog->client, MATECONF_KEY_THEME, (MateConfClientNotifyFunc) notification_properties_theme_notify, dialog, NULL, NULL);
- dialog->n_listeners++;
+ g_signal_connect (dialog->gsettings, "changed::" GSETTINGS_KEY_THEME, G_CALLBACK (notification_properties_theme_notify), dialog);
g_free(theme);
}
@@ -408,16 +389,11 @@ static gboolean notification_properties_dialog_init(NotificationAppletDialog* di
g_signal_connect(dialog->dialog, "response", G_CALLBACK(notification_properties_dialog_response), dialog);
g_signal_connect(dialog->dialog, "destroy", G_CALLBACK(notification_properties_dialog_destroyed), dialog);
- dialog->client = mateconf_client_get_default();
- mateconf_client_add_dir(dialog->client, MATECONF_KEY_DAEMON, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-
- dialog->expected_listeners = N_LISTENERS;
- dialog->n_listeners = 0;
+ dialog->gsettings = g_settings_new (GSETTINGS_SCHEMA);
notification_properties_dialog_setup_themes(dialog);
notification_properties_dialog_setup_positions(dialog);
- g_assert(dialog->n_listeners == dialog->expected_listeners);
gtk_widget_show(dialog->dialog);
dialog->preview = NULL;
@@ -433,25 +409,6 @@ static void notification_properties_dialog_finalize(NotificationAppletDialog* di
dialog->dialog = NULL;
}
- if (dialog->client != NULL)
- {
- int i;
-
- for (i = 0; i < dialog->n_listeners; i++)
- {
- if (dialog->listeners[i])
- {
- mateconf_client_notify_remove(dialog->client, dialog->listeners[i]);
- dialog->listeners[i] = 0;
- }
- }
-
- dialog->n_listeners = 0;
- mateconf_client_remove_dir(dialog->client, MATECONF_KEY_DAEMON, NULL);
- g_object_unref(dialog->client);
- dialog->client = NULL;
- }
-
if (dialog->preview)
{
notify_notification_close(dialog->preview, NULL);
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index 7404f96..a0e1a50 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -105,8 +105,6 @@ struct _NotifyDaemonPrivate {
GHashTable* notification_hash;
gboolean url_clicked_lock;
- guint mateconf_cnxn;
-
NotifyStackLocation stack_location;
NotifyScreen** screens;
int n_screens;
@@ -318,15 +316,13 @@ static void create_screens(NotifyDaemon* daemon)
}
}
-static void on_popup_location_changed(MateConfClient* client, guint cnxn_id, MateConfEntry* entry, NotifyDaemon* daemon)
+static void on_popup_location_changed(GSettings *settings, gchar *key, NotifyDaemon* daemon)
{
NotifyStackLocation stack_location;
const char* slocation;
- MateConfValue* value;
int i;
- value = mateconf_entry_get_value(entry);
- slocation = (value != NULL ? mateconf_value_get_string(value) : NULL);
+ slocation = g_settings_get_string(daemon->gsettings, key);
if (slocation != NULL && *slocation != '\0')
{
@@ -334,7 +330,7 @@ static void on_popup_location_changed(MateConfClient* client, guint cnxn_id, Mat
}
else
{
- mateconf_client_set_string(client, MATECONF_KEY_POPUP_LOCATION, popup_stack_locations[POPUP_STACK_DEFAULT_INDEX].identifier, NULL);
+ g_settings_set_string (daemon->gsettings, GSETTINGS_KEY_POPUP_LOCATION, popup_stack_locations[POPUP_STACK_DEFAULT_INDEX].identifier);
stack_location = NOTIFY_STACK_LOCATION_DEFAULT;
}
@@ -356,7 +352,6 @@ static void on_popup_location_changed(MateConfClient* client, guint cnxn_id, Mat
static void notify_daemon_init(NotifyDaemon* daemon)
{
- MateConfClient* client;
char* location;
daemon->priv = G_TYPE_INSTANCE_GET_PRIVATE(daemon, NOTIFY_TYPE_DAEMON, NotifyDaemonPrivate);
@@ -366,15 +361,13 @@ static void notify_daemon_init(NotifyDaemon* daemon)
add_exit_timeout(daemon);
- client = mateconf_client_get_default();
- mateconf_client_add_dir(client, MATECONF_KEY_DAEMON, MATECONF_CLIENT_PRELOAD_NONE, NULL);
+ daemon->gsettings = g_settings_new (GSETTINGS_SCHEMA);
- location = mateconf_client_get_string(client, MATECONF_KEY_POPUP_LOCATION, NULL);
+ location = g_settings_get_string (daemon->gsettings, GSETTINGS_KEY_POPUP_LOCATION);
daemon->priv->stack_location = get_stack_location_from_string(location);
g_free(location);
- daemon->priv->mateconf_cnxn = mateconf_client_notify_add(client, MATECONF_KEY_POPUP_LOCATION, (MateConfClientNotifyFunc) on_popup_location_changed, daemon, NULL, NULL);
- g_object_unref(client);
+ g_signal_connect (daemon->gsettings, "changed::" GSETTINGS_KEY_POPUP_LOCATION, G_CALLBACK (on_popup_location_changed), daemon);
daemon->priv->n_screens = 0;
daemon->priv->screens = NULL;
@@ -421,14 +414,9 @@ static void destroy_screens(NotifyDaemon* daemon)
static void notify_daemon_finalize(GObject* object)
{
NotifyDaemon* daemon;
- MateConfClient* client;
daemon = NOTIFY_DAEMON(object);
- client = mateconf_client_get_default();
- mateconf_client_notify_remove(client, daemon->priv->mateconf_cnxn);
- g_object_unref(client);
-
if (g_hash_table_size(daemon->priv->monitored_window_hash) > 0)
{
gdk_window_remove_filter(NULL, (GdkFilterFunc) _notify_x11_filter, daemon);
@@ -1333,7 +1321,7 @@ gboolean notify_daemon_notify_handler(NotifyDaemon* daemon, const char* app_name
gboolean sound_enabled;
gint i;
GdkPixbuf* pixbuf;
- MateConfClient* mateconf_client;
+ GSettings* gsettings;
if (g_hash_table_size (priv->notification_hash) > MAX_NOTIFICATIONS)
{
@@ -1402,9 +1390,9 @@ gboolean notify_daemon_notify_handler(NotifyDaemon* daemon, const char* app_name
}
/* Deal with sound hints */
- mateconf_client = mateconf_client_get_default ();
- sound_enabled = mateconf_client_get_bool (mateconf_client, MATECONF_KEY_SOUND_ENABLED, NULL);
- g_object_unref (mateconf_client);
+ gsettings = g_settings_new (GSETTINGS_SCHEMA);
+ sound_enabled = g_settings_get_boolean (gsettings, GSETTINGS_KEY_SOUND_ENABLED);
+ g_object_unref (gsettings);
data = (GValue *) g_hash_table_lookup (hints, "suppress-sound");
diff --git a/src/daemon/daemon.h b/src/daemon/daemon.h
index 603ee22..b405fad 100644
--- a/src/daemon/daemon.h
+++ b/src/daemon/daemon.h
@@ -24,18 +24,18 @@
#ifndef NOTIFY_DAEMON_H
#define NOTIFY_DAEMON_H
-#include <mateconf/mateconf-client.h>
#include <glib.h>
#include <glib-object.h>
+#include <gio/gio.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
-#define MATECONF_KEY_DAEMON "/apps/mate-notification-daemon"
-#define MATECONF_KEY_THEME MATECONF_KEY_DAEMON "/theme"
-#define MATECONF_KEY_POPUP_LOCATION MATECONF_KEY_DAEMON "/popup_location"
-#define MATECONF_KEY_SOUND_ENABLED MATECONF_KEY_DAEMON "/sound_enabled"
-#define MATECONF_KEY_DEFAULT_SOUND MATECONF_KEY_DAEMON "/default_sound"
+#define GSETTINGS_SCHEMA "org.mate.NotificationDaemon"
+#define GSETTINGS_KEY_THEME "theme"
+#define GSETTINGS_KEY_POPUP_LOCATION "popup-location"
+#define GSETTINGS_KEY_SOUND_ENABLED "sound-enabled"
+#define GSETTINGS_KEY_DEFAULT_SOUND "default-sound"
#define NOTIFY_TYPE_DAEMON (notify_daemon_get_type())
#define NOTIFY_DAEMON(obj) \
@@ -70,6 +70,7 @@ typedef struct _NotifyDaemonPrivate NotifyDaemonPrivate;
struct _NotifyDaemon {
GObject parent;
+ GSettings* gsettings;
/*< private > */
NotifyDaemonPrivate* priv;
@@ -95,8 +96,6 @@ gboolean notify_daemon_get_capabilities(NotifyDaemon* daemon, char*** out_caps);
gboolean notify_daemon_get_server_information(NotifyDaemon* daemon, char** out_name, char** out_vendor, char** out_version, char** out_spec_ver);
-MateConfClient* get_mateconf_client(void);
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/src/daemon/engines.c b/src/daemon/engines.c
index 6d30f94..23a2ade 100644
--- a/src/daemon/engines.c
+++ b/src/daemon/engines.c
@@ -23,7 +23,6 @@
#include "config.h"
-#include <mateconf/mateconf-client.h>
#include "daemon.h"
#include "engines.h"
@@ -155,7 +154,7 @@ static void theme_engine_unref(ThemeEngine* engine)
}
}
-static void theme_changed_cb(MateConfClient* client, guint cnxn_id, MateConfEntry* entry, gpointer user_data)
+static void theme_changed_cb(GSettings *settings, gchar *key, gpointer user_data)
{
if (active_engine == NULL)
{
@@ -172,16 +171,14 @@ static ThemeEngine* get_theme_engine(void)
{
if (active_engine == NULL)
{
- MateConfClient* client = mateconf_client_get_default();
- char* enginename = mateconf_client_get_string(client, MATECONF_KEY_THEME, NULL);
+ GSettings* gsettings = g_settings_new (GSETTINGS_SCHEMA);
+ char* enginename = g_settings_get_string(gsettings, GSETTINGS_KEY_THEME);
if (theme_prop_notify_id == 0)
{
- theme_prop_notify_id = mateconf_client_notify_add(client, MATECONF_KEY_THEME, theme_changed_cb, NULL, NULL, NULL);
+ theme_prop_notify_id = g_signal_connect (gsettings, "changed::" GSETTINGS_KEY_THEME, G_CALLBACK (theme_changed_cb), NULL);
}
- g_object_unref(client);
-
if (enginename == NULL)
{
active_engine = load_theme_engine("standard");