added debug inaformation and redisigned dbus signals
authorVlad <vlad@gas.by>
Wed, 19 May 2010 06:15:04 +0000 (09:15 +0300)
committerVlad <vlad@gas.by>
Wed, 19 May 2010 06:15:04 +0000 (09:15 +0300)
applet/src/livewp-actor.c
applet/src/livewp-common.h
applet/src/livewp-dbus.c

index 916880f..cd4790e 100644 (file)
@@ -185,8 +185,8 @@ change_billboard(Actor * actor, AWallpaperPlugin *desktop_plugin)
     GtkWidget *label;
     gchar *mes = NULL;
     PangoFontDescription *pfd = NULL;
-    
-    
+     
+     fprintf(stderr, "change_billboard\n");   
     if (desktop_plugin->priv->scene->notification){
         label = actor->image;
         mes = g_markup_printf_escaped("<span bgcolor=\"%s\" foreground=\"%s\">%s</span>", "#FFFFFF", "#000000", 
index 6462971..c934843 100644 (file)
@@ -109,9 +109,6 @@ struct _AWallpaperPluginClass
 #define NOTIFY_SIGNAL_INTERFACE "org.freedesktop.Notifications"
 #define NOTIFY_SIGNAL_PATH "/org/freedesktop/Notifications"
 #define NOTIFY_MEMBER "Notify"
-
-#define CLOSENOTIFY_SIGNAL_INTERFACE "org.freedesktop.Notifications"
-#define CLOSENOTIFY_SIGNAL_PATH "/org/freedesktop/Notifications"
 #define CLOSENOTIFY_MEMBER "CloseNotification"
 
 #endif
index 9f92ef7..6b4034f 100644 (file)
@@ -49,6 +49,19 @@ livewp_initialize_dbus(Animation_WallpaperPrivate *priv){
         dbus_connection_add_filter(priv->dbus_conn_session,
                                    (DBusHandleMessageFunction)get_livewp_signal_cb,
                                    priv, NULL);
+       filter_string =
+            g_strdup_printf("type='signal', interface='%s'", NOTIFY_SIGNAL_INTERFACE);
+        dbus_bus_add_match(priv->dbus_conn_session, filter_string, &error);
+        if (dbus_error_is_set(&error)){
+             fprintf(stderr,"dbus_bus_add_match failed: %s", error.message);
+             dbus_error_free(&error);
+        }
+        g_free(filter_string);
+        /* add the callback */
+        dbus_connection_add_filter(priv->dbus_conn_session,
+                                   (DBusHandleMessageFunction)get_livewp_signal_cb,
+                                   priv, NULL);
+
     }
 }
 /*******************************************************************************/
@@ -75,6 +88,23 @@ livewp_deinitialize_dbus(Animation_WallpaperPrivate *priv){
         }
 
          g_free(filter_string);
+         filter_string =
+                g_strdup_printf("type='signal', interface='%s'", NOTIFY_SIGNAL_INTERFACE);
+
+        dbus_error_init (&error);
+        dbus_bus_remove_match(priv->dbus_conn_session, filter_string, &error);
+        if (!dbus_error_is_set(&error)){
+            dbus_connection_remove_filter(priv->dbus_conn_session,
+                                          (DBusHandleMessageFunction)get_livewp_signal_cb, 
+                                          NULL);
+        }else{
+      
+            fprintf(stderr,"dbus_bus_add_match failed: %s", error.message);
+            dbus_error_free(&error);
+        }
+
+         g_free(filter_string);
+
     }
 
 }
@@ -108,7 +138,7 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
     START_FUNCTION;
 #endif
 
-    //fprintf (stderr, "PATH11111111111111111111 %s %s %s\n",   dbus_message_get_path(msg),   dbus_message_get_interface (msg), dbus_message_get_member (msg));
+    fprintf (stderr, "PATH11111111111111111111 %s %s %s\n",   dbus_message_get_path(msg),   dbus_message_get_interface (msg), dbus_message_get_member (msg));
     if (dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_RELOAD_CONFIG)){
         if(read_config(priv)){
                 fprintf(stderr, "\nCan not read config file.\n");
@@ -119,9 +149,8 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
 #endif
         }
     }
-    if (dbus_message_is_signal(msg, NOTIFY_SIGNAL_INTERFACE, NOTIFY_MEMBER) 
-        || dbus_message_is_signal(msg, CLOSENOTIFY_SIGNAL_INTERFACE, CLOSENOTIFY_MEMBER) ){
-        //fprintf(stderr,"read notifications.db\n");    
+    if (dbus_message_is_signal(msg, NOTIFY_SIGNAL_INTERFACE, NOTIFY_MEMBER)){
+        fprintf(stderr,"read notifications.db\n");    
         read_notification(priv->desktop_plugin);
     }
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;