Re: wrote EOG plugin: exif display
- From: Emmanuel Touzery <emmanuel touzery free fr>
- To: Felix Riemann <friemann svn gnome org>
- Cc: eog-list gnome org
- Subject: Re: wrote EOG plugin: exif display
- Date: Thu, 11 Jun 2009 21:54:21 +0200
Hi,
I haven't found anything critical (besides the eog_image_load() call
that should in theory only be used from the job queue, but we do the
same in the statusbar-date plugin and it should be okay to leave it that
way until we find a proper solution for this). There is one oddity
though.
Switching from an image that has Exif data to an image that doesn't have
it updates the histogram but leaves the Exif tags intact (showing "old"
data). They should probably be cleared in that case. You can probably
copy the eog_exif_set_label function from EogPropertiesDialog for this.
Great!
I fixed that and also added the date when the picture was taken, and
tooltips on some fields which could get ellipsized since the sidebar is
not so wide: date, flash info, metering mode ("Center-Weighted Average"
for instance doesn't fit).
Now there's one warning but it's in that EOG method that I copied so I
didn't look at it ;-)
In attachment the diff of the .c file since the last submittion.
The newer zip file is now at:
http://www2.arnes.si/~shvali/exif-display-1.zip
emmanuel
--- /home/emmanuel/Desktop/exif-display/eog-exif-display-plugin.c 2009-05-24 20:13:23.000000000 +0200
+++ eog-exif-display-plugin.c 2009-06-11 21:44:46.000000000 +0200
@@ -99,15 +99,38 @@
{
}
+/* stolen from eog-properties-dialog.c*/
+static void
+eog_exif_set_label (GtkWidget *w, ExifData *exif_data, gint tag_id)
+{
+ gchar exif_buffer[512];
+ const gchar *buf_ptr;
+ gchar *label_text = NULL;
+
+ if (exif_data) {
+ buf_ptr = eog_exif_util_get_value (exif_data, tag_id,
+ exif_buffer, 512);
+
+ if (tag_id == EXIF_TAG_DATE_TIME_ORIGINAL && buf_ptr)
+ label_text = eog_exif_util_format_date (buf_ptr);
+ else
+ label_text = eog_util_make_valid_utf8 (buf_ptr);
+ }
+
+ gtk_label_set_text (GTK_LABEL (w), label_text);
+ g_free (label_text);
+}
+
static void set_exif_label (ExifData *exif_data, int exif_tag,
- GtkBuilder *gtk_builder, const gchar *gtk_builder_label_name)
+ GtkBuilder *gtk_builder, const gchar *gtk_builder_label_name, gboolean tooltip)
{
- gchar exif_value[512];
- exif_value[0] = 0;
- ExifEntry *exif_entry = exif_data_get_entry (exif_data, exif_tag);
- exif_entry_get_value (exif_entry, exif_value, sizeof(exif_value));
- gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (
- gtk_builder, gtk_builder_label_name)), exif_value);
+ GtkWidget *widget = GTK_WIDGET (gtk_builder_get_object (
+ gtk_builder, gtk_builder_label_name));
+ eog_exif_set_label (widget, exif_data, exif_tag);
+
+ if (tooltip) {
+ gtk_widget_set_tooltip_text (widget, gtk_label_get_label (GTK_LABEL (widget)));
+ }
}
/* stolen from eog-properties-dialog and slightly modified
@@ -199,36 +222,37 @@
exif_data = (ExifData *)eog_image_get_exif_info (image);
- if (exif_data) {
- byte_order = exif_data_get_byte_order (exif_data);
+ byte_order = exif_data_get_byte_order (exif_data);
- eog_exif_set_focal_length_label (GTK_WIDGET (gtk_builder_get_object (
- data->sidebar_builder, "focal_length_label")), exif_data);
+ set_exif_label (exif_data, EXIF_TAG_DATE_TIME_ORIGINAL, data->sidebar_builder, "takenon_label", TRUE);
- set_exif_label (exif_data, EXIF_TAG_EXPOSURE_BIAS_VALUE, data->sidebar_builder, "exposure_bias_label");
+ eog_exif_set_focal_length_label (GTK_WIDGET (gtk_builder_get_object (
+ data->sidebar_builder, "focal_length_label")), exif_data);
- set_exif_label (exif_data, EXIF_TAG_EXPOSURE_TIME,
- data->sidebar_builder, "exposure_time_label");
+ set_exif_label (exif_data, EXIF_TAG_EXPOSURE_BIAS_VALUE, data->sidebar_builder, "exposure_bias_label", FALSE);
- set_exif_label (exif_data, EXIF_TAG_MODEL,
- data->sidebar_builder, "camera_model_label");
+ set_exif_label (exif_data, EXIF_TAG_EXPOSURE_TIME,
+ data->sidebar_builder, "exposure_time_label", FALSE);
- set_exif_label (exif_data, EXIF_TAG_FNUMBER,
- data->sidebar_builder, "aperture_label");
+ set_exif_label (exif_data, EXIF_TAG_MODEL,
+ data->sidebar_builder, "camera_model_label", FALSE);
- set_exif_label (exif_data, EXIF_TAG_ISO_SPEED_RATINGS,
- data->sidebar_builder, "iso_label");
+ set_exif_label (exif_data, EXIF_TAG_FNUMBER,
+ data->sidebar_builder, "aperture_label", FALSE);
- set_exif_label (exif_data, EXIF_TAG_FLASH,
- data->sidebar_builder, "flash_label");
+ set_exif_label (exif_data, EXIF_TAG_ISO_SPEED_RATINGS,
+ data->sidebar_builder, "iso_label", FALSE);
- set_exif_label (exif_data, EXIF_TAG_METERING_MODE,
- data->sidebar_builder, "metering_mode_label");
+ set_exif_label (exif_data, EXIF_TAG_FLASH,
+ data->sidebar_builder, "flash_label", TRUE);
- set_exif_label (exif_data, EXIF_TAG_EXPOSURE_BIAS_VALUE, data->sidebar_builder, "exposure_bias_label");
+ set_exif_label (exif_data, EXIF_TAG_METERING_MODE,
+ data->sidebar_builder, "metering_mode_label", TRUE);
+
+ set_exif_label (exif_data, EXIF_TAG_EXPOSURE_BIAS_VALUE, data->sidebar_builder, "exposure_bias_label", FALSE);
+
+ exif_data_unref (exif_data);
- exif_data_unref (exif_data);
- }
g_object_unref (image);
}
@@ -596,7 +620,7 @@
data->statusbar_exif = gtk_statusbar_new ();
gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (data->statusbar_exif),
FALSE);
- gtk_widget_set_size_request (data->statusbar_exif, 250, 10);
+ gtk_widget_set_size_request (data->statusbar_exif, 280, 10);
gtk_box_pack_end (GTK_BOX (statusbar),
data->statusbar_exif,
FALSE, FALSE, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]