[recipes] Rename GrRecipeSmallTile
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Rename GrRecipeSmallTile
- Date: Wed, 28 Jun 2017 02:02:50 +0000 (UTC)
commit bdf03beb0a90ec779f0ef87e64260ca460d289ec
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jun 27 21:59:08 2017 -0400
Rename GrRecipeSmallTile
This widget is used on the shopping page, so call it GrShoppingTile.
Makes more sense.
src/gr-shopping-page.c | 26 +++---
src/{gr-recipe-small-tile.c => gr-shopping-tile.c} | 100 ++++++++++----------
src/{gr-recipe-small-tile.h => gr-shopping-tile.h} | 16 ++--
...gr-recipe-small-tile.ui => gr-shopping-tile.ui} | 2 +-
src/meson.build | 2 +-
src/recipes.gresource.xml | 2 +-
6 files changed, 74 insertions(+), 74 deletions(-)
---
diff --git a/src/gr-shopping-page.c b/src/gr-shopping-page.c
index ff00ec2..ba3387c 100644
--- a/src/gr-shopping-page.c
+++ b/src/gr-shopping-page.c
@@ -24,9 +24,9 @@
#include <gtk/gtk.h>
#include "gr-shopping-page.h"
+#include "gr-shopping-tile.h"
#include "gr-recipe-store.h"
#include "gr-recipe.h"
-#include "gr-recipe-small-tile.h"
#include "gr-utils.h"
#include "gr-ingredients-list.h"
#include "gr-window.h"
@@ -494,8 +494,8 @@ collect_ingredients (GrShoppingPage *page)
GrRecipe *recipe;
double yield;
- recipe = gr_recipe_small_tile_get_recipe (GR_RECIPE_SMALL_TILE (tile));
- yield = gr_recipe_small_tile_get_yield (GR_RECIPE_SMALL_TILE (tile));
+ recipe = gr_shopping_tile_get_recipe (GR_SHOPPING_TILE (tile));
+ yield = gr_shopping_tile_get_yield (GR_SHOPPING_TILE (tile));
collect_ingredients_from_recipe (page, recipe, yield);
}
g_list_free (children);
@@ -522,13 +522,13 @@ collect_ingredients (GrShoppingPage *page)
static void
yield_changed (GObject *object, GParamSpec *pspec, GrShoppingPage *page)
{
- GrRecipeSmallTile *tile = GR_RECIPE_SMALL_TILE (object);
+ GrShoppingTile *tile = GR_SHOPPING_TILE (object);
GrRecipeStore *store;
GrRecipe *recipe;
double yield;
- recipe = gr_recipe_small_tile_get_recipe (tile);
- yield = gr_recipe_small_tile_get_yield (tile);
+ recipe = gr_shopping_tile_get_recipe (tile);
+ yield = gr_shopping_tile_get_yield (tile);
store = gr_recipe_store_get ();
@@ -559,7 +559,7 @@ search_hits_added (GrRecipeSearch *search,
double yield;
yield = gr_recipe_store_get_shopping_yield (store, recipe);
- tile = gr_recipe_small_tile_new (recipe, yield);
+ tile = gr_shopping_tile_new (recipe, yield);
g_signal_connect (tile, "notify::yield", G_CALLBACK (yield_changed), page);
gtk_container_add (GTK_CONTAINER (page->recipe_list), tile);
page->recipe_count++;
@@ -580,7 +580,7 @@ search_hits_removed (GrRecipeSearch *search,
GrRecipe *recipe;
tile = gtk_bin_get_child (GTK_BIN (item));
- recipe = gr_recipe_small_tile_get_recipe (GR_RECIPE_SMALL_TILE (tile));
+ recipe = gr_shopping_tile_get_recipe (GR_SHOPPING_TILE (tile));
if (g_list_find (hits, recipe)) {
gtk_container_remove (GTK_CONTAINER (page->recipe_list), item);
page->recipe_count--;
@@ -629,7 +629,7 @@ get_recipes (GrShoppingPage *page)
GtkWidget *tile = gtk_bin_get_child (GTK_BIN (l->data));
GrRecipe *recipe;
- recipe = gr_recipe_small_tile_get_recipe (GR_RECIPE_SMALL_TILE (tile));
+ recipe = gr_shopping_tile_get_recipe (GR_SHOPPING_TILE (tile));
recipes = g_list_append (recipes, g_object_ref (recipe));
}
g_list_free (children);
@@ -884,7 +884,7 @@ recipe_removed (GrShoppingPage *page,
for (l = children; l; l = l->next) {
GtkWidget *tile = gtk_bin_get_child (GTK_BIN (l->data));
- if (recipe == gr_recipe_small_tile_get_recipe (GR_RECIPE_SMALL_TILE (tile))) {
+ if (recipe == gr_shopping_tile_get_recipe (GR_SHOPPING_TILE (tile))) {
gtk_widget_destroy (GTK_WIDGET (l->data));
collect_ingredients (page);
@@ -916,8 +916,8 @@ recipe_added (GrShoppingPage *page,
for (l = children; l; l = l->next) {
GtkWidget *tile = gtk_bin_get_child (GTK_BIN (l->data));
- if (recipe == gr_recipe_small_tile_get_recipe (GR_RECIPE_SMALL_TILE (tile))) {
- gr_recipe_small_tile_set_yield (GR_RECIPE_SMALL_TILE (tile), yield);
+ if (recipe == gr_shopping_tile_get_recipe (GR_SHOPPING_TILE (tile))) {
+ gr_shopping_tile_set_yield (GR_SHOPPING_TILE (tile), yield);
break;
}
}
@@ -926,7 +926,7 @@ recipe_added (GrShoppingPage *page,
if (l == NULL) {
GtkWidget *tile;
- tile = gr_recipe_small_tile_new (recipe, yield);
+ tile = gr_shopping_tile_new (recipe, yield);
g_signal_connect (tile, "notify::yield", G_CALLBACK (yield_changed), page);
gtk_container_add (GTK_CONTAINER (page->recipe_list), tile);
}
diff --git a/src/gr-recipe-small-tile.c b/src/gr-shopping-tile.c
similarity index 67%
rename from src/gr-recipe-small-tile.c
rename to src/gr-shopping-tile.c
index 1cf80f5..aa46d7a 100644
--- a/src/gr-recipe-small-tile.c
+++ b/src/gr-shopping-tile.c
@@ -1,4 +1,4 @@
-/* gr-recipe-small-tile.c:
+/* gr-shopping-tile.c:
*
* Copyright (C) 2017 Matthias Clasen <mclasen redhat com>
*
@@ -24,14 +24,14 @@
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "gr-recipe-small-tile.h"
+#include "gr-shopping-tile.h"
#include "gr-recipe-store.h"
#include "gr-window.h"
#include "gr-utils.h"
#include "gr-image.h"
-struct _GrRecipeSmallTile
+struct _GrShoppingTile
{
GtkButton parent_instance;
@@ -52,7 +52,7 @@ struct _GrRecipeSmallTile
double yield;
};
-G_DEFINE_TYPE (GrRecipeSmallTile, gr_recipe_small_tile, GTK_TYPE_BUTTON)
+G_DEFINE_TYPE (GrShoppingTile, gr_shopping_tile, GTK_TYPE_BUTTON)
enum {
PROP_0,
@@ -61,8 +61,8 @@ enum {
};
void
-gr_recipe_small_tile_set_yield (GrRecipeSmallTile *tile,
- double yield)
+gr_shopping_tile_set_yield (GrShoppingTile *tile,
+ double yield)
{
g_autofree char *tmp = NULL;
@@ -79,8 +79,8 @@ gr_recipe_small_tile_set_yield (GrRecipeSmallTile *tile,
}
static void
-recipe_small_tile_set_recipe (GrRecipeSmallTile *tile,
- GrRecipe *recipe)
+shopping_tile_set_recipe (GrShoppingTile *tile,
+ GrRecipe *recipe)
{
GrRecipeStore *store;
@@ -128,18 +128,18 @@ recipe_small_tile_set_recipe (GrRecipeSmallTile *tile,
}
static void
-tile_clicked (GrRecipeSmallTile *tile)
+tile_clicked (GrShoppingTile *tile)
{
gtk_popover_popup (GTK_POPOVER (tile->popover));
}
static void
-yield_spin_value_changed (GrRecipeSmallTile *tile)
+yield_spin_value_changed (GrShoppingTile *tile)
{
double yield;
yield = gtk_spin_button_get_value (GTK_SPIN_BUTTON (tile->yield_spin));
- gr_recipe_small_tile_set_yield (tile, yield);
+ gr_shopping_tile_set_yield (tile, yield);
}
static int
@@ -172,7 +172,7 @@ yield_spin_output (GtkSpinButton *spin)
}
static void
-remove_recipe (GrRecipeSmallTile *tile)
+remove_recipe (GrShoppingTile *tile)
{
GrRecipeStore *store;
@@ -182,32 +182,32 @@ remove_recipe (GrRecipeSmallTile *tile)
}
static void
-recipe_small_tile_finalize (GObject *object)
+shopping_tile_finalize (GObject *object)
{
- GrRecipeSmallTile *tile = GR_RECIPE_SMALL_TILE (object);
+ GrShoppingTile *tile = GR_SHOPPING_TILE (object);
g_cancellable_cancel (tile->cancellable);
g_clear_object (&tile->cancellable);
g_clear_object (&tile->recipe);
- G_OBJECT_CLASS (gr_recipe_small_tile_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gr_shopping_tile_parent_class)->finalize (object);
}
static void
-gr_recipe_small_tile_init (GrRecipeSmallTile *tile)
+gr_shopping_tile_init (GrShoppingTile *tile)
{
gtk_widget_set_has_window (GTK_WIDGET (tile), FALSE);
gtk_widget_init_template (GTK_WIDGET (tile));
- gr_recipe_small_tile_set_yield (tile, 1.0);
+ gr_shopping_tile_set_yield (tile, 1.0);
}
static void
-recipe_small_tile_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+shopping_tile_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- GrRecipeSmallTile *self = GR_RECIPE_SMALL_TILE (object);
+ GrShoppingTile *self = GR_SHOPPING_TILE (object);
switch (prop_id) {
case PROP_YIELD:
@@ -219,16 +219,16 @@ recipe_small_tile_get_property (GObject *object,
}
static void
-recipe_small_tile_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+shopping_tile_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GrRecipeSmallTile *self = GR_RECIPE_SMALL_TILE (object);
+ GrShoppingTile *self = GR_SHOPPING_TILE (object);
switch (prop_id) {
case PROP_YIELD:
- gr_recipe_small_tile_set_yield (self, g_value_get_double (value));
+ gr_shopping_tile_set_yield (self, g_value_get_double (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -236,32 +236,32 @@ recipe_small_tile_set_property (GObject *object,
}
static void
-gr_recipe_small_tile_class_init (GrRecipeSmallTileClass *klass)
+gr_shopping_tile_class_init (GrShoppingTileClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GParamSpec *pspec;
- object_class->finalize = recipe_small_tile_finalize;
- object_class->get_property = recipe_small_tile_get_property;
- object_class->set_property = recipe_small_tile_set_property;
+ object_class->finalize = shopping_tile_finalize;
+ object_class->get_property = shopping_tile_get_property;
+ object_class->set_property = shopping_tile_set_property;
pspec = g_param_spec_double ("yield", NULL, NULL,
0.0, G_MAXDOUBLE, 1.0,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_YIELD, pspec);
- gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/Recipes/gr-recipe-small-tile.ui");
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Recipes/gr-shopping-tile.ui");
- gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, label);
- gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, author);
- gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, image);
- gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, box);
- gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, yield_label);
- gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, popover);
- gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, yield_spin);
- gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, yield_unit_label);
- gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, remove_button);
+ gtk_widget_class_bind_template_child (widget_class, GrShoppingTile, label);
+ gtk_widget_class_bind_template_child (widget_class, GrShoppingTile, author);
+ gtk_widget_class_bind_template_child (widget_class, GrShoppingTile, image);
+ gtk_widget_class_bind_template_child (widget_class, GrShoppingTile, box);
+ gtk_widget_class_bind_template_child (widget_class, GrShoppingTile, yield_label);
+ gtk_widget_class_bind_template_child (widget_class, GrShoppingTile, popover);
+ gtk_widget_class_bind_template_child (widget_class, GrShoppingTile, yield_spin);
+ gtk_widget_class_bind_template_child (widget_class, GrShoppingTile, yield_unit_label);
+ gtk_widget_class_bind_template_child (widget_class, GrShoppingTile, remove_button);
gtk_widget_class_bind_template_callback (widget_class, tile_clicked);
gtk_widget_class_bind_template_callback (widget_class, yield_spin_value_changed);
@@ -271,26 +271,26 @@ gr_recipe_small_tile_class_init (GrRecipeSmallTileClass *klass)
}
GtkWidget *
-gr_recipe_small_tile_new (GrRecipe *recipe,
- double yield)
+gr_shopping_tile_new (GrRecipe *recipe,
+ double yield)
{
- GrRecipeSmallTile *tile;
+ GrShoppingTile *tile;
- tile = g_object_new (GR_TYPE_RECIPE_SMALL_TILE, NULL);
- recipe_small_tile_set_recipe (tile, recipe);
- gr_recipe_small_tile_set_yield (tile, yield);
+ tile = g_object_new (GR_TYPE_SHOPPING_TILE, NULL);
+ shopping_tile_set_recipe (tile, recipe);
+ gr_shopping_tile_set_yield (tile, yield);
return GTK_WIDGET (tile);
}
GrRecipe *
-gr_recipe_small_tile_get_recipe (GrRecipeSmallTile *tile)
+gr_shopping_tile_get_recipe (GrShoppingTile *tile)
{
return tile->recipe;
}
double
-gr_recipe_small_tile_get_yield (GrRecipeSmallTile *tile)
+gr_shopping_tile_get_yield (GrShoppingTile *tile)
{
return tile->yield;
}
diff --git a/src/gr-recipe-small-tile.h b/src/gr-shopping-tile.h
similarity index 59%
rename from src/gr-recipe-small-tile.h
rename to src/gr-shopping-tile.h
index 1f3c945..01e64b6 100644
--- a/src/gr-recipe-small-tile.h
+++ b/src/gr-shopping-tile.h
@@ -26,15 +26,15 @@
G_BEGIN_DECLS
-#define GR_TYPE_RECIPE_SMALL_TILE (gr_recipe_small_tile_get_type ())
+#define GR_TYPE_SHOPPING_TILE (gr_shopping_tile_get_type ())
-G_DECLARE_FINAL_TYPE (GrRecipeSmallTile, gr_recipe_small_tile, GR, RECIPE_SMALL_TILE, GtkButton)
+G_DECLARE_FINAL_TYPE (GrShoppingTile, gr_shopping_tile, GR, SHOPPING_TILE, GtkButton)
-GtkWidget *gr_recipe_small_tile_new (GrRecipe *recipe,
- double yield);
-GrRecipe *gr_recipe_small_tile_get_recipe (GrRecipeSmallTile *tile);
-double gr_recipe_small_tile_get_yield (GrRecipeSmallTile *tile);
-void gr_recipe_small_tile_set_yield (GrRecipeSmallTile *tile,
- double yield);
+GtkWidget *gr_shopping_tile_new (GrRecipe *recipe,
+ double yield);
+GrRecipe *gr_shopping_tile_get_recipe (GrShoppingTile *tile);
+double gr_shopping_tile_get_yield (GrShoppingTile *tile);
+void gr_shopping_tile_set_yield (GrShoppingTile *tile,
+ double yield);
G_END_DECLS
diff --git a/src/gr-recipe-small-tile.ui b/src/gr-shopping-tile.ui
similarity index 99%
rename from src/gr-recipe-small-tile.ui
rename to src/gr-shopping-tile.ui
index 06ddfc9..db7cbe5 100644
--- a/src/gr-recipe-small-tile.ui
+++ b/src/gr-shopping-tile.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gnome-recipes">
- <template class="GrRecipeSmallTile" parent="GtkButton">
+ <template class="GrShoppingTile" parent="GtkButton">
<property name="visible">True</property>
<signal name="clicked" handler="tile_clicked" swapped="yes"/>
<style>
diff --git a/src/meson.build b/src/meson.build
index dedea30..e9c7195 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -81,7 +81,7 @@ src += ['main.c',
'gr-recipe-formatter.c',
'gr-recipe-importer.c',
'gr-recipe-printer.c',
- 'gr-recipe-small-tile.c',
+ 'gr-shopping-tile.c',
'gr-recipe-store.c',
'gr-recipe-tile.c',
'gr-recipes-page.c',
diff --git a/src/recipes.gresource.xml b/src/recipes.gresource.xml
index 23a04aa..dab6a2b 100644
--- a/src/recipes.gresource.xml
+++ b/src/recipes.gresource.xml
@@ -20,7 +20,7 @@
<file preprocess="xml-stripblanks">gr-list-page.ui</file>
<file preprocess="xml-stripblanks">gr-meal-row.ui</file>
<file preprocess="xml-stripblanks">gr-recipes-page.ui</file>
- <file preprocess="xml-stripblanks">gr-recipe-small-tile.ui</file>
+ <file preprocess="xml-stripblanks">gr-shopping-tile.ui</file>
<file preprocess="xml-stripblanks">gr-recipe-tile.ui</file>
<file preprocess="xml-stripblanks">gr-search-page.ui</file>
<file preprocess="xml-stripblanks">gr-shopping-page.ui</file>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]