]> saetta.ns0.it Git - libgtkcalendarex/commitdiff
Adjustments. view_as_gtk_bin
authorAndrea Zagli <azagli@libero.it>
Fri, 3 Dec 2010 11:48:31 +0000 (12:48 +0100)
committerAndrea Zagli <azagli@libero.it>
Fri, 3 Dec 2010 11:48:31 +0000 (12:48 +0100)
src/gtkcalex.c
src/gtkcalexviewday.c
tests/test.ui

index de6171932cfb12ae625e83d8deba63002345bc21..89820edfd9de1fec6494352f40390bbdb4f6ddb2 100644 (file)
@@ -206,9 +206,7 @@ gtk_calex_set_view_type (GtkCalEx *calex, GtkCalExViewType type)
                                                gtk_widget_destroy (priv->view);
                                                priv->view = NULL;
                                        }
-                               GtkWidget *vd = gtk_calex_view_day_new (priv->date, FALSE);
-                               priv->view = vd;
-                               gtk_container_add (GTK_CONTAINER (calex), vd);
+                               priv->view = gtk_calex_view_day_new (priv->date, FALSE);
                                break;
 
                        case GTK_CALEX_VIEW_TYPE_WORKING_WEEK:
@@ -217,9 +215,7 @@ gtk_calex_set_view_type (GtkCalEx *calex, GtkCalExViewType type)
                                                gtk_widget_destroy (priv->view);
                                                priv->view = NULL;
                                        }
-                               GtkWidget *vww = gtk_calex_view_day_new (priv->date, TRUE);
-                               priv->view = vww;
-                               gtk_container_add (GTK_CONTAINER (calex), vww);
+                               priv->view = gtk_calex_view_day_new (priv->date, TRUE);
                                break;
 
                        case GTK_CALEX_VIEW_TYPE_WEEK:
@@ -238,9 +234,7 @@ gtk_calex_set_view_type (GtkCalEx *calex, GtkCalExViewType type)
                                                gtk_widget_destroy (priv->view);
                                                priv->view = NULL;
                                        }
-                               GtkWidget *vm = gtk_calex_view_day_new (priv->date, FALSE);
-                               priv->view = vm;
-                               gtk_container_add (GTK_CONTAINER (calex), vm);
+                               priv->view = gtk_calex_view_day_new (priv->date, FALSE);
                                break;
 
                        case GTK_CALEX_VIEW_TYPE_LIST:
@@ -249,14 +243,18 @@ gtk_calex_set_view_type (GtkCalEx *calex, GtkCalExViewType type)
                                                gtk_widget_destroy (priv->view);
                                                priv->view = NULL;
                                        }
-                               GtkWidget *vl = gtk_calex_view_day_new (priv->date, FALSE);
-                               priv->view = vl;
-                               gtk_container_add (GTK_CONTAINER (calex), vl);
+                               priv->view = gtk_calex_view_day_new (priv->date, FALSE);
                                break;
 
                        default:
                                g_warning ("View type «%d» not available.", priv->view_type);
-                               break;
+                               return;
+               }
+
+       if (GTK_IS_WIDGET (priv->view))
+               {
+                       gtk_container_add (GTK_CONTAINER (calex), priv->view);
+                       gtk_widget_show_all (priv->view);
                }
 }
 
@@ -308,13 +306,17 @@ gtk_calex_forall (GtkContainer *container,
                 GtkCallback callback,
                 gpointer callback_data)
 {
+       GtkBin *bin;
+
        g_return_if_fail (IS_GTK_CALEX (container));
        g_return_if_fail (callback != NULL);
 
-       GTK_CONTAINER_CLASS (gtk_calex_parent_class)->forall (container,
-                            include_internals,
-                            callback,
-                            callback_data);
+       bin = GTK_BIN (container);
+
+       if (bin->child)
+               {
+                       (* callback) (bin->child, callback_data);
+               }
 }
 
 static void
@@ -423,8 +425,9 @@ gtk_calex_size_request (GtkWidget *widget,
                }
 
        border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-       requisition->width += border_width * 2;
-       requisition->height += border_width * 2;
+       requisition->width += (border_width * 2);
+       requisition->height += (border_width * 2);
+g_message("gtkcalex requisition %d %d",requisition->width,requisition->height);
 }
 
 static void
@@ -446,7 +449,7 @@ gtk_calex_size_allocate (GtkWidget *widget,
        bin = GTK_BIN (gtkcalex);
 
        priv = GTK_CALEX_GET_PRIVATE (gtkcalex);
-
+g_message("gtkcalex allocation %d %d %d %d",allocation->x,allocation->y,allocation->width,allocation->height);
        gtk_widget_set_allocation (widget, allocation);
 
        border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
index 939ee31697f1cd4166722fa4769f9406aa7d6901..02e7b5c9fe1acfa2cdc192fa16eb5c88a3f89447 100644 (file)
@@ -447,7 +447,7 @@ static void
 gtk_calex_view_day_size_allocate (GtkWidget *widget,
                          GtkAllocation *allocation)
 {
-       GtkCalExViewDay *gtkcalex;
+       GtkCalExViewDay *gtkcalexvd;
        GtkCalExViewDayPrivate *priv;
        GtkBin *bin;
        GtkAllocation relative_allocation;
@@ -458,11 +458,11 @@ gtk_calex_view_day_size_allocate (GtkWidget *widget,
        g_return_if_fail (IS_GTK_CALEX_VIEW_DAY (widget));
        g_return_if_fail (allocation != NULL);
 
-       gtkcalex = GTK_CALEX_VIEW_DAY (widget);
-       bin = GTK_BIN (gtkcalex);
-
-       priv = GTK_CALEX_VIEW_DAY_GET_PRIVATE (gtkcalex);
+       gtkcalexvd = GTK_CALEX_VIEW_DAY (widget);
+       bin = GTK_BIN (gtkcalexvd);
 
+       priv = GTK_CALEX_VIEW_DAY_GET_PRIVATE (gtkcalexvd);
+g_message("gtkcalexviewday allocation %d %d %d %d",allocation->x,allocation->y,allocation->width,allocation->height);
        gtk_widget_set_allocation (widget, allocation);
 
        border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
@@ -479,6 +479,8 @@ gtk_calex_view_day_size_allocate (GtkWidget *widget,
                        child_allocation.height = relative_allocation.height;
                        gtk_widget_size_allocate (bin->child, &child_allocation);
                }
+
+       gtk_calex_view_day_draw (gtkcalexvd);
 }
 
 static void
index 912436b1b5aa499ba2ed6406ca99b83f5ce67f29..7428fadae94c4ace4f801c3ddc97c36ac5985a76 100644 (file)
           </packing>
         </child>
         <child>
-          <object class="GtkHBox" id="hbox1">
+          <object class="GtkHPaned" id="hpaned1">
             <property name="visible">True</property>
+            <property name="can_focus">True</property>
             <child>
               <object class="GtkCalendar" id="calendar1">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="year">2010</property>
+                <property name="month">11</property>
+                <property name="day">3</property>
                 <signal name="day_selected" handler="on_calendar_day_selected"/>
               </object>
               <packing>
-                <property name="expand">False</property>
-                <property name="position">0</property>
+                <property name="resize">False</property>
+                <property name="shrink">True</property>
               </packing>
             </child>
             <child>
                 </child>
               </object>
               <packing>
-                <property name="position">1</property>
+                <property name="resize">True</property>
+                <property name="shrink">True</property>
               </packing>
             </child>
           </object>