changed license to GPL v2
[livewp] / applet / src / livewp-dbus.c
index 9760d2c..9836476 100644 (file)
@@ -7,8 +7,8 @@
  *       for the code
  * 
  * This software is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of
  * the License, or (at your option) any later version.
  * 
  * This software is distributed in the hope that it will be useful, but
@@ -90,6 +90,7 @@ livewp_deinitialize_dbus(Animation_WallpaperPrivate *priv){
         }
 
          g_free(filter_string);
+         /*
          filter_string =
                 g_strdup_printf("type='signal', interface='%s'", NOTIFY_SIGNAL_INTERFACE);
 
@@ -106,7 +107,7 @@ livewp_deinitialize_dbus(Animation_WallpaperPrivate *priv){
         }
 
          g_free(filter_string);
-
+*/
     }
 
 }
@@ -118,12 +119,34 @@ send_dbus_signal (Animation_WallpaperPrivate *priv,
                   const gchar *member)
 {
   gboolean       success;
+/*    
+  gint param = 0;
+  dbus_uint32_t serial = 0;
+  DBusMessageIter args;
+*/
   
   DBusMessage *message = dbus_message_new (DBUS_MESSAGE_TYPE_SIGNAL);
   dbus_message_set_interface (message, interface);
   dbus_message_set_path (message, path);
   dbus_message_set_member (message, member);
+  /*
+  if (member == LIVEWP_PLAY_LIVEBG_ON_VIEW ||
+      member == LIVEWP_PAUSE_LIVEBG_ON_VIEW){
+      param = priv->view + 1;
+
+      fprintf(stderr, "dbus send try send %s %i\n", member, param);
+      dbus_message_iter_init_append(message, &args);
+      if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &param)){
+          fprintf(stderr, "error append param\n");
+      }
+  }
+  if (!dbus_connection_send(priv->dbus_conn_session, message, &serial)){
+      fprintf(stderr, "error send\n");
+  }
+  dbus_connection_flush(priv->dbus_conn_session);
+  */
   success = dbus_connection_send (priv->dbus_conn_session, message, NULL);
+  dbus_connection_flush(priv->dbus_conn_session);
   dbus_message_unref (message);
   
 #if 0
@@ -143,7 +166,7 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
     START_FUNCTION;
 #endif
 
-//#if 0
+#if 0
 #if  defined APPLICATION 
     fprintf (stderr, "APPLICATION PATH11111111111111111111 %s %s %s\n",   dbus_message_get_path(msg),   dbus_message_get_interface (msg), dbus_message_get_member (msg)); 
 #endif
@@ -155,8 +178,7 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
 #if !(defined CONTROLPANEL || defined APPLICATION) 
     fprintf (stderr, "APPLET PATH11111111111111111111 %s %s %s\n",   dbus_message_get_path(msg),   dbus_message_get_interface (msg), dbus_message_get_member (msg)); 
 #endif
-//#endif
-
+#endif
     if (!priv)
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
@@ -184,6 +206,7 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
         (priv->view == 2 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW2))||   
         (priv->view == 3 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW3))||   
         (priv->view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW4))){
+        /* fprintf(stderr, "Play scene visible %i\n", priv->visible); */
         if (priv->visible != TRUE){
             priv->visible = TRUE;
             view_state_changed(priv);
@@ -194,6 +217,7 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
         (priv->view == 2 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW2))||   
         (priv->view == 3 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW3))||   
         (priv->view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW4))){
+         /* fprintf(stderr, "Pause scene visible %i\n", priv->visible); */
          if (priv->visible != FALSE){
             priv->visible = FALSE;
             view_state_changed(priv);
@@ -208,6 +232,7 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
         priv->last_alive_event = time(NULL);
     }
 
+    /* Check notification of mail, sms, call */
   //fprintf(stderr, "Type %i\n", dbus_message_get_type (msg));
     if (dbus_message_is_method_call(msg, NOTIFY_SIGNAL_INTERFACE, NOTIFY_MEMBER)){
         //fprintf(stderr,"read notifications.db notify\n");