[evolution] Change ECalendarView from GtkTable to GtkGrid



commit b175e766e41564926ab97d4aaded9ad5ee10902b
Author: Milan Crha <mcrha redhat com>
Date:   Fri Apr 8 14:14:34 2016 +0200

    Change ECalendarView from GtkTable to GtkGrid

 calendar/gui/e-cal-list-view.c |   10 ++++--
 calendar/gui/e-calendar-view.c |    2 +-
 calendar/gui/e-calendar-view.h |    4 +-
 calendar/gui/e-day-view.c      |   68 ++++++++++++++++++++++++++++-----------
 calendar/gui/e-week-view.c     |   31 ++++++++++++------
 5 files changed, 80 insertions(+), 35 deletions(-)
---
diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c
index 2d9daa2..1cbd114 100644
--- a/calendar/gui/e-cal-list-view.c
+++ b/calendar/gui/e-cal-list-view.c
@@ -267,9 +267,13 @@ setup_e_table (ECalListView *cal_list_view)
        gtk_scrolled_window_set_policy (
                GTK_SCROLLED_WINDOW (widget),
                GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-       gtk_table_attach (
-               GTK_TABLE (container), widget, 0, 2, 0, 2,
-               GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+       gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 2, 2);
+       g_object_set (G_OBJECT (widget),
+               "hexpand", TRUE,
+               "vexpand", TRUE,
+               "halign", GTK_ALIGN_FILL,
+               "valign", GTK_ALIGN_FILL,
+               NULL);
        gtk_widget_show (widget);
 
        container = widget;
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index d61f529..209d83e 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -94,7 +94,7 @@ static guint signals[LAST_SIGNAL];
 static void calendar_view_selectable_init (ESelectableInterface *iface);
 
 G_DEFINE_ABSTRACT_TYPE_WITH_CODE (
-       ECalendarView, e_calendar_view, GTK_TYPE_TABLE,
+       ECalendarView, e_calendar_view, GTK_TYPE_GRID,
        G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)
        G_IMPLEMENT_INTERFACE (E_TYPE_SELECTABLE, calendar_view_selectable_init));
 
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index a8832ca..6c6c094 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -106,7 +106,7 @@ typedef struct _ECalendarViewClass ECalendarViewClass;
 typedef struct _ECalendarViewPrivate ECalendarViewPrivate;
 
 struct _ECalendarView {
-       GtkTable parent;
+       GtkGrid parent;
        gboolean in_focus;
        ECalendarViewPrivate *priv;
 };
@@ -134,7 +134,7 @@ typedef enum {
 } ECalendarViewMoveType;
 
 struct _ECalendarViewClass {
-       GtkTableClass parent_class;
+       GtkGridClass parent_class;
 
        /* Notification signals */
        void            (*popup_event)          (ECalendarView *cal_view,
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 9f378cc..555319a 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -2154,9 +2154,13 @@ e_day_view_init (EDayView *day_view)
 
        widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
 
-       gtk_table_attach (
-               GTK_TABLE (day_view), widget, 0, 1, 0, 1,
-               GTK_FILL, GTK_FILL, 0, 0);
+       gtk_grid_attach (GTK_GRID (day_view), widget, 0, 0, 1, 1);
+       g_object_set (G_OBJECT (widget),
+               "hexpand", FALSE,
+               "vexpand", FALSE,
+               "halign", GTK_ALIGN_FILL,
+               "valign", GTK_ALIGN_FILL,
+               NULL);
 
        container = widget;
 
@@ -2179,9 +2183,13 @@ e_day_view_init (EDayView *day_view)
         * Top Canvas
         */
        widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-       gtk_table_attach (
-               GTK_TABLE (day_view), widget,
-               1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+       gtk_grid_attach (GTK_GRID (day_view), widget, 1, 0, 1, 1);
+       g_object_set (G_OBJECT (widget),
+               "hexpand", TRUE,
+               "vexpand", FALSE,
+               "halign", GTK_ALIGN_FILL,
+               "valign", GTK_ALIGN_FILL,
+               NULL);
        gtk_widget_show (widget);
 
        container = widget;
@@ -2296,9 +2304,13 @@ e_day_view_init (EDayView *day_view)
        /* Keep our own canvas reference so we can
         * disconnect signal handlers in dispose(). */
        widget = e_canvas_new ();
-       gtk_table_attach (
-               GTK_TABLE (day_view), widget, 1, 2, 1, 2,
-               GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+       gtk_grid_attach (GTK_GRID (day_view), widget, 1, 1, 1, 1);
+       g_object_set (G_OBJECT (widget),
+               "hexpand", TRUE,
+               "vexpand", TRUE,
+               "halign", GTK_ALIGN_FILL,
+               "valign", GTK_ALIGN_FILL,
+               NULL);
        day_view->main_canvas = g_object_ref (widget);
        gtk_widget_show (widget);
 
@@ -2405,9 +2417,13 @@ e_day_view_init (EDayView *day_view)
        adjustment = gtk_scrollable_get_vadjustment (scrollable);
        scrollable = GTK_SCROLLABLE (widget);
        gtk_scrollable_set_vadjustment (scrollable, adjustment);
-       gtk_table_attach (
-               GTK_TABLE (day_view), widget, 0, 1, 1, 2,
-               GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+       gtk_grid_attach (GTK_GRID (day_view), widget, 0, 1, 1, 1);
+       g_object_set (G_OBJECT (widget),
+               "hexpand", FALSE,
+               "vexpand", TRUE,
+               "halign", GTK_ALIGN_FILL,
+               "valign", GTK_ALIGN_FILL,
+               NULL);
        day_view->time_canvas = g_object_ref (widget);
        gtk_widget_show (widget);
 
@@ -2432,25 +2448,39 @@ e_day_view_init (EDayView *day_view)
        adjustment = gtk_scrollable_get_hadjustment (scrollable);
        day_view->mc_hscrollbar = gtk_scrollbar_new (
                GTK_ORIENTATION_HORIZONTAL, adjustment);
-       gtk_table_attach (GTK_TABLE (day_view), day_view->mc_hscrollbar, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
+       gtk_grid_attach (GTK_GRID (day_view), day_view->mc_hscrollbar, 1, 2, 1, 1);
+       g_object_set (G_OBJECT (day_view->mc_hscrollbar),
+               "hexpand", FALSE,
+               "vexpand", FALSE,
+               "halign", GTK_ALIGN_FILL,
+               "valign", GTK_ALIGN_START,
+               NULL);
        gtk_widget_show (day_view->mc_hscrollbar);
 
        scrollable = GTK_SCROLLABLE (day_view->top_canvas);
        adjustment = gtk_scrollable_get_vadjustment (scrollable);
        day_view->tc_vscrollbar = gtk_scrollbar_new (
                GTK_ORIENTATION_VERTICAL, adjustment);
-       gtk_table_attach (
-               GTK_TABLE (day_view), day_view->tc_vscrollbar,
-               2, 3, 0, 1, 0, GTK_FILL, 0, 0);
+       gtk_grid_attach (GTK_GRID (day_view), day_view->tc_vscrollbar, 2, 0, 1, 1);
+       g_object_set (G_OBJECT (day_view->tc_vscrollbar),
+               "hexpand", FALSE,
+               "vexpand", FALSE,
+               "halign", GTK_ALIGN_START,
+               "valign", GTK_ALIGN_FILL,
+               NULL);
        /* gtk_widget_show (day_view->tc_vscrollbar); */
 
        scrollable = GTK_SCROLLABLE (day_view->main_canvas);
        adjustment = gtk_scrollable_get_vadjustment (scrollable);
        day_view->vscrollbar = gtk_scrollbar_new (
                GTK_ORIENTATION_VERTICAL, adjustment);
-       gtk_table_attach (
-               GTK_TABLE (day_view), day_view->vscrollbar,
-               2, 3, 1, 2, 0, GTK_EXPAND | GTK_FILL, 0, 0);
+       gtk_grid_attach (GTK_GRID (day_view), day_view->vscrollbar, 2, 1, 1, 1);
+       g_object_set (G_OBJECT (day_view->vscrollbar),
+               "hexpand", FALSE,
+               "vexpand", TRUE,
+               "halign", GTK_ALIGN_START,
+               "valign", GTK_ALIGN_FILL,
+               NULL);
        gtk_widget_show (day_view->vscrollbar);
 
        /* Create the cursors. */
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index bc93c59..ec9b695 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -1741,9 +1741,13 @@ e_week_view_init (EWeekView *week_view)
         * Month view.
         */
        week_view->titles_canvas = e_canvas_new ();
-       gtk_table_attach (
-               GTK_TABLE (week_view), week_view->titles_canvas,
-               1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+       gtk_grid_attach (GTK_GRID (week_view), week_view->titles_canvas, 1, 0, 1, 1);
+       g_object_set (G_OBJECT (week_view->titles_canvas),
+               "hexpand", TRUE,
+               "vexpand", FALSE,
+               "halign", GTK_ALIGN_FILL,
+               "valign", GTK_ALIGN_FILL,
+               NULL);
 
        canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (week_view->titles_canvas)->root);
 
@@ -1758,10 +1762,13 @@ e_week_view_init (EWeekView *week_view)
         * Main Canvas
         */
        week_view->main_canvas = e_canvas_new ();
-       gtk_table_attach (
-               GTK_TABLE (week_view), week_view->main_canvas,
-               1, 2, 1, 2,
-               GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 1, 1);
+       gtk_grid_attach (GTK_GRID (week_view), week_view->main_canvas, 1, 1, 1, 1);
+       g_object_set (G_OBJECT (week_view->main_canvas),
+               "hexpand", TRUE,
+               "vexpand", TRUE,
+               "halign", GTK_ALIGN_FILL,
+               "valign", GTK_ALIGN_FILL,
+               NULL);
        gtk_widget_show (week_view->main_canvas);
 
        canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (week_view->main_canvas)->root);
@@ -1811,9 +1818,13 @@ e_week_view_init (EWeekView *week_view)
 
        week_view->vscrollbar = gtk_scrollbar_new (
                GTK_ORIENTATION_VERTICAL, adjustment);
-       gtk_table_attach (
-               GTK_TABLE (week_view), week_view->vscrollbar,
-               2, 3, 1, 2, 0, GTK_EXPAND | GTK_FILL, 0, 0);
+       gtk_grid_attach (GTK_GRID (week_view), week_view->vscrollbar, 2, 1, 1, 1);
+       g_object_set (G_OBJECT (week_view->vscrollbar),
+               "hexpand", FALSE,
+               "vexpand", TRUE,
+               "halign", GTK_ALIGN_START,
+               "valign", GTK_ALIGN_FILL,
+               NULL);
        gtk_widget_show (week_view->vscrollbar);
 
        /* Create the cursors. */


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