[Xfce4-commits] <ristretto:master> Show some exif data in the statusbar if it's available.
Stephan Arts
noreply at xfce.org
Sat Oct 22 20:00:01 CEST 2011
Updating branch refs/heads/master
to f51aefbff481303cece1c45ebdd0566d30ac7e48 (commit)
from 6e54209d9fb5d0bb3e959022e04eb230264f14b3 (commit)
commit f51aefbff481303cece1c45ebdd0566d30ac7e48
Author: Stephan Arts <stephan at xfce.org>
Date: Sat Oct 22 19:57:10 2011 +0200
Show some exif data in the statusbar if it's available.
src/file.c | 14 ++++++++++++++
src/file.h | 3 +++
src/main_window.c | 42 ++++++++++++++++++++++++++++++++++++++++--
3 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/src/file.c b/src/file.c
index 24f5f59..e2b3aee 100644
--- a/src/file.c
+++ b/src/file.c
@@ -391,3 +391,17 @@ rstto_file_set_orientation (
{
file->priv->orientation = orientation;
}
+
+gboolean
+rstto_file_has_exif ( RsttoFile *file )
+{
+ if ( NULL == file->priv->exif_data )
+ {
+ file->priv->exif_data = exif_data_new_from_file ( rstto_file_get_path (file) );
+ }
+ if ( NULL == file->priv->exif_data )
+ {
+ return FALSE;
+ }
+ return TRUE;
+}
diff --git a/src/file.h b/src/file.h
index e632b9a..467813a 100644
--- a/src/file.h
+++ b/src/file.h
@@ -97,6 +97,9 @@ rstto_file_set_orientation (
RsttoFile * ,
RsttoImageOrientation );
+gboolean
+rstto_file_has_exif ( RsttoFile * );
+
G_END_DECLS
diff --git a/src/main_window.c b/src/main_window.c
index 23318ab..9d9b0b1 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -588,7 +588,7 @@ rstto_main_window_init (RsttoMainWindow *window)
window->priv->statusbar = gtk_statusbar_new();
window->priv->statusbar_context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR(window->priv->statusbar), "image-data");
gtk_statusbar_push (GTK_STATUSBAR(window->priv->statusbar),
- window->priv->statusbar_context_id,
+ gtk_statusbar_get_context_id (GTK_STATUSBAR(window->priv->statusbar), "fallback-data"),
_("Press open to select an image"));
@@ -881,11 +881,14 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window)
const gchar *file_basename = NULL;
gchar *title = NULL;
gchar *status = NULL;
+ gchar *tmp_status = NULL;
RsttoFile *cur_file = NULL;
gint position, count;
RsttoImageList *image_list = window->priv->props.image_list;
GList *app_list, *iter;
const gchar *content_type;
+ ExifEntry *exif_entry = NULL;
+ gchar exif_data[20];
GtkWidget *open_with_menu = gtk_menu_new();
GtkWidget *open_with_window_menu = gtk_menu_new();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (gtk_ui_manager_get_widget ( window->priv->ui_manager, "/image-viewer-menu/open-with-menu")), open_with_menu);
@@ -935,6 +938,42 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window)
{
title = g_strdup_printf ("%s - %s", RISTRETTO_APP_TITLE, file_basename);
}
+
+ status = g_strdup(file_basename);
+
+ if (TRUE == rstto_file_has_exif (cur_file))
+ {
+ /* Extend the status-message with exif-info */
+ /********************************************/
+ exif_entry = rstto_file_get_exif (
+ cur_file,
+ EXIF_TAG_FNUMBER);
+ if (exif_entry)
+ {
+ exif_entry_get_value (exif_entry, exif_data, 20);
+
+ tmp_status = g_strdup_printf ("%s\t%s", status, exif_data);
+
+ g_free (status);
+ status = tmp_status;
+
+ exif_entry_free (exif_entry);
+ }
+ exif_entry = rstto_file_get_exif (
+ cur_file,
+ EXIF_TAG_EXPOSURE_TIME);
+ if (exif_entry)
+ {
+ exif_entry_get_value (exif_entry, exif_data, 20);
+
+ tmp_status = g_strdup_printf ("%s\t%s", status, exif_data);
+
+ g_free (status);
+ status = tmp_status;
+
+ exif_entry_free (exif_entry);
+ }
+ }
}
else
{
@@ -944,7 +983,6 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window)
rstto_image_viewer_set_file (RSTTO_IMAGE_VIEWER(window->priv->image_viewer), NULL, -1, 0);
-
menu_item = gtk_image_menu_item_new_with_label (_("Empty"));
gtk_menu_shell_append (GTK_MENU_SHELL (open_with_window_menu), menu_item);
gtk_widget_set_sensitive (menu_item, FALSE);
More information about the Xfce4-commits
mailing list