diff options
author | Jonas Bonn <jonas@southpole.se> | 2010-03-05 19:55:25 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-05-27 22:59:58 +0800 |
commit | 6da94f6bce71e0d2c1b44260da986eecd089defa (patch) | |
tree | 73d11d049066e4cd14e13cd815ff6df642c088f8 /libempathy | |
parent | 2f9166bf42462e44b40462cbd9fc562f6cf507af (diff) | |
download | gsoc2013-empathy-6da94f6bce71e0d2c1b44260da986eecd089defa.tar gsoc2013-empathy-6da94f6bce71e0d2c1b44260da986eecd089defa.tar.gz gsoc2013-empathy-6da94f6bce71e0d2c1b44260da986eecd089defa.tar.bz2 gsoc2013-empathy-6da94f6bce71e0d2c1b44260da986eecd089defa.tar.lz gsoc2013-empathy-6da94f6bce71e0d2c1b44260da986eecd089defa.tar.xz gsoc2013-empathy-6da94f6bce71e0d2c1b44260da986eecd089defa.tar.zst gsoc2013-empathy-6da94f6bce71e0d2c1b44260da986eecd089defa.zip |
Add option to make chatroom "always urgent" (#611894)
Often a user wants to be immediately notified of posts to a chatroom even when
the post does not address them directly by name. This patch adds a room
option to make all posts to the room "urgent", meaning that the system-specific
urgency action should be taken -- notification, window urgency hint, etc.
Two specific use cases for when one may want this:
i) Low-traffic rooms (so that one does not have to go check the room all the
time)
ii) Error-logging room (room to which errors from some other system(s) are
logged)
The "always urgent" option is off by default when joining a room.
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-chatroom.c | 48 | ||||
-rw-r--r-- | libempathy/empathy-chatroom.h | 3 |
2 files changed, 50 insertions, 1 deletions
diff --git a/libempathy/empathy-chatroom.c b/libempathy/empathy-chatroom.c index 5d43a3ec1..5e3784ae7 100644 --- a/libempathy/empathy-chatroom.c +++ b/libempathy/empathy-chatroom.c @@ -41,6 +41,7 @@ typedef struct { guint members_count; gboolean invite_only; gboolean need_password; + gboolean always_urgent; } EmpathyChatroomPriv; @@ -65,7 +66,8 @@ enum { PROP_SUBJECT, PROP_MEMBERS_COUNT, PROP_NEED_PASSWORD, - PROP_INVITE_ONLY + PROP_INVITE_ONLY, + PROP_ALWAYS_URGENT, }; G_DEFINE_TYPE (EmpathyChatroom, empathy_chatroom, G_TYPE_OBJECT); @@ -121,6 +123,14 @@ empathy_chatroom_class_init (EmpathyChatroomClass *klass) G_PARAM_CONSTRUCT)); g_object_class_install_property (object_class, + PROP_ALWAYS_URGENT, + g_param_spec_boolean ("always_urgent", + "Always Urgent", + "TRUE if every message should be considered urgent", + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, PROP_TP_CHAT, g_param_spec_object ("tp-chat", "Chatroom channel wrapper", @@ -233,6 +243,9 @@ chatroom_get_property (GObject *object, case PROP_FAVORITE: g_value_set_boolean (value, priv->favorite); break; + case PROP_ALWAYS_URGENT: + g_value_set_boolean (value, priv->always_urgent); + break; case PROP_TP_CHAT: g_value_set_object (value, priv->tp_chat); break; @@ -285,6 +298,10 @@ chatroom_set_property (GObject *object, empathy_chatroom_set_favorite (EMPATHY_CHATROOM (object), g_value_get_boolean (value)); break; + case PROP_ALWAYS_URGENT: + empathy_chatroom_set_always_urgent (EMPATHY_CHATROOM (object), + g_value_get_boolean (value)); + break; case PROP_TP_CHAT: empathy_chatroom_set_tp_chat (EMPATHY_CHATROOM (object), g_value_get_object (value)); @@ -663,3 +680,32 @@ empathy_chatroom_set_favorite (EmpathyChatroom *chatroom, g_object_notify (G_OBJECT (chatroom), "favorite"); } +gboolean +empathy_chatroom_is_always_urgent (EmpathyChatroom *chatroom) +{ + EmpathyChatroomPriv *priv; + + g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), FALSE); + + priv = GET_PRIV (chatroom); + + return priv->always_urgent; +} + +void +empathy_chatroom_set_always_urgent (EmpathyChatroom *chatroom, + gboolean always_urgent) +{ + EmpathyChatroomPriv *priv; + + g_return_if_fail (EMPATHY_IS_CHATROOM (chatroom)); + + priv = GET_PRIV (chatroom); + + if (priv->always_urgent == always_urgent) + return; + + priv->always_urgent = always_urgent; + g_object_notify (G_OBJECT (chatroom), "always_urgent"); +} + diff --git a/libempathy/empathy-chatroom.h b/libempathy/empathy-chatroom.h index 3048aded7..f86f8ca9e 100644 --- a/libempathy/empathy-chatroom.h +++ b/libempathy/empathy-chatroom.h @@ -89,6 +89,9 @@ void empathy_chatroom_set_tp_chat (EmpathyChatroom *chatroom, gboolean empathy_chatroom_is_favorite (EmpathyChatroom *chatroom); void empathy_chatroom_set_favorite (EmpathyChatroom *chatroom, gboolean favorite); +gboolean empathy_chatroom_is_always_urgent (EmpathyChatroom *chatroom); +void empathy_chatroom_set_always_urgent (EmpathyChatroom *chatroom, + gboolean always_urgent); G_END_DECLS |