aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorJonny Lamb <jonnylamb@gnome.org>2011-05-13 18:25:06 +0800
committerJonny Lamb <jonnylamb@gnome.org>2011-05-13 22:25:14 +0800
commit5080aa2351deb6abe0aa1cc442fd1175f2eaa70e (patch)
treec98d77c9054b354125e34c243ea97adec1827f5e /libempathy-gtk
parentbd0755be84f285e48272fb0b7ac154bad4be0902 (diff)
downloadgsoc2013-empathy-5080aa2351deb6abe0aa1cc442fd1175f2eaa70e.tar
gsoc2013-empathy-5080aa2351deb6abe0aa1cc442fd1175f2eaa70e.tar.gz
gsoc2013-empathy-5080aa2351deb6abe0aa1cc442fd1175f2eaa70e.tar.bz2
gsoc2013-empathy-5080aa2351deb6abe0aa1cc442fd1175f2eaa70e.tar.lz
gsoc2013-empathy-5080aa2351deb6abe0aa1cc442fd1175f2eaa70e.tar.xz
gsoc2013-empathy-5080aa2351deb6abe0aa1cc442fd1175f2eaa70e.tar.zst
gsoc2013-empathy-5080aa2351deb6abe0aa1cc442fd1175f2eaa70e.zip
adium: split removing unread markers into two functions
Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-theme-adium.c60
1 files changed, 34 insertions, 26 deletions
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c
index c947c2897..1a213ff91 100644
--- a/libempathy-gtk/empathy-theme-adium.c
+++ b/libempathy-gtk/empathy-theme-adium.c
@@ -569,32 +569,10 @@ theme_adium_append_event_escaped (EmpathyChatView *view,
}
static void
-theme_adium_remove_focus_marks (EmpathyThemeAdium *theme)
+theme_adium_remove_focus_marks (EmpathyThemeAdium *theme,
+ WebKitDOMNodeList *nodes)
{
- EmpathyThemeAdiumPriv *priv = GET_PRIV (theme);
- WebKitDOMDocument *dom;
- WebKitDOMNodeList *nodes;
guint i;
- GError *error = NULL;
-
- if (!priv->has_unread_message)
- return;
-
- priv->has_unread_message = FALSE;
-
- dom = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (theme));
- if (dom == NULL) {
- return;
- }
-
- /* Get all nodes with focus class */
- nodes = webkit_dom_document_query_selector_all (dom, ".focus", &error);
- if (nodes == NULL) {
- DEBUG ("Error getting focus nodes: %s",
- error ? error->message : "No error");
- g_clear_error (&error);
- return;
- }
/* Remove focus and firstFocus class */
for (i = 0; i < webkit_dom_node_list_get_length (nodes); i++) {
@@ -632,6 +610,36 @@ theme_adium_remove_focus_marks (EmpathyThemeAdium *theme)
}
static void
+theme_adium_remove_all_focus_marks (EmpathyThemeAdium *theme)
+{
+ EmpathyThemeAdiumPriv *priv = GET_PRIV (theme);
+ WebKitDOMDocument *dom;
+ WebKitDOMNodeList *nodes;
+ GError *error = NULL;
+
+ if (!priv->has_unread_message)
+ return;
+
+ priv->has_unread_message = FALSE;
+
+ dom = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (theme));
+ if (dom == NULL) {
+ return;
+ }
+
+ /* Get all nodes with focus class */
+ nodes = webkit_dom_document_query_selector_all (dom, ".focus", &error);
+ if (nodes == NULL) {
+ DEBUG ("Error getting focus nodes: %s",
+ error ? error->message : "No error");
+ g_clear_error (&error);
+ return;
+ }
+
+ theme_adium_remove_focus_marks (theme, nodes);
+}
+
+static void
theme_adium_append_message (EmpathyChatView *view,
EmpathyMessage *msg)
{
@@ -788,7 +796,7 @@ theme_adium_append_message (EmpathyChatView *view,
}
/* remove all the unread marks when we are sending a message */
- theme_adium_remove_focus_marks (theme);
+ theme_adium_remove_all_focus_marks (theme);
} else {
/* in */
if (is_backlog) {
@@ -946,7 +954,7 @@ theme_adium_focus_toggled (EmpathyChatView *view,
priv->has_focus = has_focus;
if (!priv->has_focus) {
- theme_adium_remove_focus_marks (self);
+ theme_adium_remove_all_focus_marks (self);
}
}