Skip to content

Commit d328203

Browse files
fxriraveit65
authored andcommitted
Fix build when not building with libexif and/or exempi
There were quite some #ifdefs missing. https://bugzilla.gnome.org/show_bug.cgi?id=666556 Origin commit: https://gitlab.gnome.org/GNOME/eog/commit/deb2b63
1 parent 09fea91 commit d328203

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed

‎src/eom-metadata-sidebar.c‎

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,21 @@
4040
#include "eom-util.h"
4141
#include "eom-window.h"
4242

43+
#ifdef HAVE_EXIF
44+
#include <libexif/exif-data.h>
45+
#include <libexif/exif-tag.h>
46+
#include "eom-exif-util.h"
47+
#endif
48+
4349
#if HAVE_EXEMPI
4450
#include <exempi/xmp.h>
4551
#include <exempi/xmpconsts.h>
4652
#endif
4753

54+
#if HAVE_EXIF || HAVE_EXEMPI
55+
#define HAVE_METADATA 1
56+
#endif
57+
4858
enum {
4959
PROP_0,
5060
PROP_IMAGE,
@@ -67,6 +77,7 @@ struct _EomMetadataSidebarPrivate {
6777
GtkWidget *size_label;
6878
GtkWidget *folder_button;
6979

80+
#if HAVE_EXIF
7081
GtkWidget *aperture_label;
7182
GtkWidget *exposure_label;
7283
GtkWidget *focallen_label;
@@ -75,14 +86,19 @@ struct _EomMetadataSidebarPrivate {
7586
GtkWidget *metering_label;
7687
GtkWidget *model_label;
7788
GtkWidget *date_label;
89+
#endif
7890

91+
#if HAVE_EXEMPI
7992
GtkWidget *location_label;
8093
GtkWidget *desc_label;
8194
GtkWidget *keyword_label;
8295
GtkWidget *creator_label;
8396
GtkWidget *rights_label;
84-
97+
#endif
98+
99+
#if HAVE_METADATA
85100
GtkWidget *details_button;
101+
#endif
86102
};
87103

88104
#define EOM_METADATA_SIDEBAR_GET_PRIVATE(object) \
@@ -247,21 +263,29 @@ eom_metadata_sidebar_update_general_section (EomMetadataSidebar *sidebar)
247263
g_object_unref (parent_file);
248264
}
249265

266+
#if HAVE_METADATA
250267
static void
251268
eom_metadata_sidebar_update_metadata_section (EomMetadataSidebar *sidebar)
252269
{
253270
EomMetadataSidebarPrivate *priv = sidebar->priv;
254271
EomImage *img = priv->image;
272+
#if HAVE_EXIF
255273
ExifData *exif_data = NULL;
274+
#endif
275+
#if HAVE_EXEMPI
256276
XmpPtr xmp_data = NULL;
257-
277+
#endif
258278

259279
if (img) {
280+
#if HAVE_EXIF
260281
exif_data = eom_image_get_exif_info (img);
282+
#endif
283+
#if HAVE_EXEMPI
261284
xmp_data = eom_image_get_xmp_info (img);
285+
#endif
262286
}
263287

264-
288+
#if HAVE_EXIF
265289
eom_exif_util_set_label_text (GTK_LABEL (priv->aperture_label),
266290
exif_data, EXIF_TAG_FNUMBER);
267291
eom_exif_util_set_label_text (GTK_LABEL (priv->exposure_label),
@@ -286,6 +310,7 @@ eom_metadata_sidebar_update_metadata_section (EomMetadataSidebar *sidebar)
286310

287311
/* exif_data_unref can handle NULL-values */
288312
exif_data_unref(exif_data);
313+
#endif /* HAVE_EXIF */
289314

290315
#if HAVE_EXEMPI
291316
eom_xmp_set_label (xmp_data,
@@ -316,17 +341,19 @@ eom_metadata_sidebar_update_metadata_section (EomMetadataSidebar *sidebar)
316341

317342
if (xmp_data != NULL)
318343
xmp_free (xmp_data);
319-
#endif
320-
344+
#endif /* HAVE_EXEMPI */
321345
}
346+
#endif /* HAVE_METADATA */
322347

323348
static void
324349
eom_metadata_sidebar_update (EomMetadataSidebar *sidebar)
325350
{
326351
g_return_if_fail (EOM_IS_METADATA_SIDEBAR (sidebar));
327352

328353
eom_metadata_sidebar_update_general_section (sidebar);
354+
#if HAVE_METADATA
329355
eom_metadata_sidebar_update_metadata_section (sidebar);
356+
#endif
330357
}
331358

332359
static void
@@ -403,6 +430,7 @@ _folder_button_clicked_cb (GtkButton *button, gpointer user_data)
403430
g_object_unref (file);
404431
}
405432

433+
#ifdef HAVE_METADATA
406434
static void
407435
_details_button_clicked_cb (GtkButton *button, gpointer user_data)
408436
{
@@ -418,7 +446,7 @@ _details_button_clicked_cb (GtkButton *button, gpointer user_data)
418446
EOM_PROPERTIES_DIALOG_PAGE_DETAILS);
419447
eom_dialog_show (dlg);
420448
}
421-
449+
#endif
422450

423451
static void
424452
eom_metadata_sidebar_set_parent_window (EomMetadataSidebar *sidebar,
@@ -475,9 +503,11 @@ eom_metadata_sidebar_init (EomMetadataSidebar *sidebar)
475503
G_CALLBACK (_folder_button_clicked_cb), sidebar);
476504
gtk_grid_attach_next_to (GTK_GRID (priv->grid), priv->folder_button,
477505
label, GTK_POS_RIGHT, 1, 1);
478-
506+
507+
#if HAVE_METADATA
479508
label = _gtk_grid_append_title_line (GTK_GRID (priv->grid),
480509
label, _("Metadata"));
510+
#if HAVE_EXIF
481511
label = _gtk_grid_append_prop_line (GTK_GRID (priv->grid), label,
482512
&priv->aperture_label,
483513
_("Aperture Value:"));
@@ -501,6 +531,8 @@ eom_metadata_sidebar_init (EomMetadataSidebar *sidebar)
501531
_("Camera Model:"));
502532
label = _gtk_grid_append_prop_line (GTK_GRID (priv->grid), label,
503533
&priv->date_label, _("Date/Time:"));
534+
#endif /* HAVE_EXIF */
535+
#if HAVE_EXEMPI
504536
label = _gtk_grid_append_prop_line (GTK_GRID (priv->grid), label,
505537
&priv->desc_label,
506538
_("Description:"));
@@ -515,13 +547,14 @@ eom_metadata_sidebar_init (EomMetadataSidebar *sidebar)
515547
label = _gtk_grid_append_prop_line (GTK_GRID (priv->grid), label,
516548
&priv->rights_label,
517549
_("Copyright:"));
550+
#endif /* HAVE_EXEMPI */
518551

519552
priv->details_button = gtk_button_new_with_label (_("Details"));
520553
g_signal_connect (priv->details_button, "clicked",
521554
G_CALLBACK (_details_button_clicked_cb), sidebar);
522555
gtk_grid_attach_next_to (GTK_GRID (priv->grid), priv->details_button,
523556
label, GTK_POS_BOTTOM, 1, 1);
524-
557+
#endif /* HAVE_METADATA */
525558

526559
gtk_widget_show_all (priv->grid);
527560
}

0 commit comments

Comments
 (0)