summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--typing-break/drw-break-window.c28
-rw-r--r--typing-break/drwright.c69
-rw-r--r--typing-break/drwright.h2
3 files changed, 34 insertions, 65 deletions
diff --git a/typing-break/drw-break-window.c b/typing-break/drw-break-window.c
index 86a12084..bd34015f 100644
--- a/typing-break/drw-break-window.c
+++ b/typing-break/drw-break-window.c
@@ -26,7 +26,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#ifdef HAVE_CANBERRA_GTK
#include <canberra-gtk.h>
@@ -131,21 +131,17 @@ drw_break_window_init (DrwBreakWindow *window)
GdkRectangle monitor;
gint right_padding;
gint bottom_padding;
- MateConfClient *client;
+ GSettings *settings;
priv = DRW_BREAK_WINDOW_GET_PRIVATE (window);
window->priv = priv;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (TYPING_BREAK_SCHEMA);
- priv->break_time = 60 * mateconf_client_get_int (client,
- MATECONF_PATH "/break_time",
- NULL);
+ priv->break_time = 60 * g_settings_get_int (settings, "break-time");
- allow_postpone = mateconf_client_get_bool (client,
- MATECONF_PATH "/allow_postpone",
- NULL);
- g_object_unref (client);
+ allow_postpone = g_settings_get_boolean (settings, "allow-postpone");
+ g_object_unref (settings);
g_object_set (window, "type", GTK_WINDOW_POPUP, NULL);
gtk_window_set_keep_above (GTK_WINDOW (window), TRUE);
@@ -419,14 +415,12 @@ postpone_entry_activate_cb (GtkWidget *entry,
{
const gchar *str;
gchar *phrase;
- MateConfClient *client = mateconf_client_get_default();
+ GSettings *settings = g_settings_new (TYPING_BREAK_SCHEMA);
str = gtk_entry_get_text (GTK_ENTRY (entry));
- phrase = mateconf_client_get_string (client,
- MATECONF_PATH "/unlock_phrase",
- NULL);
- g_object_unref (client);
+ phrase = g_settings_get_string (settings, "unlock-phrase");
+ g_object_unref (settings);
if (!strcmp (str, phrase)) {
g_signal_emit (window, signals[POSTPONE], 0, NULL);
@@ -509,9 +503,7 @@ postpone_clicked_cb (GtkWidget *button,
gchar *phrase;
/* Disable the phrase for now. */
- phrase = NULL; /*mateconf_client_get_string (mateconf_client_get_default (),
- MATECONF_PATH "/unlock_phrase",
- NULL);*/
+ phrase = NULL; /*g_settings_get_string (settings, "unlock-phrase");*/
if (!phrase || !phrase[0]) {
g_signal_emit (window, signals[POSTPONE], 0, NULL);
diff --git a/typing-break/drwright.c b/typing-break/drwright.c
index 1b7665e7..e3af80dc 100644
--- a/typing-break/drwright.c
+++ b/typing-break/drwright.c
@@ -27,7 +27,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#ifdef HAVE_APP_INDICATOR
#include <libappindicator/app-indicator.h>
@@ -548,39 +548,32 @@ activity_detected_cb (DrwMonitor *monitor,
}
static void
-mateconf_notify_cb (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+gsettings_notify_cb (GSettings *settings,
+ gchar *key,
gpointer user_data)
{
DrWright *dr = user_data;
GtkWidget *item;
- if (!strcmp (entry->key, MATECONF_PATH "/type_time")) {
- if (entry->value->type == MATECONF_VALUE_INT) {
- dr->type_time = 60 * mateconf_value_get_int (entry->value);
- dr->warn_time = MIN (dr->type_time / 10, 5*60);
+ if (!strcmp (key, "type-time")) {
+ dr->type_time = 60 * g_settings_get_int (settings, key);
+ dr->warn_time = MIN (dr->type_time / 10, 5*60);
- dr->state = STATE_START;
- }
+ dr->state = STATE_START;
}
- else if (!strcmp (entry->key, MATECONF_PATH "/break_time")) {
- if (entry->value->type == MATECONF_VALUE_INT) {
- dr->break_time = 60 * mateconf_value_get_int (entry->value);
- dr->state = STATE_START;
- }
+ else if (!strcmp (key, "break-time")) {
+ dr->break_time = 60 * g_settings_get_int (settings, key);
+ dr->state = STATE_START;
}
- else if (!strcmp (entry->key, MATECONF_PATH "/enabled")) {
- if (entry->value->type == MATECONF_VALUE_BOOL) {
- dr->enabled = mateconf_value_get_bool (entry->value);
- dr->state = STATE_START;
+ else if (!strcmp (key, "enabled")) {
+ dr->enabled = g_settings_get_boolean (settings, key);
+ dr->state = STATE_START;
- item = gtk_ui_manager_get_widget (dr->ui_manager,
- "/Pop/TakeABreak");
- gtk_widget_set_sensitive (item, dr->enabled);
+ item = gtk_ui_manager_get_widget (dr->ui_manager,
+ "/Pop/TakeABreak");
+ gtk_widget_set_sensitive (item, dr->enabled);
- update_status (dr);
- }
+ update_status (dr);
}
maybe_change_state (dr);
@@ -810,7 +803,7 @@ drwright_new (void)
{
DrWright *dr;
GtkWidget *item;
- MateConfClient *client;
+ GSettings *settings;
GtkActionGroup *action_group;
static const char ui_description[] =
@@ -825,33 +818,17 @@ drwright_new (void)
dr = g_new0 (DrWright, 1);
- client = mateconf_client_get_default ();
+ settings = g_settings_new (TYPING_BREAK_SCHEMA);
- mateconf_client_add_dir (client,
- MATECONF_PATH,
- MATECONF_CLIENT_PRELOAD_NONE,
- NULL);
+ g_signal_connect (settings, "changed", G_CALLBACK (gsettings_notify_cb), dr);
- mateconf_client_notify_add (client, MATECONF_PATH,
- mateconf_notify_cb,
- dr,
- NULL,
- NULL);
-
- dr->type_time = 60 * mateconf_client_get_int (
- client, MATECONF_PATH "/type_time", NULL);
+ dr->type_time = 60 * g_settings_get_int (settings, "type-time");
dr->warn_time = MIN (dr->type_time / 12, 60*3);
- dr->break_time = 60 * mateconf_client_get_int (
- client, MATECONF_PATH "/break_time", NULL);
-
- dr->enabled = mateconf_client_get_bool (
- client,
- MATECONF_PATH "/enabled",
- NULL);
+ dr->break_time = 60 * g_settings_get_int (settings, "break-time");
- g_object_unref (client);
+ dr->enabled = g_settings_get_boolean (settings, "enabled");
if (debug) {
setup_debug_values (dr);
diff --git a/typing-break/drwright.h b/typing-break/drwright.h
index 5c9478d9..6a44e8c4 100644
--- a/typing-break/drwright.h
+++ b/typing-break/drwright.h
@@ -21,7 +21,7 @@
#ifndef __DR_WRIGHT_H__
#define __DR_WRIGHT_H__
-#define MATECONF_PATH "/desktop/mate/typing_break"
+#define TYPING_BREAK_SCHEMA "org.mate.typing-break"
typedef struct _DrWright DrWright;