aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Bonn <jonas@southpole.se>2010-03-05 23:52:08 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-05-27 23:00:15 +0800
commitc886f096cf16280f02e4f5c4b3211f6dc8711f97 (patch)
treef29f6ea67b2e0ddd5f0dc3505ab3cb7bf50b5cb4
parent6da94f6bce71e0d2c1b44260da986eecd089defa (diff)
downloadgsoc2013-empathy-c886f096cf16280f02e4f5c4b3211f6dc8711f97.tar
gsoc2013-empathy-c886f096cf16280f02e4f5c4b3211f6dc8711f97.tar.gz
gsoc2013-empathy-c886f096cf16280f02e4f5c4b3211f6dc8711f97.tar.bz2
gsoc2013-empathy-c886f096cf16280f02e4f5c4b3211f6dc8711f97.tar.lz
gsoc2013-empathy-c886f096cf16280f02e4f5c4b3211f6dc8711f97.tar.xz
gsoc2013-empathy-c886f096cf16280f02e4f5c4b3211f6dc8711f97.tar.zst
gsoc2013-empathy-c886f096cf16280f02e4f5c4b3211f6dc8711f97.zip
Make chatroom manager retain room's "always_urgent" state
This patch adds the always_urgent property to the list of chatroom properties that are saved by the chatroom manager for the favorite chatrooms. This allows Empathy to bring favorite chatrooms back up with the same notification properties they had the last time they were used. This seems reasonable as a room marked as "Notify Always" will most likely be of such a character that this would be a reasonable setting every time the room is joined.
-rw-r--r--libempathy/empathy-chatroom-manager.c14
-rw-r--r--libempathy/empathy-chatroom-manager.dtd3
2 files changed, 16 insertions, 1 deletions
diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index cf3b75331..57aa75402 100644
--- a/libempathy/empathy-chatroom-manager.c
+++ b/libempathy/empathy-chatroom-manager.c
@@ -32,6 +32,7 @@
#include <telepathy-glib/account-manager.h>
#include <telepathy-glib/interfaces.h>
+#include <telepathy-glib/util.h>
#include "empathy-tp-chat.h"
#include "empathy-chatroom-manager.h"
@@ -118,6 +119,9 @@ chatroom_manager_file_save (EmpathyChatroomManager *manager)
xmlNewTextChild (node, NULL, (const xmlChar *) "auto_connect",
empathy_chatroom_get_auto_connect (chatroom) ?
(const xmlChar *) "yes" : (const xmlChar *) "no");
+ xmlNewTextChild (node, NULL, (const xmlChar *) "always_urgent",
+ empathy_chatroom_is_always_urgent (chatroom) ?
+ (const xmlChar *) "yes" : (const xmlChar *) "no");
}
/* Make sure the XML is indented properly */
@@ -190,6 +194,7 @@ chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
gchar *room;
gchar *account_id;
gboolean auto_connect;
+ gboolean always_urgent;
priv = GET_PRIV (manager);
@@ -197,6 +202,7 @@ chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
name = NULL;
room = NULL;
auto_connect = TRUE;
+ always_urgent = FALSE;
account_id = NULL;
for (child = node->children; child; child = child->next) {
@@ -222,6 +228,13 @@ chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
auto_connect = FALSE;
}
}
+ else if (!tp_strdiff (tag, "always_urgent")) {
+ if (strcmp (str, "yes") == 0) {
+ always_urgent = TRUE;
+ } else {
+ always_urgent = FALSE;
+ }
+ }
else if (strcmp (tag, "account") == 0) {
account_id = g_strdup (str);
}
@@ -240,6 +253,7 @@ chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
chatroom = empathy_chatroom_new_full (account, room, name, auto_connect);
empathy_chatroom_set_favorite (chatroom, TRUE);
+ empathy_chatroom_set_always_urgent (chatroom, always_urgent);
add_chatroom (manager, chatroom);
g_signal_emit (manager, signals[CHATROOM_ADDED], 0, chatroom);
diff --git a/libempathy/empathy-chatroom-manager.dtd b/libempathy/empathy-chatroom-manager.dtd
index df6b953f6..d40cae23a 100644
--- a/libempathy/empathy-chatroom-manager.dtd
+++ b/libempathy/empathy-chatroom-manager.dtd
@@ -8,10 +8,11 @@
<!ELEMENT chatrooms (chatroom*)>
<!ELEMENT chatroom
- (name,room,account,(auto_connect?))>
+ (name,room,account,(auto_connect?),(always_urgent?))>
<!ELEMENT name (#PCDATA)>
<!ELEMENT room (#PCDATA)>
<!ELEMENT auto_connect (#PCDATA)>
+<!ELEMENT always_urgent (#PCDATA)>
<!ELEMENT account (#PCDATA)>