[gnome-calendar/wip/pandusonu/week-view: 11/60] window: initialize and include week-view in the main window



commit 028eb7b994b35c171638f67d364c5b139ca47d7b
Author: pandusonu2 <pandu sonu yahoo com>
Date:   Fri May 20 22:38:35 2016 +0530

    window: initialize and include week-view in the main window
    
    We add the week-view to the views_stack.
    Initialize the GtkWidget week_view in the gcal-window.c

 data/ui/window.ui |   13 ++++++++++++-
 src/gcal-window.c |   16 ++++++++--------
 2 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/data/ui/window.ui b/data/ui/window.ui
index 067cb95..ff2d993 100644
--- a/data/ui/window.ui
+++ b/data/ui/window.ui
@@ -53,6 +53,16 @@
                   <class name="view"/>
                 </style>
                 <child>
+                  <object class="GcalWeekView" id="week_view">
+                    <property name="visible">True</property>
+                    <property name="active-date" bind-source="GcalWindow" bind-property="active-date" 
bind-flags="bidirectional"/>
+                  </object>
+                  <packing>
+                    <property name="name">week</property>
+                    <property name="title" translatable="yes">Week</property>
+                  </packing>
+                </child>
+                <child>
                   <object class="GcalMonthView" id="month_view">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
@@ -62,6 +72,7 @@
                     <signal name="event-activated" handler="event_activated" object="GcalWindow" 
swapped="no"/>
                   </object>
                   <packing>
+                    <property name="position">1</property>
                     <property name="name">month</property>
                     <property name="title" translatable="yes">Month</property>
                   </packing>
@@ -75,7 +86,7 @@
                     <signal name="event-activated" handler="event_activated" object="GcalWindow" 
swapped="no"/>
                   </object>
                   <packing>
-                    <property name="position">1</property>
+                    <property name="position">2</property>
                     <property name="name">year</property>
                     <property name="title" translatable="yes">Year</property>
                   </packing>
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 5bc2bbb..58cd3e4 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -22,8 +22,8 @@
 
 #include "gcal-manager.h"
 #include "gcal-view.h"
-#include "gcal-month-view.h"
 #include "gcal-week-view.h"
+#include "gcal-month-view.h"
 #include "gcal-year-view.h"
 #include "gcal-search-view.h"
 #include "gcal-event-widget.h"
@@ -66,6 +66,7 @@ struct _GcalWindow
   GtkWidget           *search_bar;
   GtkWidget           *views_overlay;
   GtkWidget           *views_stack;
+  GtkWidget           *week_view;
   GtkWidget           *month_view;
   GtkWidget           *year_view;
   GtkWidget           *notification;
@@ -1311,6 +1312,7 @@ gcal_window_class_init(GcalWindowClass *klass)
   gtk_widget_class_bind_template_child (widget_class, GcalWindow, forward_button);
   gtk_widget_class_bind_template_child (widget_class, GcalWindow, views_overlay);
   gtk_widget_class_bind_template_child (widget_class, GcalWindow, views_stack);
+  gtk_widget_class_bind_template_child (widget_class, GcalWindow, week_view);
   gtk_widget_class_bind_template_child (widget_class, GcalWindow, month_view);
   gtk_widget_class_bind_template_child (widget_class, GcalWindow, year_view);
   gtk_widget_class_bind_template_child (widget_class, GcalWindow, views_switcher);
@@ -1404,18 +1406,15 @@ gcal_window_constructed (GObject *object)
 
   g_object_unref (builder);
 
-  /* XXX: Week view disabled until after the release when we restart the work on it*/
-  //priv->views[GCAL_WINDOW_VIEW_WEEK] = gcal_week_view_new ();
-  //gcal_week_view_set_manager (GCAL_WEEK_VIEW (priv->views[GCAL_WINDOW_VIEW_WEEK]), priv->manager);
-  //gcal_week_view_set_first_weekday (GCAL_WEEK_VIEW (priv->views[GCAL_WINDOW_VIEW_WEEK]), get_first_weekday 
());
-  //gcal_week_view_set_use_24h_format (GCAL_WEEK_VIEW (priv->views[GCAL_WINDOW_VIEW_WEEK]), use_24h_format);
-  //gtk_stack_add_titled (GTK_STACK (priv->views_stack), priv->views[GCAL_WINDOW_VIEW_WEEK], "week", 
_("Week"));
-
+  window->views[GCAL_WINDOW_VIEW_WEEK] = window->week_view;
   window->views[GCAL_WINDOW_VIEW_MONTH] = window->month_view;
   window->views[GCAL_WINDOW_VIEW_YEAR] = window->year_view;
 
   gcal_edit_dialog_set_time_format (GCAL_EDIT_DIALOG (window->edit_dialog), use_24h_format);
 
+  gcal_week_view_set_first_weekday (GCAL_WEEK_VIEW (window->views[GCAL_WINDOW_VIEW_WEEK]), get_first_weekday 
());
+  gcal_week_view_set_use_24h_format (GCAL_WEEK_VIEW (window->views[GCAL_WINDOW_VIEW_WEEK]), use_24h_format);
+
   gcal_month_view_set_first_weekday (GCAL_MONTH_VIEW (window->views[GCAL_WINDOW_VIEW_MONTH]), 
get_first_weekday ());
   gcal_month_view_set_use_24h_format (GCAL_MONTH_VIEW (window->views[GCAL_WINDOW_VIEW_MONTH]), 
use_24h_format);
 
@@ -1515,6 +1514,7 @@ gcal_window_set_property (GObject      *object,
           g_signal_connect_swapped (self->manager, "source-changed", G_CALLBACK (source_changed), object);
 
           gcal_edit_dialog_set_manager (GCAL_EDIT_DIALOG (self->edit_dialog), self->manager);
+          gcal_week_view_set_manager (GCAL_WEEK_VIEW (self->week_view), self->manager);
           gcal_month_view_set_manager (GCAL_MONTH_VIEW (self->month_view), self->manager);
           gcal_year_view_set_manager (GCAL_YEAR_VIEW (self->year_view), self->manager);
           gcal_quick_add_popover_set_manager (GCAL_QUICK_ADD_POPOVER (self->quick_add_popover), 
self->manager);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]