[recipes] Drop angles and rename GrRotatedImage
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Drop angles and rename GrRotatedImage
- Date: Sun, 19 Feb 2017 01:11:55 +0000 (UTC)
commit c750074c912a883929c1f1d198292fd4f8acfefa
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Feb 18 19:28:43 2017 -0500
Drop angles and rename GrRotatedImage
There is nothing about rotation here anymore.
src/gr-cooking-view.c | 4 ++--
src/gr-edit-page.c | 4 ++--
src/gr-image-page.c | 12 ++++++------
src/gr-image-viewer.c | 28 ++++++++++++++--------------
src/gr-images.c | 11 +++++------
src/gr-images.h | 5 ++---
src/gr-recipe-exporter.c | 2 +-
src/gr-recipe-importer.c | 4 ++--
src/gr-recipe-printer.c | 4 ++--
src/gr-recipe-store.c | 6 +++---
src/gr-recipe-tile.c | 4 ++--
src/gr-recipe.c | 6 +++---
src/gr-shell-search-provider.c | 2 +-
13 files changed, 45 insertions(+), 47 deletions(-)
---
diff --git a/src/gr-cooking-view.c b/src/gr-cooking-view.c
index 4a2ecb1..aad7399 100644
--- a/src/gr-cooking-view.c
+++ b/src/gr-cooking-view.c
@@ -211,10 +211,10 @@ setup_step (GrCookingView *view)
gtk_stack_set_visible_child_name (GTK_STACK (view->cooking_stack), "timer");
}
else if (0 <= s->image && s->image < view->images->len) {
- GrRotatedImage *ri = NULL;
+ GrImage *ri = NULL;
g_autoptr(GdkPixbuf) pixbuf = NULL;
- ri = &g_array_index (view->images, GrRotatedImage, s->image);
+ ri = &g_array_index (view->images, GrImage, s->image);
if (view->wide)
pixbuf = load_pixbuf_fill_size (ri->path, 0, 640, 480);
else
diff --git a/src/gr-edit-page.c b/src/gr-edit-page.c
index 6a50c74..f50f9b1 100644
--- a/src/gr-edit-page.c
+++ b/src/gr-edit-page.c
@@ -158,7 +158,7 @@ populate_image_flowbox (GrEditPage *page)
container_remove_all (GTK_CONTAINER (page->image_flowbox));
for (i = 0; i < images->len; i++) {
- GrRotatedImage *ri = &g_array_index (images, GrRotatedImage, i);
+ GrImage *ri = &g_array_index (images, GrImage, i);
g_autoptr(GdkPixbuf) pb = load_pixbuf_fill_size (ri->path, 0, 60, 40);
GtkWidget *image;
GtkWidget *child;
@@ -1774,7 +1774,7 @@ gr_edit_page_clear (GrEditPage *page)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->milk_free_check), FALSE);
gtk_widget_hide (page->author_label);
- images = gr_rotated_image_array_new ();
+ images = gr_image_array_new ();
g_object_set (page->images, "images", images, NULL);
g_array_unref (images);
diff --git a/src/gr-image-page.c b/src/gr-image-page.c
index 1afd60f..7310b30 100644
--- a/src/gr-image-page.c
+++ b/src/gr-image-page.c
@@ -84,7 +84,7 @@ static void
set_current_image (GrImagePage *page)
{
if (page->images->len > page->index) {
- GrRotatedImage *ri = NULL;
+ GrImage *ri = NULL;
g_autoptr(GdkPixbuf) pixbuf = NULL;
GdkDisplay *display;
GdkWindow *win;
@@ -96,7 +96,7 @@ set_current_image (GrImagePage *page)
monitor = gdk_display_get_monitor_at_window (display, win);
gdk_monitor_get_geometry (monitor, &geom);
- ri = &g_array_index (page->images, GrRotatedImage, page->index);
+ ri = &g_array_index (page->images, GrImage, page->index);
pixbuf = load_pixbuf_fit_size (ri->path, 0, geom.width - 80, geom.height - 80, FALSE);
gtk_image_set_from_pixbuf (GTK_IMAGE (page->image), pixbuf);
}
@@ -221,7 +221,7 @@ gr_image_page_init (GrImagePage *self)
g_signal_connect (self->event_box, "motion-notify-event", G_CALLBACK (motion_notify), self);
g_signal_connect (self->event_box, "key-press-event", G_CALLBACK (key_press_event), self);
- self->images = gr_rotated_image_array_new ();
+ self->images = gr_image_array_new ();
}
static void
@@ -292,11 +292,11 @@ gr_image_page_class_init (GrImagePageClass *klass)
static void
add_image (GrImagePage *page,
- GrRotatedImage *ri,
+ GrImage *ri,
gboolean select)
{
g_array_append_vals (page->images, ri, 1);
- ri = &g_array_index (page->images, GrRotatedImage, page->images->len - 1);
+ ri = &g_array_index (page->images, GrImage, page->images->len - 1);
ri->path = g_strdup (ri->path);
if (select)
@@ -318,7 +318,7 @@ gr_image_page_set_images (GrImagePage *page,
g_object_notify (G_OBJECT (page), "images");
for (i = 0; i < images->len; i++) {
- GrRotatedImage *ri = &g_array_index (images, GrRotatedImage, i);
+ GrImage *ri = &g_array_index (images, GrImage, i);
add_image (page, ri, FALSE);
}
diff --git a/src/gr-image-viewer.c b/src/gr-image-viewer.c
index a2e2b94..bdeb358 100644
--- a/src/gr-image-viewer.c
+++ b/src/gr-image-viewer.c
@@ -112,11 +112,11 @@ set_current_image (GrImageViewer *viewer)
}
if (viewer->images->len > viewer->index) {
- GrRotatedImage *ri = NULL;
+ GrImage *ri = NULL;
g_autoptr(GdkPixbuf) pixbuf = NULL;
const char *vis;
- ri = &g_array_index (viewer->images, GrRotatedImage, viewer->index);
+ ri = &g_array_index (viewer->images, GrImage, viewer->index);
pixbuf = load_pixbuf_fill_size (ri->path, 0, 360, 240);
vis = gtk_stack_get_visible_child_name (GTK_STACK (viewer->stack));
@@ -145,7 +145,7 @@ populate_preview (GrImageViewer *viewer)
container_remove_all (GTK_CONTAINER (viewer->preview_list));
for (i = 0; i < viewer->images->len; i++) {
- GrRotatedImage *ri = &g_array_index (viewer->images, GrRotatedImage, i);
+ GrImage *ri = &g_array_index (viewer->images, GrImage, i);
g_autoptr(GdkPixbuf) pb = load_pixbuf_fill_size (ri->path, 0, 60, 40);
GtkWidget *image;
@@ -322,11 +322,11 @@ preview_selected (GrImageViewer *viewer)
static void
add_image (GrImageViewer *viewer,
- GrRotatedImage *ri,
+ GrImage *ri,
gboolean select)
{
g_array_append_vals (viewer->images, ri, 1);
- ri = &g_array_index (viewer->images, GrRotatedImage, viewer->images->len - 1);
+ ri = &g_array_index (viewer->images, GrImage, viewer->images->len - 1);
ri->path = g_strdup (ri->path);
populate_preview (viewer);
@@ -345,7 +345,7 @@ image_received (GtkClipboard *clipboard,
GrImageViewer *viewer = data;
if (pixbuf) {
- GrRotatedImage ri;
+ GrImage ri;
g_autofree char *dir = NULL;
g_autofree char *path = NULL;
int fd;
@@ -420,7 +420,7 @@ gr_image_viewer_init (GrImageViewer *self)
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (self->gesture), 0);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (self->gesture), GTK_PHASE_BUBBLE);
g_signal_connect (self->gesture, "pressed", G_CALLBACK (button_press), self);
- self->images = gr_rotated_image_array_new ();
+ self->images = gr_image_array_new ();
self->additions = g_ptr_array_new_with_free_func (g_free);
self->removals = g_ptr_array_new_with_free_func (g_free);
@@ -531,10 +531,10 @@ gr_image_viewer_set_images (GrImageViewer *viewer,
g_object_notify (G_OBJECT (viewer), "images");
for (i = 0; i < images->len; i++) {
- GrRotatedImage *ri = &g_array_index (images, GrRotatedImage, i);
+ GrImage *ri = &g_array_index (images, GrImage, i);
g_array_append_vals (viewer->images, ri, 1);
- ri = &g_array_index (viewer->images, GrRotatedImage, viewer->images->len - 1);
+ ri = &g_array_index (viewer->images, GrImage, viewer->images->len - 1);
ri->path = g_strdup (ri->path);
}
@@ -556,7 +556,7 @@ file_chooser_response (GtkNativeDialog *self,
names = gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (self));
for (l = names; l; l = l->next) {
- GrRotatedImage ri;
+ GrImage ri;
ri.path = import_image (l->data);
@@ -622,9 +622,9 @@ gr_image_viewer_add_image (GrImageViewer *viewer)
void
gr_image_viewer_remove_image (GrImageViewer *viewer)
{
- GrRotatedImage *ri;
+ GrImage *ri;
- ri = &g_array_index (viewer->images, GrRotatedImage, viewer->index);
+ ri = &g_array_index (viewer->images, GrImage, viewer->index);
g_ptr_array_add (viewer->removals, g_strdup (ri->path));
@@ -654,12 +654,12 @@ void
gr_image_viewer_rotate_image (GrImageViewer *viewer,
int angle)
{
- GrRotatedImage *ri;
+ GrImage *ri;
char *path;
g_assert (angle == 0 || angle == 90 || angle == 180 || angle == 270);
- ri = &g_array_index (viewer->images, GrRotatedImage, viewer->index);
+ ri = &g_array_index (viewer->images, GrImage, viewer->index);
path = rotate_image (ri->path, angle);
g_ptr_array_add (viewer->removals, g_strdup (ri->path));
diff --git a/src/gr-images.c b/src/gr-images.c
index 03fc9fb..a56e4d5 100644
--- a/src/gr-images.c
+++ b/src/gr-images.c
@@ -23,21 +23,20 @@
#include "gr-images.h"
static void
-gr_rotated_image_clear (gpointer data)
+gr_image_clear (gpointer data)
{
- GrRotatedImage *image = data;
+ GrImage *image = data;
g_clear_pointer (&image->path, g_free);
- image->angle = 0;
}
GArray *
-gr_rotated_image_array_new (void)
+gr_image_array_new (void)
{
GArray *a;
- a = g_array_new (TRUE, TRUE, sizeof (GrRotatedImage));
- g_array_set_clear_func (a, gr_rotated_image_clear);
+ a = g_array_new (TRUE, TRUE, sizeof (GrImage));
+ g_array_set_clear_func (a, gr_image_clear);
return a;
}
diff --git a/src/gr-images.h b/src/gr-images.h
index ede4e4c..2bd195a 100644
--- a/src/gr-images.h
+++ b/src/gr-images.h
@@ -26,9 +26,8 @@ G_BEGIN_DECLS
typedef struct {
char *path;
- int angle;
-} GrRotatedImage;
+} GrImage;
-GArray *gr_rotated_image_array_new (void);
+GArray *gr_image_array_new (void);
G_END_DECLS
diff --git a/src/gr-recipe-exporter.c b/src/gr-recipe-exporter.c
index 207e67c..db004c0 100644
--- a/src/gr-recipe-exporter.c
+++ b/src/gr-recipe-exporter.c
@@ -232,7 +232,7 @@ export_one_recipe (GrRecipeExporter *exporter,
paths = g_new0 (char *, images->len + 1);
dark = g_new0 (gboolean, images->len + 1);
for (i = 0, j = 0; i < images->len; i++) {
- GrRotatedImage *ri = &g_array_index (images, GrRotatedImage, i);
+ GrImage *ri = &g_array_index (images, GrImage, i);
g_autoptr(GFile) source = NULL;
g_autoptr(GFile) dest = NULL;
g_autofree char *basename = NULL;
diff --git a/src/gr-recipe-importer.c b/src/gr-recipe-importer.c
index 3306e83..3c0a83c 100644
--- a/src/gr-recipe-importer.c
+++ b/src/gr-recipe-importer.c
@@ -288,11 +288,11 @@ import_recipe (GrRecipeImporter *importer)
store = gr_app_get_recipe_store (GR_APP (g_application_get_default ()));
- images = gr_rotated_image_array_new ();
+ images = gr_image_array_new ();
if (importer->recipe_paths) {
int i;
for (i = 0; importer->recipe_paths[i]; i++) {
- GrRotatedImage ri;
+ GrImage ri;
char *new_path;
if (!copy_image (importer, importer->recipe_paths[i], &new_path, &error)) {
diff --git a/src/gr-recipe-printer.c b/src/gr-recipe-printer.c
index feff440..da8f000 100644
--- a/src/gr-recipe-printer.c
+++ b/src/gr-recipe-printer.c
@@ -162,7 +162,7 @@ begin_print (GtkPrintOperation *operation,
GList *page_breaks;
g_autoptr(GString) s = NULL;
g_autoptr(GArray) images = NULL;
- GrRotatedImage *ri;
+ GrImage *ri;
PangoRectangle title_rect;
PangoRectangle left_rect;
int num_lines;
@@ -183,7 +183,7 @@ begin_print (GtkPrintOperation *operation,
g_object_get (printer->recipe, "images", &images, NULL);
if (images && images->len > 0) {
- ri = &g_array_index (images, GrRotatedImage, 0);
+ ri = &g_array_index (images, GrImage, 0);
printer->image = load_pixbuf_fit_size (ri->path, 0, width / 2, height / 4, FALSE);
}
diff --git a/src/gr-recipe-store.c b/src/gr-recipe-store.c
index 1ddb2d8..77912bd 100644
--- a/src/gr-recipe-store.c
+++ b/src/gr-recipe-store.c
@@ -121,7 +121,7 @@ load_recipes (GrRecipeStore *self,
int default_image = 0;
GrDiets diets;
g_autoptr(GArray) images = NULL;
- GrRotatedImage ri;
+ GrImage ri;
g_autoptr(GDateTime) ctime = NULL;
g_autoptr(GDateTime) mtime = NULL;
char *tmp;
@@ -270,7 +270,7 @@ load_recipes (GrRecipeStore *self,
}
}
- images = gr_rotated_image_array_new ();
+ images = gr_image_array_new ();
if (paths) {
for (j = 0; paths[j]; j++) {
ri.path = g_strdup (paths[j]);
@@ -440,7 +440,7 @@ save_recipes (GrRecipeStore *self)
tmp = get_user_data_dir ();
paths = g_new0 (char *, images->len + 1);
for (i = 0; i < images->len; i++) {
- GrRotatedImage *ri = &g_array_index (images, GrRotatedImage, i);
+ GrImage *ri = &g_array_index (images, GrImage, i);
if (g_str_has_prefix (ri->path, tmp))
paths[i] = g_strdup (ri->path + strlen (tmp) + 1);
else
diff --git a/src/gr-recipe-tile.c b/src/gr-recipe-tile.c
index 02ed712..f03645c 100644
--- a/src/gr-recipe-tile.c
+++ b/src/gr-recipe-tile.c
@@ -65,7 +65,7 @@ add_recipe_css (GrRecipe *recipe,
g_object_get (recipe, "images", &images, NULL);
if (images->len > 0) {
- GrRotatedImage *ri;
+ GrImage *ri;
g_autofree char *path = NULL;
int index;
@@ -73,7 +73,7 @@ add_recipe_css (GrRecipe *recipe,
if (index < 0 || index >= images->len)
index = 0;
- ri = &g_array_index (images, GrRotatedImage, index);
+ ri = &g_array_index (images, GrImage, index);
g_string_append_printf (css, "image.recipe.small.%s,\nbox.recipe.%s {\n", id, id);
g_string_append_printf (css, " background: url('%s');\n"
diff --git a/src/gr-recipe.c b/src/gr-recipe.c
index ab01cea..ca2cfcc 100644
--- a/src/gr-recipe.c
+++ b/src/gr-recipe.c
@@ -236,9 +236,9 @@ set_images (GrRecipe *self,
g_array_remove_range (self->images, 0, self->images->len);
for (i = 0; i < images->len; i++) {
- GrRotatedImage *ri = &g_array_index (images, GrRotatedImage, i);
+ GrImage *ri = &g_array_index (images, GrImage, i);
g_array_append_vals (self->images, ri, 1);
- ri = &g_array_index (self->images, GrRotatedImage, i);
+ ri = &g_array_index (self->images, GrImage, i);
ri->path = g_strdup (ri->path);
}
@@ -510,7 +510,7 @@ gr_recipe_init (GrRecipe *self)
{
self->ctime = g_date_time_new_now_utc ();
self->mtime = g_date_time_new_now_utc ();
- self->images = gr_rotated_image_array_new ();
+ self->images = gr_image_array_new ();
}
GrRecipe *
diff --git a/src/gr-shell-search-provider.c b/src/gr-shell-search-provider.c
index d3a5e77..ad629ac 100644
--- a/src/gr-shell-search-provider.c
+++ b/src/gr-shell-search-provider.c
@@ -171,7 +171,7 @@ gr_recipe_get_pixbuf (GrRecipe *recipe)
g_object_get (recipe, "images", &images, NULL);
if (images->len > 0) {
- GrRotatedImage *ri = &g_array_index (images, GrRotatedImage, 0);
+ GrImage *ri = &g_array_index (images, GrImage, 0);
GdkPixbuf *pixbuf;
pixbuf = load_pixbuf_fill_size (ri->path, 0, 64, 64);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]