Merge branch 'master' of https://vcs.maemo.org/git/livewp
authorTanya <tanya@bookdmitri.oblgaz>
Mon, 12 Apr 2010 23:12:49 +0000 (02:12 +0300)
committerTanya <tanya@bookdmitri.oblgaz>
Mon, 12 Apr 2010 23:12:49 +0000 (02:12 +0300)
1  2 
applet/src/livewp-home-widget.c

@@@ -514,36 -514,6 +514,36 @@@ change_wind(Actor *actor, AWallpaperPlu
      fprintf(stderr, "change wind orient = %d angle = %f after = %d\n", scene.wind_orientation, scene.wind_angle, actor->time_start_animation-time(NULL));
  }
  
 +void 
 +change_window1(Actor * actor, AWallpaperPlugin *desktop_plugin)
 +{
 +    
 +    gint now = time(NULL);
 +
 +    if (scene.daytime == TIME_DAY){
 +        if (actor->visible){
 +            actor->visible = FALSE;
 +            destroy_hildon_actor(actor);
 +        }
 +        actor->time_start_animation = 0;
 +        return;
 +    }else if (actor->time_start_animation == 0){
 +        actor->time_start_animation = now + fast_rnd(30);
 +        return;
 +    }
 +
 +    if (!actor->visible){
 +        actor->visible = TRUE;
 +        create_hildon_actor(actor, desktop_plugin);
 +        actor->time_start_animation = now + fast_rnd(20) + 10;
 +    }else {
 +        actor->visible = FALSE;
 +        destroy_hildon_actor(actor);
 +        actor->time_start_animation = now + fast_rnd(20) + 10;
 +    }
 +   
 +}
 +
  void
  create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin) 
  {
@@@ -715,7 -685,7 +715,7 @@@ init_scene(AWallpaperPlugin *desktop_pl
  
    actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88, 
                        TRUE, 100, 255, (gpointer)&change_sun, &probability_sun);
 -  actor->time_start_animation = time(NULL);
 +  actor->time_start_animation = now;
    actor->duration_animation = G_MAXINT;
    change_sun(actor, desktop_plugin);
    scene.actors = g_slist_append(scene.actors, actor);
    change_wind(actor, desktop_plugin);
    scene.actors = g_slist_append(scene.actors, actor);
  
 +    /* windows in 4-th house  */
 +    gint winds[13][2];
 +    winds[0][0] = 482;
 +    winds[0][1] = 180;
 +
 +    winds[1][0] = 495;
 +    winds[1][1] = 179;
 +
 +    winds[2][0] = 482;
 +    winds[2][1] = 191;
 +
 +    winds[3][0] = 495;
 +    winds[3][1] = 190;
 +    
 +    winds[4][0] = 482;
 +    winds[4][1] = 201;
 +    
 +    winds[5][0] = 495;
 +    winds[5][1] = 210;
 +    
 +    winds[6][0] = 482;
 +    winds[6][1] = 222;
 +    
 +    winds[7][0] = 495;
 +    winds[7][1] = 221;
 +    
 +    winds[8][0] = 459;
 +    winds[8][1] = 203;
 +    
 +    winds[9][0] = 495;
 +    winds[9][1] = 241;
 +    
 +    winds[10][0] = 495;
 +    winds[10][1] = 252;
 +    
 +    winds[11][0] = 482;
 +    winds[11][1] = 273;
 +    
 +    winds[12][0] = 495;
 +    winds[12][1] = 303;
 +    gint i;
 +    for (i=0; i<13; i++){
 +        actor = init_object(desktop_plugin, "window1", "window1.png", 
 +                            winds[i][0], winds[i][1], 8, 8, 10, 
 +                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
 +        //change_window1(actor, desktop_plugin);
 +        actor->time_start_animation = now + fast_rnd(30);
 +        scene.actors = g_slist_append(scene.actors, actor);
 +
 +    }
  #if 0    
    anim = g_new0(Animation, 1);
    anim->count = 1;
@@@ -1046,6 -966,9 +1046,9 @@@ long_timeout (AWallpaperPlugin *desktop
      time_t now;
      Actor *actor;
  
+     fprintf(stderr, "long_timeout %i\n", desktop_plugin->priv->long_timer);
+     if (desktop_plugin->priv->long_timer == 0 )
+         return FALSE;
      if (!desktop_plugin->priv->visible){
          if(desktop_plugin->priv->short_timer != 0){
              g_source_remove(desktop_plugin->priv->short_timer);
@@@ -1094,6 -1017,7 +1097,7 @@@ desktop_plugin_visible_notify (GObjec
  {
      gboolean visible;
      g_object_get (object, "is-on-current-desktop", &visible, NULL);
+     /* fprintf (stderr, "is-on-current-desktop changed. visible: %u", visible); */
      if (visible){
          desktop_plugin->priv->visible = TRUE;
          if (desktop_plugin->priv->long_timer == 0 )
              desktop_plugin->priv->long_timer = 0;
          }
      }
-    /*   fprintf (stderr, "is-on-current-desktop changed. visible: %u", visible); */
  }
  
  gboolean
@@@ -1116,33 -1039,50 +1119,50 @@@ rich_animation_press(GtkWidget *widget
  static void
  animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
  {
-     GtkWidget *label;
+     GtkWidget *widget;
      GtkWidget *rich_animation;
+     gchar           buffer[2048];
+     GtkWidget  *background_town = NULL;
      fprintf(stderr, "!!!!!!!plugin init \n");
      Animation_WallpaperPrivate *priv =  Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
      desktop_plugin->priv =  Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
      /* Load config */
      read_config(priv);
      priv->desktop_plugin = desktop_plugin;
+     widget = gtk_fixed_new();
+     gtk_widget_set_size_request(widget, 95, 50);
+     snprintf(buffer, sizeof(buffer) - 1, "%s/%s/%s", THEME_PATH, desktop_plugin->priv->theme, "town_right_corner.png");
+     background_town = gtk_image_new_from_file (buffer);
+     if (background_town){
+         gtk_fixed_put(GTK_FIXED(widget), background_town, 0, 0);
+         gtk_widget_show (background_town);
+     }
      /* Create rich animation event */
      rich_animation = gtk_event_box_new();
      if(rich_animation){
          gtk_widget_set_events(rich_animation, GDK_BUTTON_PRESS_MASK);
          gtk_event_box_set_visible_window(GTK_EVENT_BOX(rich_animation), FALSE);
-         gtk_widget_set_size_request(rich_animation, 95, 30);
+         gtk_widget_set_size_request(rich_animation, 95, 50);
          gtk_widget_show (rich_animation);
          g_signal_connect(rich_animation, "button-press-event", G_CALLBACK(rich_animation_press), desktop_plugin);
+         gtk_fixed_put(GTK_FIXED(widget), rich_animation, 0, 0);
      }
  /*
-     label = gtk_label_new (""); 
+     GtkWidget *label = gtk_label_new ("ddddddddddddd"); 
      gtk_widget_set_size_request(label, 95, 30);
      gtk_widget_show (label);
-     gtk_container_add (GTK_CONTAINER (desktop_plugin), label);
+ //    gtk_container_add (GTK_CONTAINER (desktop_plugin), label);
+     gtk_fixed_put(GTK_FIXED(widget), label, 0, 0);
  */
      hd_home_plugin_item_set_settings (HD_HOME_PLUGIN_ITEM (desktop_plugin), TRUE);
      g_signal_connect (desktop_plugin, "show-settings",
                             G_CALLBACK (lw_settings), priv);
-     gtk_container_add (GTK_CONTAINER (desktop_plugin), rich_animation);
+     gtk_widget_show (widget);
+     gtk_container_add (GTK_CONTAINER (desktop_plugin), widget);
      init_applet_position();
  
      
@@@ -1167,7 -1107,8 +1187,8 @@@ lw_applet_finalize (GObject *object
  {
       AWallpaperPlugin *desktop_plugin = Animation_Wallpaper_HOME_PLUGIN (object);
       Animation_WallpaperPrivate *priv = desktop_plugin->priv;
+      
+      fprintf(stderr,"finalaze %i\n", priv->long_timer);
       if (priv->long_timer){
          g_source_remove(priv->long_timer);
          priv->long_timer = 0;