remaked take notification with dbus
authortanya <tanyshk@gmail.com>
Tue, 18 May 2010 14:40:10 +0000 (17:40 +0300)
committertanya <tanyshk@gmail.com>
Tue, 18 May 2010 14:40:10 +0000 (17:40 +0300)
applet/src/livewp-actor.c
applet/src/livewp-actor.h
applet/src/livewp-common.h
applet/src/livewp-rules.c
applet/src/livewp-scene.c

index f37ea91..916880f 100644 (file)
@@ -141,16 +141,12 @@ int get_notify_count(gchar *notify_type)
     }
     return result;
 }
-
-void 
-change_billboard(Actor * actor, AWallpaperPlugin *desktop_plugin)
+void read_notification(AWallpaperPlugin *desktop_plugin)
 {
-    GtkWidget *label;
-    gchar *message = NULL, *mes = NULL;
-    PangoFontDescription *pfd = NULL;
+    gchar *message = NULL;
     gint count = 0;
     
-    label = actor->image;
+    fprintf(stderr, "read notification \n");
     count = get_notify_count("missed");
     if (count > 0){
         message = g_strdup_printf("%s: %d", _("Missed calls"), count);
@@ -179,18 +175,29 @@ change_billboard(Actor * actor, AWallpaperPlugin *desktop_plugin)
             message = g_strdup_printf("%s: %d", _("Missed mail"), count);
         }
     }
+    desktop_plugin->priv->scene->notification = g_strdup(message);
+    g_free(message);
+}
 
-    //fprintf(stderr, "message = %s", message);
-    if (message){
-        mes = g_markup_printf_escaped("<span bgcolor=\"%s\" foreground=\"%s\">%s</span>", "#FFFFFF", "#000000", message);
+void 
+change_billboard(Actor * actor, AWallpaperPlugin *desktop_plugin)
+{
+    GtkWidget *label;
+    gchar *mes = NULL;
+    PangoFontDescription *pfd = NULL;
+    
+    
+    if (desktop_plugin->priv->scene->notification){
+        label = actor->image;
+        mes = g_markup_printf_escaped("<span bgcolor=\"%s\" foreground=\"%s\">%s</span>", "#FFFFFF", "#000000", 
+                                      desktop_plugin->priv->scene->notification);
         gtk_label_set_markup(GTK_LABEL(label), mes);
-        g_free(message);
-        pfd = pango_font_description_from_string("Sans 14");
+        pfd = pango_font_description_from_string("Sans 16");
         gtk_widget_modify_font(GTK_WIDGET(label), NULL);
         gtk_widget_modify_font(GTK_WIDGET(label), pfd);
         pango_font_description_free(pfd);
-        actor->time_start_animation = time(NULL) + 20;    
     }
+    actor->time_start_animation = time(NULL) + 20;    
 }
 
 
index cfe92a5..16b9ea4 100644 (file)
@@ -71,6 +71,7 @@ Actor* init_object(AWallpaperPlugin *desktop_plugin,
             GPtrArray *child
            );
 void destroy_actor(Actor *actor);
+void read_notification(AWallpaperPlugin *desktop_plugin);
 void set_actor_position(Actor *actor, gint x, gint y, gint z, AWallpaperPlugin *desktop_plugin);
 void set_actor_scale(Actor *actor, double scalex, double scaley);
 void set_actor_visible(Actor *actor, gboolean visible);
index 87e4b53..6462971 100644 (file)
@@ -60,6 +60,7 @@ struct _Scene
     gint wind_orientation; // +/- 1
     double wind_angle; // [-1 .. 1]
     guint seed; /* init value for random  */
+    gchar *notification;
 };
 typedef struct _AWallpaperPlugin AWallpaperPlugin;
 typedef struct _AWallpaperPluginClass AWallpaperPluginClass;
index d32e834..7658e6e 100644 (file)
@@ -150,12 +150,11 @@ int get_moon_phase()
 gint 
 fast_rnd(gint max)
 {
-/*    guint offset = 12923; */
-/*    guint multiplier = 4079; */
-    
-    //*seed = *seed * multiplier + offset;
-    //return (gint)(*seed % max);
-    guint seed = time(NULL);
+    guint offset = 12923; 
+    guint multiplier = 4079; 
+    static guint seed = 123;
+
+    seed = seed * multiplier + offset;
     return (gint)(seed % max);
 }
 void 
index d012083..ebf8aa5 100644 (file)
@@ -158,7 +158,9 @@ init_scene_Modern(AWallpaperPlugin *desktop_plugin)
   scene->wind_angle = 0.3;
   /* init value for random */
   scene->seed = time(NULL);
+  scene->notification = NULL;
   desktop_plugin->priv->scene = scene;
+  read_notification(desktop_plugin);
 
   actor = init_object(desktop_plugin, "sky", "sky0.png", 
                       0, 0, 5, 800, 480,