From 26c27e880c971d608a9b22bd91de68023416c90b Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 6 Jan 2015 13:53:17 -0200 Subject: [PATCH] search-view: change list row ordering First step to reach the design proposed[1]. [1] https://dl.dropboxusercontent.com/u/5031519/calendar-search-result.png --- src/gcal-search-view.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/gcal-search-view.c b/src/gcal-search-view.c index cffe30ad..3cef89b3 100644 --- a/src/gcal-search-view.c +++ b/src/gcal-search-view.c @@ -120,7 +120,7 @@ G_DEFINE_TYPE_WITH_CODE (GcalSearchView, static GtkWidget* get_event_from_grid (GtkWidget *grid) { - return gtk_grid_get_child_at (GTK_GRID (grid), 1, 0); + return gtk_grid_get_child_at (GTK_GRID (grid), 0, 0); } static GtkWidget* @@ -132,7 +132,7 @@ make_grid_for_event (GcalSearchView *view, GtkWidget *grid; GtkWidget *box; - gchar *text, *markup; + gchar *text; GtkWidget *start_date; GtkWidget *start_time; @@ -166,16 +166,14 @@ make_grid_for_event (GcalSearchView *view, /* 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); - markup = g_strdup_printf ("%s", text); - start_date = gtk_label_new (NULL); - gtk_label_set_markup (GTK_LABEL (start_date), markup); + start_date = gtk_label_new (text); g_free (text); - g_free (markup); if (!all_day) { text = g_date_time_format (datetime, priv->time_mask); start_time = gtk_label_new (text); + gtk_style_context_add_class (gtk_widget_get_style_context (start_time), "dim-label"); g_free (text); } else @@ -187,10 +185,10 @@ make_grid_for_event (GcalSearchView *view, g_free (start); /* 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_grid_attach (GTK_GRID (box), start_date, 1, 0, 1, 1); + gtk_grid_attach (GTK_GRID (box), start_time, 0, 0, 1, 1); + gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (event), 0, 0, 1, 1); + gtk_grid_attach (GTK_GRID (grid), box, 1, 0, 1, 1); gtk_widget_show (start_date); gtk_widget_show (start_time); gtk_widget_show (box);