[recipes] Drop all use of angles in GrRotateImage
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Drop all use of angles in GrRotateImage
- Date: Sun, 19 Feb 2017 01:11:50 +0000 (UTC)
commit 998bcdbfe2017ad5f9317d6af6eff19f6bccf1a5
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Feb 18 19:23:23 2017 -0500
Drop all use of angles in GrRotateImage
We don't need this anymore, since we now apply rotations
in the file system.
src/gr-cooking-view.c | 4 ++--
src/gr-edit-page.c | 2 +-
src/gr-image-page.c | 2 +-
src/gr-image-viewer.c | 6 ++----
src/gr-recipe-exporter.c | 7 -------
src/gr-recipe-importer.c | 6 ------
src/gr-recipe-printer.c | 2 +-
src/gr-recipe-store.c | 38 +-------------------------------------
src/gr-shell-search-provider.c | 2 +-
9 files changed, 9 insertions(+), 60 deletions(-)
---
diff --git a/src/gr-cooking-view.c b/src/gr-cooking-view.c
index 9194013..4a2ecb1 100644
--- a/src/gr-cooking-view.c
+++ b/src/gr-cooking-view.c
@@ -216,9 +216,9 @@ setup_step (GrCookingView *view)
ri = &g_array_index (view->images, GrRotatedImage, s->image);
if (view->wide)
- pixbuf = load_pixbuf_fill_size (ri->path, ri->angle, 640, 480);
+ pixbuf = load_pixbuf_fill_size (ri->path, 0, 640, 480);
else
- pixbuf = load_pixbuf_fill_size (ri->path, ri->angle, 320, 240);
+ pixbuf = load_pixbuf_fill_size (ri->path, 0, 320, 240);
gtk_image_set_from_pixbuf (GTK_IMAGE (view->cooking_image), pixbuf);
gtk_stack_set_visible_child_name (GTK_STACK (view->cooking_stack), "image");
}
diff --git a/src/gr-edit-page.c b/src/gr-edit-page.c
index b026d02..6a50c74 100644
--- a/src/gr-edit-page.c
+++ b/src/gr-edit-page.c
@@ -159,7 +159,7 @@ populate_image_flowbox (GrEditPage *page)
for (i = 0; i < images->len; i++) {
GrRotatedImage *ri = &g_array_index (images, GrRotatedImage, i);
- g_autoptr(GdkPixbuf) pb = load_pixbuf_fill_size (ri->path, ri->angle, 60, 40);
+ g_autoptr(GdkPixbuf) pb = load_pixbuf_fill_size (ri->path, 0, 60, 40);
GtkWidget *image;
GtkWidget *child;
diff --git a/src/gr-image-page.c b/src/gr-image-page.c
index e6e56a4..1afd60f 100644
--- a/src/gr-image-page.c
+++ b/src/gr-image-page.c
@@ -97,7 +97,7 @@ set_current_image (GrImagePage *page)
gdk_monitor_get_geometry (monitor, &geom);
ri = &g_array_index (page->images, GrRotatedImage, page->index);
- pixbuf = load_pixbuf_fit_size (ri->path, ri->angle, geom.width - 80, geom.height - 80,
FALSE);
+ 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);
}
}
diff --git a/src/gr-image-viewer.c b/src/gr-image-viewer.c
index 4f773e5..a2e2b94 100644
--- a/src/gr-image-viewer.c
+++ b/src/gr-image-viewer.c
@@ -117,7 +117,7 @@ set_current_image (GrImageViewer *viewer)
const char *vis;
ri = &g_array_index (viewer->images, GrRotatedImage, viewer->index);
- pixbuf = load_pixbuf_fill_size (ri->path, ri->angle, 360, 240);
+ pixbuf = load_pixbuf_fill_size (ri->path, 0, 360, 240);
vis = gtk_stack_get_visible_child_name (GTK_STACK (viewer->stack));
if (strcmp (vis, "image1") == 0) {
@@ -146,7 +146,7 @@ populate_preview (GrImageViewer *viewer)
for (i = 0; i < viewer->images->len; i++) {
GrRotatedImage *ri = &g_array_index (viewer->images, GrRotatedImage, i);
- g_autoptr(GdkPixbuf) pb = load_pixbuf_fill_size (ri->path, ri->angle, 60, 40);
+ g_autoptr(GdkPixbuf) pb = load_pixbuf_fill_size (ri->path, 0, 60, 40);
GtkWidget *image;
image = gtk_image_new_from_pixbuf (pb);
@@ -365,7 +365,6 @@ image_received (GtkClipboard *clipboard,
}
ri.path = g_strdup (path);
- ri.angle = 0;
add_image (viewer, &ri, TRUE);
}
@@ -560,7 +559,6 @@ file_chooser_response (GtkNativeDialog *self,
GrRotatedImage ri;
ri.path = import_image (l->data);
- ri.angle = 0;
add_image (viewer, &ri, TRUE);
diff --git a/src/gr-recipe-exporter.c b/src/gr-recipe-exporter.c
index 565ebdf..207e67c 100644
--- a/src/gr-recipe-exporter.c
+++ b/src/gr-recipe-exporter.c
@@ -208,7 +208,6 @@ export_one_recipe (GrRecipeExporter *exporter,
g_autoptr(GrChef) chef = NULL;
g_autoptr(GArray) images = NULL;
g_auto(GStrv) paths = NULL;
- g_autofree int *angles = NULL;
g_autofree gboolean *dark = NULL;
int i, j;
@@ -231,7 +230,6 @@ export_one_recipe (GrRecipeExporter *exporter,
g_object_get (recipe, "images", &images, NULL);
paths = g_new0 (char *, images->len + 1);
- angles = g_new0 (int, 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);
@@ -253,8 +251,6 @@ export_one_recipe (GrRecipeExporter *exporter,
exporter->sources = g_list_append (exporter->sources, g_object_ref (dest));
paths[j] = g_strdup (basename);
- angles[j] = ri->angle;
-
j++;
}
@@ -273,9 +269,6 @@ export_one_recipe (GrRecipeExporter *exporter,
g_key_file_set_integer (keyfile, key, "Diets", diets);
g_key_file_set_string_list (keyfile, key, "Images", (const char * const *)paths, g_strv_length
(paths));
- g_key_file_set_integer_list (keyfile, key, "Angles", angles, g_strv_length (paths));
- g_key_file_set_integer_list (keyfile, key, "DarkText", dark, g_strv_length (paths));
-
if (ctime) {
g_autofree char *created = date_time_to_string (ctime);
diff --git a/src/gr-recipe-importer.c b/src/gr-recipe-importer.c
index a665dc6..3306e83 100644
--- a/src/gr-recipe-importer.c
+++ b/src/gr-recipe-importer.c
@@ -80,7 +80,6 @@ struct _GrRecipeImporter
char *recipe_instructions;
char *recipe_notes;
char **recipe_paths;
- int *recipe_angles;
gboolean *recipe_dark;
int recipe_serves;
GrDiets recipe_diets;
@@ -129,7 +128,6 @@ gr_recipe_importer_finalize (GObject *object)
g_free (importer->recipe_instructions);
g_free (importer->recipe_notes);
g_strfreev (importer->recipe_paths);
- g_free (importer->recipe_angles);
g_free (importer->recipe_dark);
g_clear_pointer (&importer->recipe_ctime, g_date_time_unref);
g_clear_pointer (&importer->recipe_mtime, g_date_time_unref);
@@ -215,7 +213,6 @@ cleanup_import (GrRecipeImporter *importer)
g_clear_pointer (&importer->recipe_instructions, g_free);
g_clear_pointer (&importer->recipe_notes, g_free);
g_clear_pointer (&importer->recipe_paths, g_strfreev);
- g_clear_pointer (&importer->recipe_angles, g_free);
g_clear_pointer (&importer->recipe_dark, g_free);
g_clear_pointer (&importer->recipe_ctime, g_date_time_unref);
g_clear_pointer (&importer->recipe_mtime, g_date_time_unref);
@@ -304,7 +301,6 @@ import_recipe (GrRecipeImporter *importer)
}
ri.path = new_path;
- ri.angle = importer->recipe_angles[i];
g_array_append_val (images, ri);
}
}
@@ -493,8 +489,6 @@ next:
}
importer->recipe_paths = g_key_file_get_string_list (importer->recipes_keyfile, id, "Images",
&length2, &error);
handle_or_clear_error (error);
- importer->recipe_angles = g_key_file_get_integer_list (importer->recipes_keyfile, id, "Angles",
&length3, &error);
- handle_or_clear_error (error);
if (length2 != length3) {
g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED,
_("Failed to load recipe: Images and Angles length mismatch"));
diff --git a/src/gr-recipe-printer.c b/src/gr-recipe-printer.c
index d149f90..feff440 100644
--- a/src/gr-recipe-printer.c
+++ b/src/gr-recipe-printer.c
@@ -184,7 +184,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);
- printer->image = load_pixbuf_fit_size (ri->path, ri->angle, width / 2, height / 4, FALSE);
+ printer->image = load_pixbuf_fit_size (ri->path, 0, width / 2, height / 4, FALSE);
}
title_font = pango_font_description_from_string ("Cantarell Bold 18");
diff --git a/src/gr-recipe-store.c b/src/gr-recipe-store.c
index 07ae836..1ddb2d8 100644
--- a/src/gr-recipe-store.c
+++ b/src/gr-recipe-store.c
@@ -83,7 +83,7 @@ load_recipes (GrRecipeStore *self,
g_autoptr(GError) error = NULL;
g_autofree char *path = NULL;
g_auto(GStrv) groups = NULL;
- gsize length, length2, length3;
+ gsize length, length2;
int i, j;
keyfile = g_key_file_new ();
@@ -116,7 +116,6 @@ load_recipes (GrRecipeStore *self,
g_autofree char *notes = NULL;
g_autofree char *image_path = NULL;
g_auto(GStrv) paths = NULL;
- g_autofree int *angles = NULL;
int serves;
int spiciness;
int default_image = 0;
@@ -220,14 +219,6 @@ load_recipes (GrRecipeStore *self,
}
g_clear_error (&error);
}
- image_path = g_key_file_get_string (keyfile, groups[i], "Image", &error);
- if (error) {
- if (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
- g_warning ("Failed to load recipe %s: %s", groups[i], error->message);
- continue;
- }
- g_clear_error (&error);
- }
paths = g_key_file_get_string_list (keyfile, groups[i], "Images", &length2, &error);
if (error) {
if (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
@@ -236,18 +227,6 @@ load_recipes (GrRecipeStore *self,
}
g_clear_error (&error);
}
- angles = g_key_file_get_integer_list (keyfile, groups[i], "Angles", &length3, &error);
- if (error) {
- if (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
- g_warning ("Failed to load recipe %s: %s", groups[i], error->message);
- continue;
- }
- g_clear_error (&error);
- }
- if (length2 != length3) {
- g_warning ("Failed to load recipe %s: Images and Angles length mismatch", groups[i]);
- continue;
- }
default_image = g_key_file_get_integer (keyfile, groups[i], "DefaultImage", &error);
if (error) {
if (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
@@ -281,11 +260,6 @@ load_recipes (GrRecipeStore *self,
g_clear_error (&error);
}
- if (image_path && image_path[0] != '\0' && image_path[0] != '/') {
- tmp = g_build_filename (dir, image_path, NULL);
- g_free (image_path);
- image_path = tmp;
- }
if (paths) {
for (j = 0; paths[j]; j++) {
if (paths[j][0] != '/') {
@@ -300,15 +274,9 @@ load_recipes (GrRecipeStore *self,
if (paths) {
for (j = 0; paths[j]; j++) {
ri.path = g_strdup (paths[j]);
- ri.angle = angles[j];
g_array_append_val (images, ri);
}
}
- else if (image_path) {
- ri.path = g_strdup (image_path);
- ri.angle = 0;
- g_array_append_val (images, ri);
- }
tmp = g_key_file_get_string (keyfile, groups[i], "Created", &error);
if (error) {
@@ -442,7 +410,6 @@ save_recipes (GrRecipeStore *self)
int spiciness;
GrDiets diets;
g_auto(GStrv) paths = NULL;
- g_autofree int *angles = NULL;
GDateTime *ctime;
GDateTime *mtime;
int default_image = 0;
@@ -472,14 +439,12 @@ save_recipes (GrRecipeStore *self)
tmp = get_user_data_dir ();
paths = g_new0 (char *, images->len + 1);
- angles = g_new0 (int, images->len + 1);
for (i = 0; i < images->len; i++) {
GrRotatedImage *ri = &g_array_index (images, GrRotatedImage, i);
if (g_str_has_prefix (ri->path, tmp))
paths[i] = g_strdup (ri->path + strlen (tmp) + 1);
else
paths[i] = g_strdup (ri->path);
- angles[i] = ri->angle;
}
// For readonly recipes, we just store notes
@@ -504,7 +469,6 @@ save_recipes (GrRecipeStore *self)
g_key_file_set_integer (keyfile, key, "Diets", diets);
g_key_file_set_integer (keyfile, key, "DefaultImage", default_image);
g_key_file_set_string_list (keyfile, key, "Images", (const char * const *)paths,
images->len);
- g_key_file_set_integer_list (keyfile, key, "Angles", angles, images->len);
if (ctime) {
g_autofree char *created = date_time_to_string (ctime);
g_key_file_set_string (keyfile, key, "Created", created);
diff --git a/src/gr-shell-search-provider.c b/src/gr-shell-search-provider.c
index ccd3e50..d3a5e77 100644
--- a/src/gr-shell-search-provider.c
+++ b/src/gr-shell-search-provider.c
@@ -174,7 +174,7 @@ gr_recipe_get_pixbuf (GrRecipe *recipe)
GrRotatedImage *ri = &g_array_index (images, GrRotatedImage, 0);
GdkPixbuf *pixbuf;
- pixbuf = load_pixbuf_fill_size (ri->path, ri->angle, 64, 64);
+ pixbuf = load_pixbuf_fill_size (ri->path, 0, 64, 64);
return pixbuf;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]