added delay after dbus event
authortanya <tanyshk@gmail.com>
Tue, 8 Jun 2010 14:10:39 +0000 (17:10 +0300)
committertanya <tanyshk@gmail.com>
Tue, 8 Jun 2010 14:10:39 +0000 (17:10 +0300)
applet/data/theme/Modern/stend0.png
applet/src/livewp-actor.c
applet/src/livewp-common.h
applet/src/livewp-dbus.c

index 0844c7e..701ba1d 100755 (executable)
Binary files a/applet/data/theme/Modern/stend0.png and b/applet/data/theme/Modern/stend0.png differ
index 9148b57..83ce172 100644 (file)
@@ -125,7 +125,7 @@ int get_notify_count(gchar *notify_type)
     if (rc){
         fprintf(stderr, "error open db %d %s\n", rc, sqlite3_errmsg(db));
     }else {
-        snprintf(sql, sizeof(sql)-1, "select count(id) from notifications where icon_name='general_%s'", notify_type);
+        snprintf(sql, sizeof(sql)-1, "select count(id) from notifications where icon_name='%s'", notify_type);
         rc = sqlite3_prepare(db, sql, sizeof(sql)-1, &res, NULL);
         if (rc != SQLITE_OK){
             fprintf(stderr, "error prepare %d %s\n", rc, sql);
@@ -147,11 +147,11 @@ gchar * read_notification()
     gint count = 0;
     
     fprintf(stderr, "read notification \n");
-    count = get_notify_count("missed");
+    count = get_notify_count("general_missed");
     if (count > 0){
         message = g_strdup_printf("%s: %d", _("Missed calls"), count);
     }
-    count = get_notify_count("sms");
+    count = get_notify_count("general_sms");
     if (count > 0){
         if (message){
             message = g_strdup_printf("%s \n%s: %d", message, _("Missed sms"), count);
@@ -159,7 +159,7 @@ gchar * read_notification()
             message = g_strdup_printf("%s: %d", _("Missed sms"), count);
         }
     }
-    count = get_notify_count("chat");
+    count = get_notify_count("general_chat");
     if (count > 0){
         if (message){
             message = g_strdup_printf("%s \n%s: %d", message, _("Missed chat"), count);
@@ -167,7 +167,7 @@ gchar * read_notification()
             message = g_strdup_printf("%s: %d", _("Missed chat"), count);
         }
     }
-    count = get_notify_count("mail");
+    count = get_notify_count("qgn_list_messagin");
     if (count > 0){
         if (message){
             message = g_strdup_printf("%s \n%s: %d", message, _("Missed mail"), count);
@@ -175,6 +175,7 @@ gchar * read_notification()
             message = g_strdup_printf("%s: %d", _("Missed mail"), count);
         }
     }
+    fprintf(stderr, "notify=%s\n", message);
     return message;
 }
 
@@ -186,7 +187,7 @@ change_billboard(Actor * actor, AWallpaperPlugin *desktop_plugin)
     PangoFontDescription *pfd = NULL;
      
     fprintf(stderr, "change_billboard\n");   
-    if (desktop_plugin->priv->scene->notification){
+    if (desktop_plugin->priv->scene->notification < time(NULL)){
         message = read_notification();
         label = actor->image;
         mes = g_markup_printf_escaped("<span bgcolor=\"%s\" foreground=\"%s\">%s</span>", "#FFFFFF", "#000000", 
index 9416a41..8dcdd1c 100644 (file)
@@ -60,7 +60,7 @@ struct _Scene
     gint wind_orientation; // +/- 1
     double wind_angle; // [-1 .. 1]
     guint seed; /* init value for random  */
-    gboolean notification;
+    guint notification;
 };
 typedef struct _AWallpaperPlugin AWallpaperPlugin;
 typedef struct _AWallpaperPluginClass AWallpaperPluginClass;
index 8c5871f..879a8e1 100644 (file)
@@ -154,12 +154,12 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
     if (dbus_message_is_method_call(msg, NOTIFY_SIGNAL_INTERFACE, NOTIFY_MEMBER)){
         fprintf(stderr,"read notifications.db notify\n");    
         //read_notification(priv->desktop_plugin);
-        priv->scene->notification = TRUE;
+        priv->scene->notification = time(NULL) + 20;
     }
     if (dbus_message_is_signal(msg, NOTIFY_SIGNAL_INTERFACE, CLOSENOTIFY_MEMBER)){
         fprintf(stderr,"read notifications.db close notify\n");    
         //read_notification(priv->desktop_plugin);
-        priv->scene->notification = TRUE;
+        priv->scene->notification = time(NULL) + 20;
     }
 
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;