Skip to content

Commit

Permalink
add viewnior petbuild with hellosiyan/Viewnior#108 and optional exiv2
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Jan 13, 2023
1 parent 501ba41 commit 1af66b7
Show file tree
Hide file tree
Showing 11 changed files with 1,445 additions and 5 deletions.
119 changes: 119 additions & 0 deletions woof-code/rootfs-petbuilds/viewnior/exiv2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
diff -rupN Viewnior-viewnior-1.8-orig/meson.build Viewnior-viewnior-1.8/meson.build
--- Viewnior-viewnior-1.8-orig/meson.build 2023-01-13 14:55:15.952336174 +0200
+++ Viewnior-viewnior-1.8/meson.build 2023-01-13 15:31:30.711763130 +0200
@@ -28,8 +28,14 @@ viewnior_deps = [
dependency('gio-2.0', version: glib_ver),
dependency('shared-mime-info', version: '>= 0.20'),
dependency('gdk-pixbuf-2.0', version: '>= 0.21'),
- dependency('exiv2', version: '>= 0.21'),
]
+
+exiv2 = dependency('exiv2', version: '>= 0.21', required: false)
+if exiv2.found()
+ viewnior_deps += exiv2
+else
+ viewnior_deps += cc.find_library('m')
+endif
#

# Configuration
@@ -42,6 +48,7 @@ conf.set_quoted('PACKAGE_STRING', 'viewn
conf.set_quoted('GETTEXT_PACKAGE', 'viewnior')
conf.set_quoted('PACKAGE_DATA_DIR', join_paths(get_option('prefix'), get_option('datadir')))
conf.set_quoted('PACKAGE_LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
+conf.set('HAVE_EXIV2', exiv2.found())

configure_file(output: 'config.h', configuration: conf)
#
diff -rupN Viewnior-viewnior-1.8-orig/src/meson.build Viewnior-viewnior-1.8/src/meson.build
--- Viewnior-viewnior-1.8-orig/src/meson.build 2023-01-13 14:55:15.956336191 +0200
+++ Viewnior-viewnior-1.8/src/meson.build 2023-01-13 15:31:30.711763130 +0200
@@ -17,9 +17,12 @@ viewnior_sources = [
'vnr-prefs.c',
'vnr-crop.c',
'vnr-tools.c',
- 'uni-exiv2.cpp',
]

+if exiv2.found()
+ viewnior_sources += 'uni-exiv2.cpp'
+endif
+
marshal = 'uni-marshal'

viewnior_sources += gnome.genmarshal(
diff -rupN Viewnior-viewnior-1.8-orig/src/vnr-properties-dialog.c Viewnior-viewnior-1.8/src/vnr-properties-dialog.c
--- Viewnior-viewnior-1.8-orig/src/vnr-properties-dialog.c 2023-01-13 14:55:15.956336191 +0200
+++ Viewnior-viewnior-1.8/src/vnr-properties-dialog.c 2023-01-13 15:31:30.711763130 +0200
@@ -27,7 +27,9 @@
#include "vnr-properties-dialog.h"
#include "vnr-file.h"
#include "vnr-tools.h"
+#ifdef HAVE_EXIV2
#include "uni-exiv2.hpp"
+#endif

G_DEFINE_TYPE (VnrPropertiesDialog, vnr_properties_dialog, GTK_TYPE_DIALOG);

@@ -317,6 +319,8 @@ vnr_properties_dialog_clear_metadata(Vnr
g_list_free(children);
}

+#ifdef HAVE_EXIV2
+
static void
vnr_cb_add_metadata(const char *label, const char *value, void *user_data) {
VnrPropertiesDialog *dialog = VNR_PROPERTIES_DIALOG(user_data);
@@ -344,15 +348,19 @@ vnr_cb_add_metadata(const char *label, c
gtk_widget_show(temp_label);
}

+#endif
+
static void
vnr_properties_dialog_update_metadata(VnrPropertiesDialog *dialog)
{
vnr_properties_dialog_clear_metadata(dialog);

+#ifdef HAVE_EXIV2
uni_read_exiv2_map(
VNR_FILE(dialog->vnr_win->file_list->data)->path,
vnr_cb_add_metadata,
(void*)dialog);
+#endif
}

void
diff -rupN Viewnior-viewnior-1.8-orig/src/vnr-window.c Viewnior-viewnior-1.8/src/vnr-window.c
--- Viewnior-viewnior-1.8-orig/src/vnr-window.c 2023-01-13 14:55:15.956336191 +0200
+++ Viewnior-viewnior-1.8/src/vnr-window.c 2023-01-13 15:31:30.711763130 +0200
@@ -38,7 +38,9 @@
#include "vnr-message-area.h"
#include "vnr-properties-dialog.h"
#include "vnr-crop.h"
+#ifdef HAVE_EXIV2
#include "uni-exiv2.hpp"
+#endif
#include "uni-utils.h"

/* Timeout to hide the toolbar in fullscreen mode */
@@ -961,7 +963,9 @@ save_image_cb (GtkWidget *widget, VnrWin
vnr_message_area_hide(VNR_MESSAGE_AREA(window->msg_area));

/* Store exiv2 metadata to cache, so we can restore it afterwards */
+#ifdef HAVE_EXIV2
uni_read_exiv2_to_cache(VNR_FILE(window->file_list->data)->path);
+#endif

if(g_strcmp0(window->writable_format_name, "jpeg" ) == 0)
{
@@ -989,7 +993,9 @@ save_image_cb (GtkWidget *widget, VnrWin
VNR_FILE(window->file_list->data)->path,
window->writable_format_name, &error, NULL);
}
+#ifdef HAVE_EXIV2
uni_write_exiv2_from_cache(VNR_FILE(window->file_list->data)->path);
+#endif

if(!window->cursor_is_hidden)
gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(window)), gdk_cursor_new(GDK_LEFT_PTR));
Loading

0 comments on commit 1af66b7

Please sign in to comment.