[empathy] add gconf key to disable auto-away (#613603)



commit 597aeabb364bc04027209e0a37fae53a7d4208b8
Author: Christian Kampka <chris emerge-life de>
Date:   Tue Mar 30 14:23:49 2010 +0200

    add gconf key to disable auto-away (#613603)

 data/empathy.schemas.in       |   14 ++++++++++++++
 libempathy-gtk/empathy-conf.h |    1 +
 src/empathy.c                 |   25 +++++++++++++++++++++++--
 3 files changed, 38 insertions(+), 2 deletions(-)
---
diff --git a/data/empathy.schemas.in b/data/empathy.schemas.in
index e151fb5..5ed04e7 100644
--- a/data/empathy.schemas.in
+++ b/data/empathy.schemas.in
@@ -522,6 +522,20 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/empathy/autoaway</key>
+      <applyto>/apps/empathy/autoaway</applyto>
+      <owner>empathy</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+        <short>Empathy should auto-away when idle</short>
+        <long>
+        Whether Empathy should go into away mode automatically if user is idle.
+        </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/empathy/import_asked</key>
       <applyto>/apps/empathy/import_asked</applyto>
       <owner>empathy</owner>
diff --git a/libempathy-gtk/empathy-conf.h b/libempathy-gtk/empathy-conf.h
index 21e3b38..78d0bbd 100644
--- a/libempathy-gtk/empathy-conf.h
+++ b/libempathy-gtk/empathy-conf.h
@@ -81,6 +81,7 @@ struct _EmpathyConfClass {
 #define EMPATHY_PREFS_HINTS_CLOSE_MAIN_WINDOW      EMPATHY_PREFS_PATH "/hints/close_main_window"
 #define EMPATHY_PREFS_USE_CONN                     EMPATHY_PREFS_PATH "/use_conn"
 #define EMPATHY_PREFS_AUTOCONNECT                  EMPATHY_PREFS_PATH "/autoconnect"
+#define EMPATHY_PREFS_AUTOAWAY                     EMPATHY_PREFS_PATH "/autoaway"
 #define EMPATHY_PREFS_IMPORT_ASKED                 EMPATHY_PREFS_PATH "/import_asked"
 #define EMPATHY_PREFS_BUTTERFLY_LOGS_MIGRATED      EMPATHY_PREFS_PATH "/butterfly_logs_migrated"
 #define EMPATHY_PREFS_FILE_TRANSFER_DEFAULT_FOLDER EMPATHY_PREFS_PATH "/file_transfer/default_folder"
diff --git a/src/empathy.c b/src/empathy.c
index 377feea..8b2869a 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -549,6 +549,18 @@ chatroom_manager_ready_cb (EmpathyChatroomManager *chatroom_manager,
       account_manager_chatroom_ready_cb, chatroom_manager);
 }
 
+static void
+empathy_idle_set_auto_away_cb (EmpathyConf *conf,
+				const gchar *key,
+				gpointer user_data)
+{
+	gboolean autoaway;
+	EmpathyIdle *idle = user_data;
+
+	empathy_conf_get_bool (conf, key, &autoaway);
+	empathy_idle_set_auto_away (idle, autoaway);
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -572,7 +584,7 @@ main (int argc, char *argv[])
   GError *error = NULL;
   UniqueApp *unique_app;
   gboolean chatroom_manager_ready;
-
+  gboolean autoaway = TRUE;
 #ifdef ENABLE_DEBUG
   TpDebugSender *debug_sender;
 #endif /* ENABLE_TPL */
@@ -641,7 +653,16 @@ main (int argc, char *argv[])
 
   /* Setting up Idle */
   idle = empathy_idle_dup_singleton ();
-  empathy_idle_set_auto_away (idle, TRUE);
+
+  empathy_conf_get_bool (empathy_conf_get (),
+      EMPATHY_PREFS_AUTOAWAY, &autoaway);
+
+  empathy_conf_notify_add (empathy_conf_get (),
+			   EMPATHY_PREFS_AUTOAWAY,
+			   empathy_idle_set_auto_away_cb,
+			   idle);
+
+  empathy_idle_set_auto_away (idle, autoaway);
 
   /* Setting up Connectivity */
   connectivity = empathy_connectivity_dup_singleton ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]