[recipes/more-cuisines: 5/5] cuisines: Put the remaining cuisines behind the expander
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes/more-cuisines: 5/5] cuisines: Put the remaining cuisines behind the expander
- Date: Sun, 5 Mar 2017 17:58:31 +0000 (UTC)
commit 3abb081d5e6d400fb9360f084c1987fec4089086
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Mar 5 12:55:44 2017 -0500
cuisines: Put the remaining cuisines behind the expander
This is where we will put more cuisines, going forward.
src/gr-cuisines-page.c | 40 ++++++++++++++++++++++++++++++++--------
1 files changed, 32 insertions(+), 8 deletions(-)
---
diff --git a/src/gr-cuisines-page.c b/src/gr-cuisines-page.c
index 0f38c86..d2048a6 100644
--- a/src/gr-cuisines-page.c
+++ b/src/gr-cuisines-page.c
@@ -121,6 +121,22 @@ season_expander_button_clicked (GrCuisinesPage *page)
}
static void
+cuisine_clicked (GrCategoryTile *tile,
+ GrCuisinesPage *page)
+{
+ GtkWidget *window;
+ const char *cuisine;
+ const char *title;
+
+ window = gtk_widget_get_ancestor (GTK_WIDGET (tile), GR_TYPE_WINDOW);
+
+ cuisine = gr_category_tile_get_category (tile);
+ title = gr_category_tile_get_label (tile);
+
+ gr_window_show_cuisine (GR_WINDOW (window), cuisine, title);
+}
+
+static void
populate_cuisines (GrCuisinesPage *page)
{
GtkWidget *tile;
@@ -132,6 +148,7 @@ populate_cuisines (GrCuisinesPage *page)
int tiles;
container_remove_all (GTK_CONTAINER (page->cuisines_box));
+ container_remove_all (GTK_CONTAINER (page->cuisines_box2));
store = gr_app_get_recipe_store (GR_APP (g_application_get_default ()));
@@ -164,15 +181,22 @@ populate_cuisines (GrCuisinesPage *page)
if (strcmp (page->featured, cuisines[i]) == 0)
continue;
- tile = gr_cuisine_tile_new (cuisines[i], FALSE);
- gtk_widget_show (tile);
- gtk_widget_set_halign (tile, GTK_ALIGN_FILL);
- gtk_grid_attach (GTK_GRID (page->cuisines_box), tile, tiles % 2, 1 + tiles / 2, 1, 1);
-
+ if (tiles < 4) {
+ tile = gr_cuisine_tile_new (cuisines[i], FALSE);
+ gtk_widget_show (tile);
+ gtk_widget_set_halign (tile, GTK_ALIGN_FILL);
+ gtk_grid_attach (GTK_GRID (page->cuisines_box), tile, tiles % 2, 1 + tiles / 2, 1,
1);
+ }
+ else {
+ const char *title;
+
+ gr_cuisine_get_data (cuisines[i], &title, NULL, NULL);
+ tile = gr_category_tile_new_with_label (cuisines[i], title);
+ gtk_widget_show (tile);
+ g_signal_connect (tile, "clicked", G_CALLBACK (cuisine_clicked), page);
+ gtk_container_add (GTK_CONTAINER (page->cuisines_box2), tile);
+ }
tiles++;
-
- if (tiles == 4)
- break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]