[gnome-photos] properties-dialog: Show exposure, aperture, focal length and ISO speed
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] properties-dialog: Show exposure, aperture, focal length and ISO speed
- Date: Mon, 12 Aug 2013 15:10:15 +0000 (UTC)
commit b4f146d465a5888ff32c2b501d76515836d3fd84
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Aug 12 16:52:54 2013 +0200
properties-dialog: Show exposure, aperture, focal length and ISO speed
src/photos-base-item.c | 37 +++++++++++++++
src/photos-base-item.h | 8 +++
src/photos-properties-dialog.c | 96 ++++++++++++++++++++++++++++++++++++++++
src/photos-query-builder.c | 6 ++-
src/photos-query.h | 6 ++-
5 files changed, 151 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 84c0507..6188cde 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -71,6 +71,10 @@ struct _PhotosBaseItemPrivate
gchar *resource_urn;
gchar *type_description;
gchar *uri;
+ gdouble exposure_time;
+ gdouble fnumber;
+ gdouble focal_length;
+ gdouble iso_speed;
gint64 date_created;
gint64 mtime;
};
@@ -716,6 +720,11 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
equipment = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_EQUIPMENT, NULL);
priv->equipment = g_quark_from_string (equipment);
+ priv->exposure_time = tracker_sparql_cursor_get_double (cursor, PHOTOS_QUERY_COLUMNS_EXPOSURE_TIME);
+ priv->fnumber = tracker_sparql_cursor_get_double (cursor, PHOTOS_QUERY_COLUMNS_FNUMBER);
+ priv->focal_length = tracker_sparql_cursor_get_double (cursor, PHOTOS_QUERY_COLUMNS_FOCAL_LENGTH);
+ priv->iso_speed = tracker_sparql_cursor_get_double (cursor, PHOTOS_QUERY_COLUMNS_ISO_SPEED);
+
photos_base_item_refresh_icon (self);
}
@@ -1020,6 +1029,27 @@ photos_base_item_get_equipment (PhotosBaseItem *self)
}
+gdouble
+photos_base_item_get_exposure_time (PhotosBaseItem *self)
+{
+ return self->priv->exposure_time;
+}
+
+
+gdouble
+photos_base_item_get_fnumber (PhotosBaseItem *self)
+{
+ return self->priv->fnumber;
+}
+
+
+gdouble
+photos_base_item_get_focal_length (PhotosBaseItem *self)
+{
+ return self->priv->focal_length;
+}
+
+
GdkPixbuf *
photos_base_item_get_icon (PhotosBaseItem *self)
{
@@ -1041,6 +1071,13 @@ photos_base_item_get_identifier (PhotosBaseItem *self)
}
+gdouble
+photos_base_item_get_iso_speed (PhotosBaseItem *self)
+{
+ return self->priv->iso_speed;
+}
+
+
const gchar *
photos_base_item_get_mime_type (PhotosBaseItem *self)
{
diff --git a/src/photos-base-item.h b/src/photos-base-item.h
index b3abc4d..5363e26 100644
--- a/src/photos-base-item.h
+++ b/src/photos-base-item.h
@@ -106,12 +106,20 @@ const gchar *photos_base_item_get_default_app_name (PhotosBaseItem *self)
GQuark photos_base_item_get_equipment (PhotosBaseItem *self);
+gdouble photos_base_item_get_exposure_time (PhotosBaseItem *self);
+
+gdouble photos_base_item_get_fnumber (PhotosBaseItem *self);
+
+gdouble photos_base_item_get_focal_length (PhotosBaseItem *self);
+
GdkPixbuf *photos_base_item_get_icon (PhotosBaseItem *self);
const gchar *photos_base_item_get_id (PhotosBaseItem *self);
const gchar *photos_base_item_get_identifier (PhotosBaseItem *self);
+gdouble photos_base_item_get_iso_speed (PhotosBaseItem *self);
+
const gchar *photos_base_item_get_mime_type (PhotosBaseItem *self);
gint64 photos_base_item_get_mtime (PhotosBaseItem *self);
diff --git a/src/photos-properties-dialog.c b/src/photos-properties-dialog.c
index 00eee63..66abfa8 100644
--- a/src/photos-properties-dialog.c
+++ b/src/photos-properties-dialog.c
@@ -148,7 +148,11 @@ photos_properties_dialog_constructed (GObject *object)
GtkWidget *date_created_w = NULL;
GtkWidget *date_modified_data;
GtkWidget *date_modified_w;
+ GtkWidget *exposure_time_w = NULL;
+ GtkWidget *fnumber_w = NULL;
+ GtkWidget *focal_length_w = NULL;
GtkWidget *grid;
+ GtkWidget *iso_speed_w = NULL;
GtkWidget *item_type;
GtkWidget *item_type_data;
GtkWidget *source;
@@ -161,6 +165,10 @@ photos_properties_dialog_constructed (GObject *object)
const gchar *type_description;
gchar *date_created_str = NULL;
gchar *date_modified_str;
+ gdouble exposure_time;
+ gdouble fnumber;
+ gdouble focal_length;
+ gdouble iso_speed;
gint64 ctime;
gint64 mtime;
@@ -265,6 +273,46 @@ photos_properties_dialog_constructed (GObject *object)
gtk_container_add (GTK_CONTAINER (grid), priv->camera_w);
}
+ exposure_time = photos_base_item_get_exposure_time (item);
+ if (exposure_time > 0.0)
+ {
+ exposure_time_w = gtk_label_new (_("Exposure"));
+ gtk_widget_set_halign (exposure_time_w, GTK_ALIGN_END);
+ context = gtk_widget_get_style_context (exposure_time_w);
+ gtk_style_context_add_class (context, "dim-label");
+ gtk_container_add (GTK_CONTAINER (grid), exposure_time_w);
+ }
+
+ fnumber = photos_base_item_get_fnumber (item);
+ if (fnumber > 0.0)
+ {
+ fnumber_w = gtk_label_new (_("Aperture"));
+ gtk_widget_set_halign (fnumber_w, GTK_ALIGN_END);
+ context = gtk_widget_get_style_context (fnumber_w);
+ gtk_style_context_add_class (context, "dim-label");
+ gtk_container_add (GTK_CONTAINER (grid), fnumber_w);
+ }
+
+ focal_length = photos_base_item_get_focal_length (item);
+ if (focal_length > 0.0)
+ {
+ focal_length_w = gtk_label_new (_("Focal Length"));
+ gtk_widget_set_halign (focal_length_w, GTK_ALIGN_END);
+ context = gtk_widget_get_style_context (focal_length_w);
+ gtk_style_context_add_class (context, "dim-label");
+ gtk_container_add (GTK_CONTAINER (grid), focal_length_w);
+ }
+
+ iso_speed = photos_base_item_get_iso_speed (item);
+ if (iso_speed > 0.0)
+ {
+ iso_speed_w = gtk_label_new (_("ISO Speed"));
+ gtk_widget_set_halign (iso_speed_w, GTK_ALIGN_END);
+ context = gtk_widget_get_style_context (iso_speed_w);
+ gtk_style_context_add_class (context, "dim-label");
+ gtk_container_add (GTK_CONTAINER (grid), iso_speed_w);
+ }
+
name = photos_base_item_get_name (item);
if (PHOTOS_IS_LOCAL_ITEM (item))
@@ -358,6 +406,54 @@ photos_properties_dialog_constructed (GObject *object)
item_type_data = gtk_label_new (type_description);
gtk_widget_set_halign (item_type_data, GTK_ALIGN_START);
gtk_grid_attach_next_to (GTK_GRID (grid), item_type_data, item_type, GTK_POS_RIGHT, 2, 1);
+
+ if (exposure_time_w != NULL)
+ {
+ GtkWidget *exposure_time_data;
+ gchar *exposure_time_str;
+
+ exposure_time_str = g_strdup_printf ("%.3lf sec", exposure_time);
+ exposure_time_data = gtk_label_new (exposure_time_str);
+ gtk_widget_set_halign (exposure_time_data, GTK_ALIGN_START);
+ gtk_grid_attach_next_to (GTK_GRID (grid), exposure_time_data, exposure_time_w, GTK_POS_RIGHT, 2, 1);
+ g_free (exposure_time_str);
+ }
+
+ if (fnumber_w != NULL)
+ {
+ GtkWidget *fnumber_data;
+ gchar *fnumber_str;
+
+ fnumber_str = g_strdup_printf ("f/%.1lf", fnumber);
+ fnumber_data = gtk_label_new (fnumber_str);
+ gtk_widget_set_halign (fnumber_data, GTK_ALIGN_START);
+ gtk_grid_attach_next_to (GTK_GRID (grid), fnumber_data, fnumber_w, GTK_POS_RIGHT, 2, 1);
+ g_free (fnumber_str);
+ }
+
+ if (focal_length_w != NULL)
+ {
+ GtkWidget *focal_length_data;
+ gchar *focal_length_str;
+
+ focal_length_str = g_strdup_printf ("%.0lf mm", focal_length);
+ focal_length_data = gtk_label_new (focal_length_str);
+ gtk_widget_set_halign (focal_length_data, GTK_ALIGN_START);
+ gtk_grid_attach_next_to (GTK_GRID (grid), focal_length_data, focal_length_w, GTK_POS_RIGHT, 2, 1);
+ g_free (focal_length_str);
+ }
+
+ if (iso_speed_w != NULL)
+ {
+ GtkWidget *iso_speed_data;
+ gchar *iso_speed_str;
+
+ iso_speed_str = g_strdup_printf ("%.0lf", iso_speed);
+ iso_speed_data = gtk_label_new (iso_speed_str);
+ gtk_widget_set_halign (iso_speed_data, GTK_ALIGN_START);
+ gtk_grid_attach_next_to (GTK_GRID (grid), iso_speed_data, iso_speed_w, GTK_POS_RIGHT, 2, 1);
+ g_free (iso_speed_str);
+ }
}
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index bcf1ab5..eb434fd 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -199,7 +199,11 @@ photos_query_builder_query (gboolean global, gint flags)
"( EXISTS { ?urn nao:hasTag nao:predefined-tag-favorite } ) "
"( EXISTS { ?urn nco:contributor ?contributor FILTER ( ?contributor != ?creator ) }
) "
"tracker:coalesce(nfo:fileCreated (?urn), nie:contentCreated (?urn))"
- "nfo:equipment (?urn)",
+ "nfo:equipment (?urn)"
+ "nmm:exposureTime (?urn)"
+ "nmm:fnumber (?urn)"
+ "nmm:focalLength (?urn)"
+ "nmm:isoSpeed (?urn)",
where_sparql,
tail_sparql,
NULL);
diff --git a/src/photos-query.h b/src/photos-query.h
index f6c5bf1..7529071 100644
--- a/src/photos-query.h
+++ b/src/photos-query.h
@@ -47,7 +47,11 @@ typedef enum
PHOTOS_QUERY_COLUMNS_RESOURCE_FAVORITE,
PHOTOS_QUERY_COLUMNS_RESOURCE_SHARED,
PHOTOS_QUERY_COLUMNS_DATE_CREATED,
- PHOTOS_QUERY_COLUMNS_EQUIPMENT
+ PHOTOS_QUERY_COLUMNS_EQUIPMENT,
+ PHOTOS_QUERY_COLUMNS_EXPOSURE_TIME,
+ PHOTOS_QUERY_COLUMNS_FNUMBER,
+ PHOTOS_QUERY_COLUMNS_FOCAL_LENGTH,
+ PHOTOS_QUERY_COLUMNS_ISO_SPEED
} PhotosQueryColumns;
typedef enum
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]