[gnome-calendar/search-improvements] search-view: wrap date & time labels in a box
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/search-improvements] search-view: wrap date & time labels in a box
- Date: Sun, 4 Jan 2015 00:38:32 +0000 (UTC)
commit 8130b2f9d558b37d54cfffaee83b97d2c9a34def
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sat Jan 3 22:38:21 2015 -0200
search-view: wrap date & time labels in a box
Makes the upper grid more flexible.
src/gcal-search-view.c | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/src/gcal-search-view.c b/src/gcal-search-view.c
index 7f8148f..93b3443 100644
--- a/src/gcal-search-view.c
+++ b/src/gcal-search-view.c
@@ -108,7 +108,7 @@ G_DEFINE_TYPE_WITH_CODE (GcalSearchView,
static GtkWidget*
get_event_from_grid (GtkWidget *grid)
{
- return gtk_grid_get_child_at (GTK_GRID (grid), 2, 0);
+ return gtk_grid_get_child_at (GTK_GRID (grid), 1, 0);
}
static GtkWidget*
@@ -118,6 +118,7 @@ make_grid_for_event (GcalSearchView *view,
GcalSearchViewPrivate *priv;
GDateTime *datetime;
GtkWidget *grid;
+ GtkWidget *box;
gchar *text;
GtkWidget *start_date;
@@ -134,16 +135,21 @@ make_grid_for_event (GcalSearchView *view,
gtk_widget_set_valign (GTK_WIDGET (event), GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (GTK_WIDGET (event), TRUE);
- /* grid */
+ /* grid & box*/
grid = gtk_grid_new ();
+ box = gtk_grid_new ();
+
g_object_set (grid,
"column-spacing", 6,
- "column-homogeneous", TRUE,
"border-width", 6,
"margin-start", 12,
"margin-end", 12,
"hexpand", TRUE, NULL);
+ gtk_grid_set_column_spacing (GTK_GRID (box), 6);
+ gtk_grid_set_column_homogeneous (GTK_GRID (box), TRUE);
+ gtk_widget_set_margin_end (box, 6);
+
/* start date & time */
datetime = g_date_time_new_local (start->year, start->month, start->day, start->hour, start->minute,
start->second);
text = g_date_time_format (datetime, priv->date_mask);
@@ -164,12 +170,14 @@ make_grid_for_event (GcalSearchView *view,
g_date_time_unref (datetime);
g_free (start);
- /* labels: 20%; event widget: 80% */
- gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (event), 2, 0, 10, 1);
- gtk_grid_attach (GTK_GRID (grid), start_date, 0, 0, 1, 1);
- gtk_grid_attach (GTK_GRID (grid), start_time, 1, 0, 1, 1);
+ /* labels: 10%; event widget: 90% */
+ gtk_grid_attach (GTK_GRID (box), start_date, 0, 0, 1, 1);
+ gtk_grid_attach (GTK_GRID (box), start_time, 1, 0, 1, 1);
+ gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (event), 1, 0, 1, 1);
+ gtk_grid_attach (GTK_GRID (grid), box, 0, 0, 1, 1);
gtk_widget_show (start_date);
gtk_widget_show (start_time);
+ gtk_widget_show (box);
gtk_widget_show (grid);
gtk_widget_show (GTK_WIDGET (event));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]