Send commitlog mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r1475 -
      trunk/src/target/OM-2007/applications/openmoko-mainmenu/src
      ([EMAIL PROTECTED])
   2. r1476 -
      trunk/src/target/OM-2007/applications/openmoko-mainmenu/src
      ([EMAIL PROTECTED])
   3. r1477 - in
      trunk/src/target/OM-2007/applications/openmoko-today: . src
      ([EMAIL PROTECTED])
--- Begin Message ---
Author: zhiyong_sun
Date: 2007-03-22 06:36:16 +0100 (Thu, 22 Mar 2007)
New Revision: 1475

Modified:
   trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mainmenu.c
Log:
small modify

Modified: trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mainmenu.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mainmenu.c      
2007-03-22 05:32:52 UTC (rev 1474)
+++ trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mainmenu.c      
2007-03-22 05:36:16 UTC (rev 1475)
@@ -268,7 +268,7 @@
     if (mm->list_store)
          gtk_list_store_clear (mm->list_store);
 
-    moko_icon_view_refresh (mm->icon_view);
+  //  moko_icon_view_refresh (mm->icon_view);
 
     mokodesktop_items_enumerate_siblings(item->item_child, item_new)
     { 




--- End Message ---
--- Begin Message ---
Author: zhiyong_sun
Date: 2007-03-22 07:31:55 +0100 (Thu, 22 Mar 2007)
New Revision: 1476

Modified:
   trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mainmenu.c
   trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mokoiconview.c
   trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mokoiconview.h
Log:
fix cursor item error bug

Modified: trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mainmenu.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mainmenu.c      
2007-03-22 05:36:16 UTC (rev 1475)
+++ trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mainmenu.c      
2007-03-22 06:31:55 UTC (rev 1476)
@@ -268,7 +268,7 @@
     if (mm->list_store)
          gtk_list_store_clear (mm->list_store);
 
-  //  moko_icon_view_refresh (mm->icon_view);
+    moko_icon_view_refresh (mm->icon_view);
 
     mokodesktop_items_enumerate_siblings(item->item_child, item_new)
     { 

Modified: 
trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mokoiconview.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mokoiconview.c  
2007-03-22 05:36:16 UTC (rev 1475)
+++ trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mokoiconview.c  
2007-03-22 06:31:55 UTC (rev 1476)
@@ -99,6 +99,7 @@
   gint decr_width;
   gboolean decorated;
   gint total_items;
+  gboolean refresh;
 
   guint ctrl_pressed : 1;
   guint shift_pressed : 1;
@@ -999,6 +1000,8 @@
   icon_view->priv->row_spacing = 6;
   icon_view->priv->column_spacing = 6;
   icon_view->priv->margin = 6;
+  icon_view->priv->cursor_item = NULL;
+  icon_view->priv->anchor_item = NULL;
 }
 
 
@@ -1494,7 +1497,8 @@
   MokoIconView *icon_view;
   MokoIconViewItem *item;
   gboolean dirty = FALSE;
-
+  gboolean activate = FALSE;
+  
   icon_view = MOKO_ICON_VIEW (widget);
 
   if (event->window != icon_view->priv->bin_window)
@@ -1550,14 +1554,8 @@
                      dirty = TRUE;
                    }
                  else 
-               {
-                  GtkTreePath *path;
-                  path = gtk_tree_path_new_from_indices (item->index, -1);
-                  moko_icon_view_item_activated (icon_view, path);
-                  gtk_tree_path_free (path);
-
-               icon_view->priv->last_single_clicked = NULL;
-                 }
+                     activate = TRUE;
+                 
                }
              moko_icon_view_set_cursor_item (icon_view, item);
              icon_view->priv->anchor_item = item;
@@ -1587,7 +1585,16 @@
        }
 
     }
-  
+  if (activate)
+       {
+          GtkTreePath *path;
+          path = gtk_tree_path_new_from_indices (item->index, -1);
+          moko_icon_view_item_activated (icon_view, path);
+          gtk_tree_path_free (path);
+
+       icon_view->priv->last_single_clicked = NULL;
+       }
+
   if (dirty)
     g_signal_emit (icon_view, moko_icon_view_signals[SELECTION_CHANGED], 0);
 
@@ -3172,19 +3179,9 @@
  // if (!GTK_WIDGET_HAS_FOCUS (icon_view)) 
     //return;
 
-  if (!icon_view->priv->cursor_item)
+  if (icon_view->priv->cursor_item)
     {
-      GList *list;
-
-      if (count > 0)
-       list = icon_view->priv->items;
-      else
-       list = g_list_last (icon_view->priv->items);
-
-      item = list ? list->data : NULL;
-    }
-  else 
-    {
+       g_debug ("cursor item row = %d, col = %d", 
icon_view->priv->cursor_item->row, icon_view->priv->cursor_item->col);
      item = find_item (icon_view, 
                      icon_view->priv->cursor_item,
                      count, 0);
@@ -3200,9 +3197,19 @@
             col = icon_view->priv->columns;
            g_debug ("count = %d column = %d", count, col);
         }
+    }
+  else
+    {
+      GList *list;
 
+      if (count > 0)
+       list = icon_view->priv->items;
+      else
+       list = g_list_last (icon_view->priv->items);
+
+      item = list ? list->data : NULL;
     }
-
+ 
   if (!item)
        return;
 
@@ -4446,3 +4453,15 @@
     moko_icon_view_move_cursor_up_down (icon_view, 1);
 
 }
+void
+moko_icon_view_refresh (MokoIconView *icon_view)
+{
+  g_return_if_fail (MOKO_IS_ICON_VIEW (icon_view));
+
+  icon_view->priv->cursor_item = NULL;
+  if (icon_view->priv->items)
+  {
+     MokoIconViewItem *item = icon_view->priv->items->data;
+     moko_icon_view_scroll_to_item (icon_view, item);     
+  }
+}

Modified: 
trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mokoiconview.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mokoiconview.h  
2007-03-22 05:36:16 UTC (rev 1475)
+++ trunk/src/target/OM-2007/applications/openmoko-mainmenu/src/mokoiconview.h  
2007-03-22 06:31:55 UTC (rev 1476)
@@ -234,6 +234,9 @@
 
 void
 moko_icon_view_move_cursor_line_down (MokoIconView *icon_view);
+
+void
+moko_icon_view_refresh (MokoIconView *icon_view);
 G_END_DECLS
 
 #endif /* mokoiconview.h */




--- End Message ---
--- Begin Message ---
Author: dodji
Date: 2007-03-22 11:53:40 +0100 (Thu, 22 Mar 2007)
New Revision: 1477

Modified:
   trunk/src/target/OM-2007/applications/openmoko-today/ChangeLog
   trunk/src/target/OM-2007/applications/openmoko-today/src/today-events-area.c
   trunk/src/target/OM-2007/applications/openmoko-today/src/today-events-area.h
   trunk/src/target/OM-2007/applications/openmoko-today/src/today-main.c
   trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.c
   trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.h
Log:
Make TodayEventsArea update itself when events and tasks get edited in e-d-s.

        * applications/openmoko-today/src/today-events-area.[c|h]:
          Port this over the ECalView API. This allows updating the
          interface whenever an event or todo item is added to
          or deleted from e-d-s.
          Basically, after calling today_events_area_new(),
          one just have to call today_events_area_set_events_auto().
          The widget pulls events and tasks from e-d-s, show them,
          paginate them, and update itself whenever an event is modified
          in e-d-s. It is no more compulsory to feed the widget
          with today_events_area_set_events().
        * applications/openmoko-today/src/today-main.c: change this to
          today_setup_events_area(): change this to use the
          new today_events_area_set_event_auto() entry point.
        * applications/openmoko-today/src/today-utils.[c|]:
          Added today_clone_icalcomponent_list() to be able
          to clone list of icalcomponents, as we have to do that
          when using the signal driven ECalView API.


Modified: trunk/src/target/OM-2007/applications/openmoko-today/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-today/ChangeLog      
2007-03-22 06:31:55 UTC (rev 1476)
+++ trunk/src/target/OM-2007/applications/openmoko-today/ChangeLog      
2007-03-22 10:53:40 UTC (rev 1477)
@@ -1,3 +1,23 @@
+Thu, 22 Mar 2007 09:51:27 +0100 Dodji Seketeli
+
+       * applications/openmoko-today/src/today-events-area.[c|h]:
+         Port this over the ECalView API. This allows updating the
+         interface whenever an event or todo item is added to
+         or deleted from e-d-s.
+         Basically, after calling today_events_area_new(),
+         one just have to call today_events_area_set_events_auto().
+         The widget pulls events and tasks from e-d-s, show them,
+         paginate them, and update itself whenever an event is modified
+         in e-d-s. It is no more compulsory to feed the widget
+         with today_events_area_set_events().
+       * applications/openmoko-today/src/today-main.c: change this to
+         today_setup_events_area(): change this to use the
+         new today_events_area_set_event_auto() entry point.
+       * applications/openmoko-today/src/today-utils.[c|]:
+         Added today_clone_icalcomponent_list() to be able
+         to clone list of icalcomponents, as we have to do that
+         when using the signal driven ECalView API.
+
 Wed, 21 Mar 2007 17:34:34 +0000 Thomas Wood
 
        * src/today-main.c: Add support for icon themes, and assign 
applications to

Modified: 
trunk/src/target/OM-2007/applications/openmoko-today/src/today-events-area.c
===================================================================
--- 
trunk/src/target/OM-2007/applications/openmoko-today/src/today-events-area.c    
    2007-03-22 06:31:55 UTC (rev 1476)
+++ 
trunk/src/target/OM-2007/applications/openmoko-today/src/today-events-area.c    
    2007-03-22 10:53:40 UTC (rev 1477)
@@ -24,7 +24,7 @@
  */
 #include <string.h>
 /*#include <libecal/e-cal-time-util.h>*/
-/*#include <libical/e-cal-component.h>*/
+#include <libecal/e-cal-view.h>
 #include <libical/icalcomponent.h>
 #include <gtk/gtkvbox.h>
 #include <gtk/gtkhbox.h>
@@ -49,6 +49,10 @@
   int cur_event_index ;
   int max_visible_events ;
   int nb_events ;
+  ECalView *events_view ;
+  ECalView *tasks_view ;
+  ECal *events_ecal ;
+  ECal *tasks_ecal ;
 };
 
 enum TodayEventsAreaSignals
@@ -87,10 +91,20 @@
 static void     render_events_page          (TodayEventsArea *a_this,
                                              GList *a_from) ;
 static void     render_events_page_auto     (TodayEventsArea *a_this) ;
+static gboolean remove_event                (TodayEventsArea *a_this,
+                                             GList *a_event) ;
+static void     set_events_view             (TodayEventsArea *a_this,
+                                           ECalView *a_view) ;
 static void     event_selected_signal       (TodayEventsArea *a_this,
                                              guint a_index) ;
 static void     events_added_signal       (TodayEventsArea *a_this,
                                            GList *a_index) ;
+static void     on_objects_added_cb       (ECalView *a_view,
+                                           GList *a_objects,
+                                           TodayEventsArea *a_this) ;
+static void     on_objects_removed_cb     (ECalView *a_view,
+                                           GList *a_uids,
+                                           TodayEventsArea *a_this) ;
 
 static void     get_property (GObject *a_this, guint a_prop_id,
                               GValue *a_val, GParamSpec *a_pspec) ;
@@ -219,6 +233,26 @@
     e_cal_free_object_list (self->priv->events) ;
     self->priv->events = NULL ;
   }
+  if (self->priv->events_view)
+  {
+    g_object_unref (G_OBJECT (self->priv->events_view)) ;
+    self->priv->events_view = NULL;
+  }
+  if (self->priv->tasks_view)
+  {
+    g_object_unref (G_OBJECT (self->priv->tasks_view)) ;
+    self->priv->tasks_view = NULL;
+  }
+  if (self->priv->events_ecal)
+  {
+    g_object_unref (G_OBJECT (self->priv->events_ecal)) ;
+    self->priv->events_ecal = NULL;
+  }
+  if (self->priv->tasks_ecal)
+  {
+    g_object_unref (G_OBJECT (self->priv->tasks_ecal)) ;
+    self->priv->tasks_ecal = NULL ;
+  }
   self->priv->cur_event = NULL ;
   self->priv->cur_event_index = 0 ;
   self->priv->page_start = NULL ;
@@ -313,6 +347,29 @@
 }
 
 static void
+on_objects_added_cb (ECalView *a_view,
+                     GList *a_objects,
+                     TodayEventsArea *a_this)
+{
+  if (a_view) {/*compiler is happy*/}
+  today_events_area_append_events (a_this, a_objects) ;
+  gtk_widget_queue_draw (GTK_WIDGET (a_this)) ;
+}
+
+static void
+on_objects_removed_cb (ECalView *a_view,
+                       GList *a_uids,
+                       TodayEventsArea *a_this)
+{
+  GList *cur ;
+
+  if (a_view) {/*compiler is happy*/}
+  for (cur = a_uids ; cur ; cur = cur->next)
+    today_events_area_remove_event (a_this, cur->data) ;
+  gtk_widget_queue_draw (GTK_WIDGET (a_this)) ;
+}
+
+static void
 get_property (GObject *a_this, guint a_prop_id,
               GValue *a_val, GParamSpec *a_pspec)
 {
@@ -748,7 +805,100 @@
   render_events_page (a_this, from) ;
 }
 
+static gboolean
+remove_event (TodayEventsArea *a_this,
+              GList *a_event)
+{
+  g_return_val_if_fail (a_this
+                        && TODAY_IS_EVENTS_AREA (a_this)
+                        && a_this->priv,
+                        FALSE) ;
 
+  if (!a_event || !a_this->priv->events)
+    return TRUE ;
+
+  if (a_event == a_this->priv->cur_event)
+  {
+    if (a_this->priv->cur_event->prev)
+      a_this->priv->cur_event = a_this->priv->cur_event->prev ;
+    else
+      a_this->priv->cur_event = a_this->priv->cur_event->next ;
+  }
+
+  a_this->priv->events = g_list_remove_link (a_this->priv->events, a_event) ;
+  g_return_val_if_fail (a_event, FALSE) ;
+
+  if (a_event->data)
+  {
+    icalcomponent_free (a_event->data) ;
+    a_event->data = NULL ;
+  }
+  g_list_free (a_event) ;
+  a_this->priv->nb_events-- ;
+
+  if (select_event (a_this, a_this->priv->cur_event))
+  {
+    render_events_page_auto (a_this) ;
+    return TRUE ;
+  }
+  return FALSE ;
+}
+
+static void
+set_events_view (TodayEventsArea *a_this,
+                 ECalView *a_view)
+{
+  g_return_if_fail (a_this && TODAY_IS_EVENTS_AREA (a_this)) ;
+  g_return_if_fail (a_this->priv) ;
+
+  if (!a_view)
+  {
+    return ;
+  }
+  if (a_view == a_this->priv->events_view)
+    return ;
+  a_this->priv->events_view = a_view ;
+
+  g_return_if_fail (E_IS_CAL_VIEW (a_view)) ;
+  g_signal_connect (G_OBJECT (a_view), "objects-added",
+                    G_CALLBACK (on_objects_added_cb),
+                    a_this) ;
+  g_signal_connect (G_OBJECT (a_view), "objects-removed",
+                    G_CALLBACK (on_objects_removed_cb),
+                    a_this) ;
+
+  g_object_ref (G_OBJECT (a_view)) ;
+  e_cal_view_start (a_view) ;
+}
+
+static void
+set_tasks_view (TodayEventsArea *a_this,
+                ECalView *a_view)
+{
+  g_return_if_fail (a_this && TODAY_IS_EVENTS_AREA (a_this)) ;
+  g_return_if_fail (a_this->priv) ;
+
+  if (!a_view)
+  {
+    return ;
+  }
+  if (a_view == a_this->priv->tasks_view)
+    return ;
+
+  a_this->priv->tasks_view = a_view ;
+
+  g_return_if_fail (E_IS_CAL_VIEW (a_view)) ;
+  g_signal_connect (G_OBJECT (a_view), "objects-added",
+                    G_CALLBACK (on_objects_added_cb),
+                    a_this) ;
+  g_signal_connect (G_OBJECT (a_view), "objects-removed",
+                    G_CALLBACK (on_objects_removed_cb),
+                    a_this) ;
+
+  g_object_ref (G_OBJECT (a_view)) ;
+  e_cal_view_start (a_view) ;
+}
+
 /**********************
  * </private api>
  **********************/
@@ -819,6 +969,121 @@
                  a_events) ;
 }
 
+void
+today_events_area_set_events_auto (TodayEventsArea *a_this)
+{
+  ECalView *events_view=NULL, *tasks_view=NULL;
+
+  g_return_if_fail (a_this && TODAY_EVENTS_AREA (a_this)) ;
+  g_return_if_fail (a_this->priv) ;
+
+  if (!a_this->priv->events_ecal)
+  {
+    a_this->priv->events_ecal = e_cal_new_system_calendar () ;
+    if(!e_cal_open (a_this->priv->events_ecal, FALSE, NULL))
+    {
+      g_warning ("failed to open calendar") ;
+      g_object_unref (G_OBJECT (a_this->priv->events_ecal)) ;
+      a_this->priv->events_ecal = NULL ;
+    }
+  }
+  g_return_if_fail (a_this->priv->events_ecal) ;
+
+  if (!a_this->priv->tasks_ecal)
+  {
+    a_this->priv->tasks_ecal = e_cal_new_system_tasks () ;
+    if (!e_cal_open (a_this->priv->tasks_ecal, FALSE, NULL))
+    {
+      g_warning ("failed to open tasks") ;
+      g_object_unref (G_OBJECT (a_this->priv->tasks_ecal)) ;
+      a_this->priv->tasks_ecal = NULL ;
+    }
+  }
+  g_return_if_fail (a_this->priv->tasks_ecal) ;
+
+  if (!a_this->priv->events_view)
+  {
+    if (e_cal_get_query (a_this->priv->events_ecal,
+                          "#t",
+                          &events_view,
+                          NULL))
+    {
+      set_events_view (a_this, events_view) ;
+    }
+    else
+    {
+      g_warning ("failed to query the calendar") ;
+    }
+  }
+
+  if (!a_this->priv->tasks_view)
+  {
+    if (e_cal_get_query (a_this->priv->tasks_ecal,
+                         "#t",
+                         &tasks_view,
+                         NULL))
+    {
+      set_tasks_view (a_this, tasks_view) ;
+    }
+    else
+    {
+      g_warning ("failed to query task store") ;
+    }
+  }
+}
+
+void
+today_events_area_append_events (TodayEventsArea *a_this,
+                                 const GList *a_events)
+{
+  g_return_if_fail (a_this && TODAY_IS_EVENTS_AREA (a_this)) ;
+  g_return_if_fail (a_this->priv) ;
+
+  GList *events = today_clone_icalcomponent_list (a_events) ;
+  if (!a_this->priv->events)
+  {
+    today_events_area_set_events (a_this, events) ;
+    return ;
+  }
+  a_this->priv->events = g_list_concat (a_this->priv->events,
+                                        events) ;
+  a_this->priv->nb_events = get_nb_events_real (a_this) ;
+  reinit_area (a_this) ;
+  render_events_page (a_this, NULL) ;
+  update_paging_info (a_this) ;
+  g_signal_emit (G_OBJECT (a_this), signals[EVENTS_ADDED_SIGNAL], 0,
+                 a_events) ;
+}
+
+gboolean
+today_events_area_remove_event (TodayEventsArea *a_this,
+                                const gchar* a_uid)
+{
+  GList *cur=NULL ;
+  gchar *uid=NULL ;
+
+  g_return_val_if_fail (a_this
+                        && TODAY_IS_EVENTS_AREA (a_this)
+                        && a_this->priv,
+                        FALSE) ;
+  g_return_val_if_fail (a_uid, FALSE) ;
+
+  if (!a_this->priv->events)
+    return FALSE ;
+
+  for (cur = a_this->priv->events ; cur ; cur = cur->next)
+  {
+    /*sanity check*/
+    if (!cur->data || !icalcomponent_isa_component (cur->data))
+      continue ;
+
+    uid = (gchar*)icalcomponent_get_uid (cur->data);
+    if (uid && ! strncmp (a_uid, uid, strlen (a_uid)))
+      return remove_event (a_this, cur) ;
+  }
+  return FALSE ;
+}
+
 GList*
 today_events_area_get_events (TodayEventsArea *a_this)
 {

Modified: 
trunk/src/target/OM-2007/applications/openmoko-today/src/today-events-area.h
===================================================================
--- 
trunk/src/target/OM-2007/applications/openmoko-today/src/today-events-area.h    
    2007-03-22 06:31:55 UTC (rev 1476)
+++ 
trunk/src/target/OM-2007/applications/openmoko-today/src/today-events-area.h    
    2007-03-22 10:53:40 UTC (rev 1477)
@@ -65,7 +65,12 @@
 GtkWidget*     today_events_area_new ();
 GtkWidget*     today_events_area_new_with_events (GList *events);
 void           today_events_area_set_events (TodayEventsArea *self,
-                                             GList *a_events);
+                                             GList *events);
+void           today_events_area_set_events_auto (TodayEventsArea *self) ;
+void           today_events_area_append_events (TodayEventsArea *self,
+                                                const GList *events) ;
+gboolean       today_events_area_remove_event (TodayEventsArea *self,
+                                               const gchar* event_uid) ;
 GList*         today_events_area_get_events (TodayEventsArea *self);
 int            today_events_area_get_nb_events (TodayEventsArea *self);
 int            today_events_area_get_nb_pages (TodayEventsArea *self);

Modified: trunk/src/target/OM-2007/applications/openmoko-today/src/today-main.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-today/src/today-main.c       
2007-03-22 06:31:55 UTC (rev 1476)
+++ trunk/src/target/OM-2007/applications/openmoko-today/src/today-main.c       
2007-03-22 10:53:40 UTC (rev 1477)
@@ -189,10 +189,13 @@
 today_setup_events_area (const gchar *stock_id)
 {
   GtkWidget        *events_area;
-  GList            *events;
+  /*GList            *events;
 
   events = today_get_today_events () ;
   events_area = today_events_area_new_with_events (events) ;
+  */
+  events_area = today_events_area_new () ;
+  today_events_area_set_events_auto (TODAY_EVENTS_AREA (events_area)) ;
 
   return events_area;
 }

Modified: trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.c      
2007-03-22 06:31:55 UTC (rev 1476)
+++ trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.c      
2007-03-22 10:53:40 UTC (rev 1477)
@@ -103,40 +103,20 @@
     return result ;
 }
 
-
-static GList*
-icalcomps_to_ecalcomps (GList *a_icalcomps)
+GList*
+today_clone_icalcomponent_list (const GList *a_list)
 {
-  GList *cur=NULL, *ecalcomps=NULL  ;
+  GList *result=NULL, *cur=NULL ;
 
-  g_return_val_if_fail (a_icalcomps, NULL) ;
-  /*
-   * build a list of ECalComponent, out of the list of icalcomponents
-   * when an icalcomponent is set to an ECalComponent, the later
-   * becomes responsible of freeing the former's memory
-   */
-  for (cur = a_icalcomps; cur; cur = cur->next)
+  for (cur =(GList*)a_list ; cur ; cur = cur->next)
   {
-    ECalComponent *c = NULL;
-    if (!cur->data)
-      continue;
-
-    c = e_cal_component_new ();
-    if (!e_cal_component_set_icalcomponent (c, cur->data))
-    {
-      g_warning ("setting icalcomp into ecalcomp failed") ;
-      icalcomponent_free (cur->data);
-      cur->data = NULL;
-      continue;
-    }
-    ecalcomps = g_list_prepend (ecalcomps, c);
-    cur->data = NULL;
+    if (!icalcomponent_isa_component (cur->data))
+      continue ;
+    result = g_list_prepend (result, icalcomponent_new_clone (cur->data)) ;
   }
-  return ecalcomps ;
-
+  return result ;
 }
 
-
 /**
  * today_get_today_events:
  *

Modified: trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.h      
2007-03-22 06:31:55 UTC (rev 1476)
+++ trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.h      
2007-03-22 10:53:40 UTC (rev 1477)
@@ -33,6 +33,6 @@
 void e_cal_component_list_free (GList * list) ;
 gchar* icaltime_to_pretty_string (const icaltimetype *timetype) ;
 gboolean icalcomponent_has_alarm (icalcomponent *a_icalcomp) ;
-
+GList* today_clone_icalcomponent_list (const GList *a_list) ;
 #endif /*__TODAY_UTILS_H__*/
 




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to