static char* set_row_data (GtkTreeStore *store, char *path, char *parent, const char *attribute, const char *value) { GtkTreeIter iter; gchar *utf_attribute = NULL; gchar *utf_value = NULL; gboolean iter_valid = FALSE; if (!attribute) return NULL; if (path != NULL) { iter_valid = gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (store), &iter, path); } if (!iter_valid) { GtkTreePath *tree_path; GtkTreeIter parent_iter; gboolean parent_valid = FALSE; if (parent != NULL) { parent_valid = gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (store), &parent_iter, parent); } gtk_tree_store_append (store, &iter, parent_valid ? &parent_iter : NULL); if (path == NULL) { tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter); if (tree_path != NULL) { path = gtk_tree_path_to_string (tree_path); gtk_tree_path_free (tree_path); } } } utf_attribute = eog_util_make_valid_utf8 (attribute); gtk_tree_store_set (store, &iter, MODEL_COLUMN_ATTRIBUTE, utf_attribute, -1); g_free (utf_attribute); if (value != NULL) { utf_value = eog_util_make_valid_utf8 (value); gtk_tree_store_set (store, &iter, MODEL_COLUMN_VALUE, utf_value, -1); g_free (utf_value); } return path; }
void eog_exif_util_set_label_text (GtkLabel *label, EogExifData *exif_data, gint tag_id) { gchar exif_buffer[512]; const gchar *buf_ptr; gchar *label_text = NULL; g_return_if_fail (GTK_IS_LABEL (label)); if (exif_data) { buf_ptr = eog_exif_data_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 (label, label_text); g_free (label_text); }