Skip to content

Commit

Permalink
Fix build when not building with libexif and/or exempi
Browse files Browse the repository at this point in the history
  • Loading branch information
fxri authored and raveit65 committed Jul 8, 2018
1 parent 09fea91 commit d328203
Showing 1 changed file with 41 additions and 8 deletions.
49 changes: 41 additions & 8 deletions src/eom-metadata-sidebar.c
Expand Up @@ -40,11 +40,21 @@
#include "eom-util.h" #include "eom-util.h"
#include "eom-window.h" #include "eom-window.h"


#ifdef HAVE_EXIF
#include <libexif/exif-data.h>
#include <libexif/exif-tag.h>
#include "eom-exif-util.h"
#endif

#if HAVE_EXEMPI #if HAVE_EXEMPI
#include <exempi/xmp.h> #include <exempi/xmp.h>
#include <exempi/xmpconsts.h> #include <exempi/xmpconsts.h>
#endif #endif


#if HAVE_EXIF || HAVE_EXEMPI
#define HAVE_METADATA 1
#endif

enum { enum {
PROP_0, PROP_0,
PROP_IMAGE, PROP_IMAGE,
Expand All @@ -67,6 +77,7 @@ struct _EomMetadataSidebarPrivate {
GtkWidget *size_label; GtkWidget *size_label;
GtkWidget *folder_button; GtkWidget *folder_button;


#if HAVE_EXIF
GtkWidget *aperture_label; GtkWidget *aperture_label;
GtkWidget *exposure_label; GtkWidget *exposure_label;
GtkWidget *focallen_label; GtkWidget *focallen_label;
Expand All @@ -75,14 +86,19 @@ struct _EomMetadataSidebarPrivate {
GtkWidget *metering_label; GtkWidget *metering_label;
GtkWidget *model_label; GtkWidget *model_label;
GtkWidget *date_label; GtkWidget *date_label;
#endif


#if HAVE_EXEMPI
GtkWidget *location_label; GtkWidget *location_label;
GtkWidget *desc_label; GtkWidget *desc_label;
GtkWidget *keyword_label; GtkWidget *keyword_label;
GtkWidget *creator_label; GtkWidget *creator_label;
GtkWidget *rights_label; GtkWidget *rights_label;

#endif

#if HAVE_METADATA
GtkWidget *details_button; GtkWidget *details_button;
#endif
}; };


#define EOM_METADATA_SIDEBAR_GET_PRIVATE(object) \ #define EOM_METADATA_SIDEBAR_GET_PRIVATE(object) \
Expand Down Expand Up @@ -247,21 +263,29 @@ eom_metadata_sidebar_update_general_section (EomMetadataSidebar *sidebar)
g_object_unref (parent_file); g_object_unref (parent_file);
} }


#if HAVE_METADATA
static void static void
eom_metadata_sidebar_update_metadata_section (EomMetadataSidebar *sidebar) eom_metadata_sidebar_update_metadata_section (EomMetadataSidebar *sidebar)
{ {
EomMetadataSidebarPrivate *priv = sidebar->priv; EomMetadataSidebarPrivate *priv = sidebar->priv;
EomImage *img = priv->image; EomImage *img = priv->image;
#if HAVE_EXIF
ExifData *exif_data = NULL; ExifData *exif_data = NULL;
#endif
#if HAVE_EXEMPI
XmpPtr xmp_data = NULL; XmpPtr xmp_data = NULL;

#endif


if (img) { if (img) {
#if HAVE_EXIF
exif_data = eom_image_get_exif_info (img); exif_data = eom_image_get_exif_info (img);
#endif
#if HAVE_EXEMPI
xmp_data = eom_image_get_xmp_info (img); xmp_data = eom_image_get_xmp_info (img);
#endif
} }



#if HAVE_EXIF
eom_exif_util_set_label_text (GTK_LABEL (priv->aperture_label), eom_exif_util_set_label_text (GTK_LABEL (priv->aperture_label),
exif_data, EXIF_TAG_FNUMBER); exif_data, EXIF_TAG_FNUMBER);
eom_exif_util_set_label_text (GTK_LABEL (priv->exposure_label), eom_exif_util_set_label_text (GTK_LABEL (priv->exposure_label),
Expand All @@ -286,6 +310,7 @@ eom_metadata_sidebar_update_metadata_section (EomMetadataSidebar *sidebar)


/* exif_data_unref can handle NULL-values */ /* exif_data_unref can handle NULL-values */
exif_data_unref(exif_data); exif_data_unref(exif_data);
#endif /* HAVE_EXIF */


#if HAVE_EXEMPI #if HAVE_EXEMPI
eom_xmp_set_label (xmp_data, eom_xmp_set_label (xmp_data,
Expand Down Expand Up @@ -316,17 +341,19 @@ eom_metadata_sidebar_update_metadata_section (EomMetadataSidebar *sidebar)


if (xmp_data != NULL) if (xmp_data != NULL)
xmp_free (xmp_data); xmp_free (xmp_data);
#endif #endif /* HAVE_EXEMPI */

} }
#endif /* HAVE_METADATA */


static void static void
eom_metadata_sidebar_update (EomMetadataSidebar *sidebar) eom_metadata_sidebar_update (EomMetadataSidebar *sidebar)
{ {
g_return_if_fail (EOM_IS_METADATA_SIDEBAR (sidebar)); g_return_if_fail (EOM_IS_METADATA_SIDEBAR (sidebar));


eom_metadata_sidebar_update_general_section (sidebar); eom_metadata_sidebar_update_general_section (sidebar);
#if HAVE_METADATA
eom_metadata_sidebar_update_metadata_section (sidebar); eom_metadata_sidebar_update_metadata_section (sidebar);
#endif
} }


static void static void
Expand Down Expand Up @@ -403,6 +430,7 @@ _folder_button_clicked_cb (GtkButton *button, gpointer user_data)
g_object_unref (file); g_object_unref (file);
} }


#ifdef HAVE_METADATA
static void static void
_details_button_clicked_cb (GtkButton *button, gpointer user_data) _details_button_clicked_cb (GtkButton *button, gpointer user_data)
{ {
Expand All @@ -418,7 +446,7 @@ _details_button_clicked_cb (GtkButton *button, gpointer user_data)
EOM_PROPERTIES_DIALOG_PAGE_DETAILS); EOM_PROPERTIES_DIALOG_PAGE_DETAILS);
eom_dialog_show (dlg); eom_dialog_show (dlg);
} }

#endif


static void static void
eom_metadata_sidebar_set_parent_window (EomMetadataSidebar *sidebar, eom_metadata_sidebar_set_parent_window (EomMetadataSidebar *sidebar,
Expand Down Expand Up @@ -475,9 +503,11 @@ eom_metadata_sidebar_init (EomMetadataSidebar *sidebar)
G_CALLBACK (_folder_button_clicked_cb), sidebar); G_CALLBACK (_folder_button_clicked_cb), sidebar);
gtk_grid_attach_next_to (GTK_GRID (priv->grid), priv->folder_button, gtk_grid_attach_next_to (GTK_GRID (priv->grid), priv->folder_button,
label, GTK_POS_RIGHT, 1, 1); label, GTK_POS_RIGHT, 1, 1);


#if HAVE_METADATA
label = _gtk_grid_append_title_line (GTK_GRID (priv->grid), label = _gtk_grid_append_title_line (GTK_GRID (priv->grid),
label, _("Metadata")); label, _("Metadata"));
#if HAVE_EXIF
label = _gtk_grid_append_prop_line (GTK_GRID (priv->grid), label, label = _gtk_grid_append_prop_line (GTK_GRID (priv->grid), label,
&priv->aperture_label, &priv->aperture_label,
_("Aperture Value:")); _("Aperture Value:"));
Expand All @@ -501,6 +531,8 @@ eom_metadata_sidebar_init (EomMetadataSidebar *sidebar)
_("Camera Model:")); _("Camera Model:"));
label = _gtk_grid_append_prop_line (GTK_GRID (priv->grid), label, label = _gtk_grid_append_prop_line (GTK_GRID (priv->grid), label,
&priv->date_label, _("Date/Time:")); &priv->date_label, _("Date/Time:"));
#endif /* HAVE_EXIF */
#if HAVE_EXEMPI
label = _gtk_grid_append_prop_line (GTK_GRID (priv->grid), label, label = _gtk_grid_append_prop_line (GTK_GRID (priv->grid), label,
&priv->desc_label, &priv->desc_label,
_("Description:")); _("Description:"));
Expand All @@ -515,13 +547,14 @@ eom_metadata_sidebar_init (EomMetadataSidebar *sidebar)
label = _gtk_grid_append_prop_line (GTK_GRID (priv->grid), label, label = _gtk_grid_append_prop_line (GTK_GRID (priv->grid), label,
&priv->rights_label, &priv->rights_label,
_("Copyright:")); _("Copyright:"));
#endif /* HAVE_EXEMPI */


priv->details_button = gtk_button_new_with_label (_("Details")); priv->details_button = gtk_button_new_with_label (_("Details"));
g_signal_connect (priv->details_button, "clicked", g_signal_connect (priv->details_button, "clicked",
G_CALLBACK (_details_button_clicked_cb), sidebar); G_CALLBACK (_details_button_clicked_cb), sidebar);
gtk_grid_attach_next_to (GTK_GRID (priv->grid), priv->details_button, gtk_grid_attach_next_to (GTK_GRID (priv->grid), priv->details_button,
label, GTK_POS_BOTTOM, 1, 1); label, GTK_POS_BOTTOM, 1, 1);

#endif /* HAVE_METADATA */


gtk_widget_show_all (priv->grid); gtk_widget_show_all (priv->grid);
} }
Expand Down

0 comments on commit d328203

Please sign in to comment.