changeset 214:148fa8a8be8e

- trying a new way to suppress window blinking in WIN32 - tweaked prefs.ui
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 26 Aug 2008 18:56:06 +0900
parents 68d2e1b46a15
children 6b258bdd9c49
files pidgin-twitter.c pidgin-twitter.h prefs.ui
diffstat 3 files changed, 37 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.c	Mon Aug 25 21:47:51 2008 +0900
+++ b/pidgin-twitter.c	Tue Aug 26 18:56:06 2008 +0900
@@ -34,6 +34,10 @@
 static GList *postedlist = NULL;
 static gchar *wassr_post = NULL;
 static gchar *identica_post = NULL;
+#ifdef _WIN32
+static gboolean blink_state = FALSE;
+static gboolean blink_modified = FALSE;
+#endif
 
 static struct _source {
     guint id;
@@ -494,6 +498,17 @@
     if(doc == NULL)
         return;
 
+#ifdef _WIN32
+    /* suppress notification of incoming messages. */
+    if(purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)) {
+        if(!blink_modified) {
+            blink_modified = TRUE;
+            blink_state = purple_prefs_get_bool(OPT_PIDGIN_BLINK_IM);
+            purple_prefs_set_bool(OPT_PIDGIN_BLINK_IM, FALSE);
+        }
+    }
+#endif
+
      for(nptr = doc->children; nptr != NULL; nptr = nptr->next) {
         if(nptr->type == XML_ELEMENT_NODE &&
            !xmlStrcmp(nptr->name, (xmlChar *)"statuses")) {
@@ -1551,7 +1566,7 @@
             twitter_debug("candidate = %s\n", *candidate);
             if(!strcmp(user, *candidate)) {
                 twitter_debug("match. filter %s\n", user);
-                *flags |= PURPLE_MESSAGE_INVISIBLE; /* pidgin should handle this flag properly --yaz */
+//                *flags |= PURPLE_MESSAGE_INVISIBLE; /* pidgin should handle this flag properly --yaz */
 #if 1
                 /* temporal workaround */
                 g_free(*sender); *sender = NULL;
@@ -1579,10 +1594,23 @@
 
     gint service = get_service_type(conv);
 
+#ifdef _WIN32
     /* suppress notification of incoming messages. */
     if(service != unknown_service &&
-       purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION))
-        *flags |= PURPLE_MESSAGE_SYSTEM;
+       purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)) {
+        if(!blink_modified) {
+            blink_modified = TRUE;
+            blink_state = purple_prefs_get_bool(OPT_PIDGIN_BLINK_IM);
+            purple_prefs_set_bool(OPT_PIDGIN_BLINK_IM, FALSE);
+        }
+    }
+    else {
+        if(blink_modified) {
+            purple_prefs_set_bool(OPT_PIDGIN_BLINK_IM, blink_state);
+            blink_modified = FALSE;
+        }
+    }
+#endif
 
     if(service == wassr_service) {
         /* suppress annoying completion message from wassr */
--- a/pidgin-twitter.h	Mon Aug 25 21:47:51 2008 +0900
+++ b/pidgin-twitter.h	Tue Aug 26 18:56:06 2008 +0900
@@ -125,6 +125,9 @@
 #define OPT_FILTER_TWITTER      OPT_PIDGINTWITTER "/filter_twitter"
 #define OPT_FILTER_WASSR        OPT_PIDGINTWITTER "/filter_wassr"
 #define OPT_FILTER_IDENTICA     OPT_PIDGINTWITTER "/filter_identica"
+#ifdef _WIN32
+#define OPT_PIDGIN_BLINK_IM     PIDGIN_PREFS_ROOT "/win32/blink_im"
+#endif
 
 /* formats and templates */
 #define RECIPIENT_FORMAT_TWITTER "@<a href='http://twitter.com/%s'>%s</a>"
--- a/prefs.ui	Mon Aug 25 21:47:51 2008 +0900
+++ b/prefs.ui	Tue Aug 26 18:56:06 2008 +0900
@@ -485,7 +485,7 @@
                   <object class="GtkCheckButton" id="filter_check">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="label" translatable="yes">Apply filters</property>
+                    <property name="label" translatable="yes">Apply filter</property>
                     <property name="response_id">0</property>
                     <property name="draw_indicator">True</property>
                   </object>
@@ -509,7 +509,7 @@
                   <object class="GtkLabel" id="label31">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes">&lt;b&gt;User list for filtering&lt;/b&gt;</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Users to be filtered&lt;/b&gt;</property>
                     <property name="use_markup">True</property>
                   </object>
                 </child>
@@ -1415,7 +1415,7 @@
                   <object class="GtkCheckButton" id="utility_notify">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="label" translatable="yes">Do not notify incoming messages</property>
+                    <property name="label" translatable="yes">Do not notify incoming messages (windows only)</property>
                     <property name="response_id">0</property>
                     <property name="draw_indicator">True</property>
                   </object>