]> saetta.ns0.it Git - libgtkcalendarex/commitdiff
Sterted managing view type week.
authorAndrea Zagli <azagli@libero.it>
Mon, 1 Nov 2010 13:58:21 +0000 (14:58 +0100)
committerAndrea Zagli <azagli@libero.it>
Mon, 1 Nov 2010 13:58:21 +0000 (14:58 +0100)
src/gtkcalex.c
src/gtkcalex.h
src/gtkcalexviewday.c
src/gtkcalexviewday.h
src/gtkcalexviewweek.c
src/gtkcalexviewweek.h
tests/test.c

index b9933fc1862b4a53b9b68c40e0fc1298f3dbde20..cd7d95c3ba74a29aef00017c3566a73722bc2a43 100644 (file)
@@ -223,17 +223,17 @@ gtk_calex_set_view_type (GtkCalEx *calex, GtkCalExViewType type)
                                                g_object_unref (priv->view);
                                                priv->view = NULL;
                                        }
-                               GtkCalExViewDay *vd = gtk_calex_view_day_new (priv->goo_canvas_root, priv->date);
+                               GtkCalExViewDay *vd = gtk_calex_view_day_new (priv->goo_canvas_root, priv->date, FALSE);
                                priv->view = G_OBJECT (vd);
                                break;
 
-                       case GTK_CALEX_VIEW_TYPE_WORK_WEEK:
+                       case GTK_CALEX_VIEW_TYPE_WORKING_WEEK:
                                if (priv->view != NULL)
                                        {
                                                g_object_unref (priv->view);
                                                priv->view = NULL;
                                        }
-                               GtkCalExViewDay *vww = gtk_calex_view_day_new (priv->goo_canvas_root, priv->date);
+                               GtkCalExViewDay *vww = gtk_calex_view_day_new (priv->goo_canvas_root, priv->date, TRUE);
                                priv->view = G_OBJECT (vww);
                                break;
 
@@ -243,7 +243,7 @@ gtk_calex_set_view_type (GtkCalEx *calex, GtkCalExViewType type)
                                                g_object_unref (priv->view);
                                                priv->view = NULL;
                                        }
-                               GtkCalExViewDay *vw = gtk_calex_view_day_new (priv->goo_canvas_root, priv->date);
+                               GtkCalExViewWeek *vw = gtk_calex_view_week_new (priv->goo_canvas_root, priv->date);
                                priv->view = G_OBJECT (vw);
                                break;
 
@@ -253,7 +253,7 @@ gtk_calex_set_view_type (GtkCalEx *calex, GtkCalExViewType type)
                                                g_object_unref (priv->view);
                                                priv->view = NULL;
                                        }
-                               GtkCalExViewDay *vm = gtk_calex_view_day_new (priv->goo_canvas_root, priv->date);
+                               GtkCalExViewDay *vm = gtk_calex_view_day_new (priv->goo_canvas_root, priv->date, FALSE);
                                priv->view = G_OBJECT (vm);
                                break;
 
@@ -263,7 +263,7 @@ gtk_calex_set_view_type (GtkCalEx *calex, GtkCalExViewType type)
                                                g_object_unref (priv->view);
                                                priv->view = NULL;
                                        }
-                               GtkCalExViewDay *vl = gtk_calex_view_day_new (priv->goo_canvas_root, priv->date);
+                               GtkCalExViewDay *vl = gtk_calex_view_day_new (priv->goo_canvas_root, priv->date, FALSE);
                                priv->view = G_OBJECT (vl);
                                break;
 
@@ -475,15 +475,15 @@ gtk_calex_size_allocate (GtkWidget *widget,
 static void
 gtk_calex_clean_canvas (GtkCalEx *gtk_calex)
 {
-       guint children;
-       guint i;
+       gint children;
+       gint i;
 
        g_return_if_fail (IS_GTK_CALEX (gtk_calex));
 
        GtkCalExPrivate *priv = GTK_CALEX_GET_PRIVATE (gtk_calex);
 
        children = goo_canvas_item_get_n_children (priv->goo_canvas_root);
-       for (i = 0; i < children; i++)
+       for (i = children - 1; i >= 0; i--)
                {
                        goo_canvas_item_remove (goo_canvas_item_get_child (priv->goo_canvas_root, i));
                }
index 5003996960b2bb071993321674e7b107e6a03a0a..14d3a0cfddd919fe5cff9049ff2204f29dd4d990 100644 (file)
@@ -54,7 +54,7 @@ GtkWidget *gtk_calex_new (void);
 
 typedef enum {
        GTK_CALEX_VIEW_TYPE_DAY,
-       GTK_CALEX_VIEW_TYPE_WORK_WEEK,
+       GTK_CALEX_VIEW_TYPE_WORKING_WEEK,
        GTK_CALEX_VIEW_TYPE_WEEK,
        GTK_CALEX_VIEW_TYPE_MONTH,
        GTK_CALEX_VIEW_TYPE_LIST
index 1b9b95660b77501059fb8989b0e6e00e46a36767..dc97185a462d37853195507a9de83141cf39e66f 100644 (file)
@@ -49,6 +49,7 @@ struct _GtkCalExViewDayPrivate
        {
                GooCanvasItem *goo_canvas_root;
                GDate *date;
+               gboolean working_week;
        };
 
 G_DEFINE_TYPE (GtkCalExViewDay, gtk_calex_view_day, G_TYPE_OBJECT)
@@ -102,11 +103,14 @@ gtk_calex_view_day_get_property (GObject *object, guint property_id, GValue *val
 
 /**
  * gtk_calex_view_day_new:
+ * @root:
+ * @date:
+ * @working_week:
  *
  * Returns: the newly created #GtkCalExViewDay object.
  */
 GtkCalExViewDay
-*gtk_calex_view_day_new (GooCanvasItem *root, GDate *date)
+*gtk_calex_view_day_new (GooCanvasItem *root, GDate *date, gboolean working_week)
 {
        GtkCalExViewDay *gtk_calex_view_day = GTK_CALEX_VIEW_DAY (g_object_new (gtk_calex_view_day_get_type (), NULL));
 
@@ -114,6 +118,7 @@ GtkCalExViewDay
 
        priv->goo_canvas_root = root;
        priv->date = date;
+       priv->working_week = working_week;
 
        gtk_calex_view_day_draw (gtk_calex_view_day);
 
index 579aeb3199eb20bbb4c99b6e1fe1e7a1fad8b687..b8d92f7831e30ac6a8ddfe2d95ab9eb30076005e 100644 (file)
@@ -52,7 +52,7 @@ struct _GtkCalExViewDayClass
 GType gtk_calex_view_day_get_type (void) G_GNUC_CONST;
 
 
-GtkCalExViewDay *gtk_calex_view_day_new (GooCanvasItem *root, GDate *date);
+GtkCalExViewDay *gtk_calex_view_day_new (GooCanvasItem *root, GDate *date, gboolean working_week);
 
 
 G_END_DECLS
index bf3c4e61acebc135c8846727db4380753e114dd5..59de39b09c59930a3279dd7b9dd913ccd5ef4510 100644 (file)
@@ -41,13 +41,16 @@ static void gtk_calex_view_week_get_property (GObject *object,
                                     GValue *value,
                                     GParamSpec *pspec);
 
+static void gtk_calex_view_week_draw (GtkCalExViewWeek *gtk_calex_view_week);
+
 
 #define GTK_CALEX_VIEW_WEEK_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_CALEX_VIEW_WEEK, GtkCalExViewWeekPrivate))
 
 typedef struct _GtkCalExViewWeekPrivate GtkCalExViewWeekPrivate;
 struct _GtkCalExViewWeekPrivate
        {
-               gpointer foo;
+               GooCanvasItem *goo_canvas_root;
+               GDate *date;
        };
 
 G_DEFINE_TYPE (GtkCalExViewWeek, gtk_calex_view_week, G_TYPE_OBJECT)
@@ -101,13 +104,30 @@ gtk_calex_view_week_get_property (GObject *object, guint property_id, GValue *va
 
 /**
  * gtk_calex_view_week_new:
+ * @root:
+ * @date:
  *
  * Returns: the newly created #GtkCalExViewWeek object.
  */
 GtkCalExViewWeek
-*gtk_calex_view_week_new ()
+*gtk_calex_view_week_new (GooCanvasItem *root, GDate *date)
 {
        GtkCalExViewWeek *gtk_calex_view_week = GTK_CALEX_VIEW_WEEK (g_object_new (gtk_calex_view_week_get_type (), NULL));
 
+       GtkCalExViewWeekPrivate *priv = GTK_CALEX_VIEW_WEEK_GET_PRIVATE (gtk_calex_view_week);
+
+       priv->goo_canvas_root = root;
+       priv->date = date;
+
+       gtk_calex_view_week_draw (gtk_calex_view_week);
+
        return gtk_calex_view_week;
 }
+
+static void
+gtk_calex_view_week_draw (GtkCalExViewWeek *gtk_calex_view_week)
+{
+       g_return_if_fail (IS_GTK_CALEX_VIEW_WEEK (gtk_calex_view_week));
+
+       GtkCalExViewWeekPrivate *priv = GTK_CALEX_VIEW_WEEK_GET_PRIVATE (gtk_calex_view_week);
+}
index e6352d7ebfa91a46542412fd6ccc16b02823e63b..31e86b315fdbc2c636312e87ef3d0e146db301ed 100644 (file)
@@ -50,7 +50,7 @@ struct _GtkCalExViewWeekClass
 GType gtk_calex_view_week_get_type (void) G_GNUC_CONST;
 
 
-GtkCalExViewWeek *gtk_calex_view_week_new (void);
+GtkCalExViewWeek *gtk_calex_view_week_new (GooCanvasItem *root, GDate *date);
 
 
 G_END_DECLS
index 8d7986b2ddb5dfe092cfd935c851bb6d92ce4afe..f04cf61f07cd06cdf9c529332867df1e773ddd6b 100644 (file)
@@ -33,7 +33,7 @@ G_MODULE_EXPORT void
 on_tbtn_view_type_wweek_toggled (GtkToggleToolButton *toggle_tool_button,
                            gpointer user_data)
 {
-       gtk_calex_set_view_type (GTK_CALEX (calex), GTK_CALEX_VIEW_TYPE_WORK_WEEK);
+       gtk_calex_set_view_type (GTK_CALEX (calex), GTK_CALEX_VIEW_TYPE_WORKING_WEEK);
 }
 
 G_MODULE_EXPORT void