From 486e0f3d88fafa28ec1342c947e5e11fb9aa7891 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Fri, 7 Jul 2017 23:54:25 +0200 Subject: [PATCH] plug-ins: lots and lots of cleanup in metadata/ --- plug-ins/metadata/metadata-editor.c | 3584 +++++++++++++++------------ plug-ins/metadata/metadata-tags.h | 8 - plug-ins/metadata/metadata-xml.c | 12 +- 3 files changed, 1962 insertions(+), 1642 deletions(-) diff --git a/plug-ins/metadata/metadata-editor.c b/plug-ins/metadata/metadata-editor.c index 02ca67a2bf..dc1e049f0b 100644 --- a/plug-ins/metadata/metadata-editor.c +++ b/plug-ins/metadata/metadata-editor.c @@ -167,16 +167,16 @@ list_row_add_callback (GtkWidget *widget, gpointer data, gchar *tag); -int +static gint count_tags (GExiv2Metadata *metadata, - gchar *header, - gchar **tags, + const gchar *header, + const gchar **tags, int items); -void +static void get_tags (GExiv2Metadata *metadata, - gchar *header, - gchar **tags, + const gchar *header, + const gchar **tags, const int items, const int count); @@ -484,6 +484,15 @@ run (const gchar *name, * ============================================================================ */ +static GtkWidget * +builder_get_widget (GtkBuilder *builder, + const gchar *name) +{ + GObject *object = gtk_builder_get_object (builder, name); + + return GTK_WIDGET (object); +} + static gboolean metadata_editor_dialog (gint32 image_id, GimpMetadata *g_metadata) @@ -554,11 +563,8 @@ metadata_editor_dialog (gint32 image_id, content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); - metadata_vbox = GTK_WIDGET (gtk_builder_get_object (builder, - "metadata-vbox")); - - impex_combo = GTK_WIDGET (gtk_builder_get_object (builder, - "impex_combo")); + metadata_vbox = builder_get_widget (builder, "metadata-vbox"); + impex_combo = builder_get_widget (builder, "impex_combo"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(impex_combo), _("Select:")); @@ -597,7 +603,8 @@ metadata_editor_dialog (gint32 image_id, * ============================================================================ */ static void -remove_substring(const gchar *string,const gchar *substring) +remove_substring (const gchar *string, + const gchar *substring) { if (string != NULL && substring != NULL) { @@ -609,9 +616,11 @@ remove_substring(const gchar *string,const gchar *substring) } } - -int -count_tags(GExiv2Metadata *metadata, gchar *header, gchar **tags, int items) +static gint +count_tags (GExiv2Metadata *metadata, + const gchar *header, + const gchar **tags, + gint items) { int tagcount; gchar tag[256]; @@ -633,9 +642,12 @@ count_tags(GExiv2Metadata *metadata, gchar *header, gchar **tags, int items) return tagcount; } -void -get_tags(GExiv2Metadata *metadata, gchar *header, - gchar **tags, const int items, const int count) +static void +get_tags (GExiv2Metadata *metadata, + const gchar *header, + const gchar **tags, + const gint items, + const gint count) { gchar tag[256]; @@ -657,35 +669,41 @@ get_tags(GExiv2Metadata *metadata, gchar *header, * ============================================================================ */ void -on_create_date_button_clicked (GtkButton *widget, gpointer data) +on_create_date_button_clicked (GtkButton *widget, + gpointer data) { on_date_button_clicked (widget, (GtkWidget*)data, "Xmp.photoshop.DateCreated"); } void -on_patient_dob_date_button_clicked (GtkButton *widget, gpointer data) +on_patient_dob_date_button_clicked (GtkButton *widget, + gpointer data) { on_date_button_clicked (widget, (GtkWidget*)data, "Xmp.DICOM.PatientDOB"); } void -on_study_date_button_clicked (GtkButton *widget, gpointer data) +on_study_date_button_clicked (GtkButton *widget, + gpointer data) { on_date_button_clicked (widget, (GtkWidget*)data, "Xmp.DICOM.StudyDateTime"); } void -on_series_date_button_clicked (GtkButton *widget, gpointer data) +on_series_date_button_clicked (GtkButton *widget, + gpointer data) { on_date_button_clicked (widget, (GtkWidget*)data, "Xmp.DICOM.SeriesDateTime"); } void -on_date_button_clicked (GtkButton *widget, GtkWidget *entry_widget, gchar *tag) +on_date_button_clicked (GtkButton *widget, + GtkWidget *entry_widget, + gchar *tag) { GtkBuilder *builder; GtkWidget *calendar_dialog; @@ -755,14 +773,13 @@ on_date_button_clicked (GtkButton *widget, GtkWidget *entry_widget, gchar *tag) calendar_content_area = gtk_dialog_get_content_area (GTK_DIALOG ( calendar_dialog)); - calendar_vbox = GTK_WIDGET (gtk_builder_get_object (builder, - "calendar-vbox")); + calendar_vbox = builder_get_widget (builder, "calendar-vbox"); gtk_container_set_border_width (GTK_CONTAINER (calendar_vbox), 12); gtk_box_pack_start (GTK_BOX (calendar_content_area), calendar_vbox, TRUE, TRUE, 0); - calendar = GTK_WIDGET (gtk_builder_get_object (builder, "calendar")); + calendar = builder_get_widget (builder, "calendar"); gtk_calendar_select_month (GTK_CALENDAR (calendar), month, year); gtk_calendar_select_day (GTK_CALENDAR (calendar), day); @@ -785,39 +802,30 @@ on_date_button_clicked (GtkButton *widget, GtkWidget *entry_widget, gchar *tag) */ gboolean -hasImageSupplierTagData(GtkBuilder *builder) +hasImageSupplierTagData (GtkBuilder *builder) { gint loop; for (loop = 0; loop < imageSupplierInfoHeader.size; loop++) { - GObject *object; + GObject *object; + const gchar *text; object = gtk_builder_get_object (builder, default_metadata_tags[loop].tag); - if (!strcmp(imageSupplierInfoTags[loop].mode, "single")) + if (! strcmp (imageSupplierInfoTags[loop].mode, "single")) { - const gchar *text; text = gtk_entry_get_text (GTK_ENTRY (object)); - if (text != NULL) - { - if (text[0] != '\0') - { - return TRUE; - } - } + + if (text && *text) + return TRUE; } - else if (!strcmp(imageSupplierInfoTags[loop].mode, "multi")) + else if (! strcmp (imageSupplierInfoTags[loop].mode, "multi")) { - const gchar *text; text = gtk_entry_get_text (GTK_ENTRY (object)); - if (text != NULL) - { - if (text[0] != '\0') - { - return TRUE; - } - } + + if (text && *text) + return TRUE; } } @@ -825,27 +833,23 @@ hasImageSupplierTagData(GtkBuilder *builder) } gboolean -hasLocationCreationTagData(GtkBuilder *builder) +hasLocationCreationTagData (GtkBuilder *builder) { gint loop; for (loop = 0; loop < creatorContactInfoHeader.size; loop++) { - GObject *object; - const gchar *text; + GObject *object; + const gchar *text; object = gtk_builder_get_object (builder, default_metadata_tags[loop].tag); - if (!strcmp(locationCreationInfoTags[loop].mode, "single")) + if (! strcmp (locationCreationInfoTags[loop].mode, "single")) { text = gtk_entry_get_text (GTK_ENTRY (object)); - if (text != NULL) - { - if (text[0] != '\0') - { - return TRUE; - } - } + + if (text && *text) + return TRUE; } } @@ -872,41 +876,32 @@ hasCreatorTagData (GtkBuilder *builder) for (loop = 0; loop < creatorContactInfoHeader.size; loop++) { - GObject *object; - GtkTextView *text_view; - GtkTextBuffer *buffer; - GtkTextIter start; - GtkTextIter end; + GObject *object; + const gchar *text; object = gtk_builder_get_object (builder, default_metadata_tags[loop].tag); - if (!strcmp(creatorContactInfoTags[loop].mode, "single")) + if (! strcmp (creatorContactInfoTags[loop].mode, "single")) { - const gchar *text; text = gtk_entry_get_text (GTK_ENTRY (object)); - if (text != NULL) - { - if (text[0] != '\0') - { - return TRUE; - } - } + + if (text && *text) + return TRUE; } - else if (!strcmp(creatorContactInfoTags[loop].mode, "multi")) + else if (! strcmp (creatorContactInfoTags[loop].mode, "multi")) { - const gchar *text; - text_view = GTK_TEXT_VIEW (object); - buffer = gtk_text_view_get_buffer (text_view); + GtkTextView *text_view = GTK_TEXT_VIEW (object); + GtkTextBuffer *buffer = gtk_text_view_get_buffer (text_view); + GtkTextIter start; + GtkTextIter end; + gtk_text_buffer_get_start_iter (buffer, &start); gtk_text_buffer_get_end_iter (buffer, &end); + text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE); - if (text != NULL) - { - if (text[0] != '\0') - { - return TRUE; - } - } + + if (text && *text) + return TRUE; } } @@ -955,11 +950,13 @@ cell_edited_callback_combo (GtkCellRendererCombo *cell, GtkTreeSelection *selection; widget = GTK_WIDGET(data); - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(widget)); - if (gtk_tree_selection_get_selected (GTK_TREE_SELECTION(selection), + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); + + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)); + + if (gtk_tree_selection_get_selected (GTK_TREE_SELECTION (selection), NULL, &iter)) { path = gtk_tree_model_get_path (treemodel, &iter); @@ -997,9 +994,9 @@ licensor_phone1_cell_edited_callback (GtkCellRendererText *cell, static void licensor_phone_type1_cell_edited_callback (GtkCellRendererCombo *cell, - const gchar *path_string, - const gchar *new_text, - gpointer data) + const gchar *path_string, + const gchar *new_text, + gpointer data) { cell_edited_callback_combo (cell, path_string, new_text, data, 3); } @@ -1015,9 +1012,9 @@ licensor_phone2_cell_edited_callback (GtkCellRendererText *cell, static void licensor_phone_type2_cell_edited_callback (GtkCellRendererCombo *cell, - const gchar *path_string, - const gchar *new_text, - gpointer data) + const gchar *path_string, + const gchar *new_text, + gpointer data) { cell_edited_callback_combo (cell, path_string, new_text, data, 5); } @@ -1078,9 +1075,9 @@ img_cr8_id_cell_edited_callback (GtkCellRendererText *cell, static void aoo_copyright_notice_cell_edited_callback (GtkCellRendererText *cell, - const gchar *path_string, - const gchar *new_text, - gpointer data) + const gchar *path_string, + const gchar *new_text, + gpointer data) { cell_edited_callback (cell, path_string, new_text, data, 5); } @@ -1247,9 +1244,9 @@ mod_rel_id_cell_edited_callback (GtkCellRendererText *cell, static void organisation_image_name_cell_edited_callback (GtkCellRendererText *cell, - const gchar *path_string, - const gchar *new_text, - gpointer data) + const gchar *path_string, + const gchar *new_text, + gpointer data) { GtkTreeModel *model; GtkTreePath *path; @@ -1269,9 +1266,9 @@ organisation_image_name_cell_edited_callback (GtkCellRendererText *cell, static void organisation_image_code_cell_edited_callback (GtkCellRendererText *cell, - const gchar *path_string, - const gchar *new_text, - gpointer data) + const gchar *path_string, + const gchar *new_text, + gpointer data) { GtkTreeModel *model; GtkTreePath *path; @@ -1293,96 +1290,108 @@ organisation_image_code_cell_edited_callback (GtkCellRendererText *cell, /* CELL / ROW REMOVE */ static void -list_row_remove_callback (GtkWidget *widget, gpointer data, gchar *tag) +list_row_remove_callback (GtkWidget *widget, + gpointer data, + gchar *tag) { + GtkBuilder *builder = data; GtkWidget *list_widget; GtkListStore *liststore; GtkTreeIter iter; - GtkBuilder *builder; GtkTreeModel *treemodel; GtkTreeSelection *selection; GtkTreePath *path; - builder = (GtkBuilder*)data; + list_widget = builder_get_widget (builder, tag); + + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (list_widget)); + liststore = GTK_LIST_STORE (treemodel); - list_widget = - GTK_WIDGET (gtk_builder_get_object (builder, tag)); - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)list_widget)); - treemodel = GTK_TREE_MODEL (liststore); selection = gtk_tree_view_get_selection ((GtkTreeView *)list_widget); if (gtk_tree_selection_get_selected (selection, NULL, &iter)) { - int number_of_rows; + gint number_of_rows; + path = gtk_tree_model_get_path (treemodel, &iter); gtk_list_store_remove (liststore, &iter); gtk_tree_path_free (path); - number_of_rows = - gtk_tree_model_iter_n_children(GTK_TREE_MODEL(liststore), NULL); - // Make sur that two rows are always showing, else it looks ugly. + + number_of_rows = gtk_tree_model_iter_n_children (treemodel, NULL); + /* Make sur that two rows are always showing, else it looks ugly. */ if (number_of_rows < 2) { - gtk_list_store_append(liststore, &iter); + gtk_list_store_append (liststore, &iter); } } } static void -property_release_id_remove_callback (GtkWidget *widget, gpointer data) +property_release_id_remove_callback (GtkWidget *widget, + gpointer data) { list_row_remove_callback (widget, data, "Xmp.plus.PropertyReleaseID"); } static void -model_release_id_remove_callback (GtkWidget *widget, gpointer data) +model_release_id_remove_callback (GtkWidget *widget, + gpointer data) { list_row_remove_callback (widget, data, "Xmp.plus.ModelReleaseID"); } static void -shown_location_remove_callback (GtkWidget *widget, gpointer data) +shown_location_remove_callback (GtkWidget *widget, + gpointer data) { list_row_remove_callback (widget, data, "Xmp.iptcExt.LocationShown"); } static void -feat_org_name_remove_callback (GtkWidget *widget, gpointer data) +feat_org_name_remove_callback (GtkWidget *widget, + gpointer data) { list_row_remove_callback (widget, data, "Xmp.iptcExt.OrganisationInImageName"); } static void -feat_org_code_remove_callback (GtkWidget *widget, gpointer data) +feat_org_code_remove_callback (GtkWidget *widget, + gpointer data) { list_row_remove_callback (widget, data, "Xmp.iptcExt.OrganisationInImageCode"); } static void -artwork_object_remove_callback (GtkWidget *widget, gpointer data) +artwork_object_remove_callback (GtkWidget *widget, + gpointer data) { list_row_remove_callback (widget, data, "Xmp.iptcExt.ArtworkOrObject"); } static void -reg_entry_remove_callback (GtkWidget *widget, gpointer data) +reg_entry_remove_callback (GtkWidget *widget, + gpointer data) { list_row_remove_callback (widget, data, "Xmp.iptcExt.RegistryId"); } static void -image_creator_remove_callback (GtkWidget *widget, gpointer data) +image_creator_remove_callback (GtkWidget *widget, + gpointer data) { list_row_remove_callback (widget, data, "Xmp.plus.ImageCreator"); } static void -copyright_own_remove_callback (GtkWidget *widget, gpointer data) +copyright_own_remove_callback (GtkWidget *widget, + gpointer data) { list_row_remove_callback (widget, data, "Xmp.plus.CopyrightOwner"); } static void -licensor_remove_callback (GtkWidget *widget, gpointer data) +licensor_remove_callback (GtkWidget *widget, + gpointer data) { list_row_remove_callback (widget, data, "Xmp.plus.Licensor"); } @@ -1391,76 +1400,88 @@ licensor_remove_callback (GtkWidget *widget, gpointer data) /* CELL / ROW ADD */ static void -list_row_add_callback (GtkWidget *widget, gpointer data, gchar *tag) +list_row_add_callback (GtkWidget *widget, + gpointer data, + gchar *tag) { + GtkBuilder *builder = data; GtkWidget *list_widget; GtkListStore *liststore; GtkTreeIter iter; - GtkBuilder *builder = (GtkBuilder*)data; - list_widget = - GTK_WIDGET (gtk_builder_get_object (builder, tag)); - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)list_widget)); + list_widget = builder_get_widget (builder, tag); + + liststore = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (list_widget))); gtk_list_store_append (liststore, &iter); } static void -property_release_id_add_callback (GtkWidget *widget, gpointer data) +property_release_id_add_callback (GtkWidget *widget, + gpointer data) { list_row_add_callback (widget, data, "Xmp.plus.PropertyReleaseID"); } static void -model_release_id_add_callback (GtkWidget *widget, gpointer data) +model_release_id_add_callback (GtkWidget *widget, + gpointer data) { list_row_add_callback (widget, data, "Xmp.plus.ModelReleaseID"); } static void -shown_location_add_callback (GtkWidget *widget, gpointer data) +shown_location_add_callback (GtkWidget *widget, + gpointer data) { list_row_add_callback (widget, data, "Xmp.iptcExt.LocationShown"); } static void -feat_org_name_add_callback (GtkWidget *widget, gpointer data) +feat_org_name_add_callback (GtkWidget *widget, + gpointer data) { list_row_add_callback (widget, data, "Xmp.iptcExt.OrganisationInImageName"); } static void -feat_org_code_add_callback (GtkWidget *widget, gpointer data) +feat_org_code_add_callback (GtkWidget *widget, + gpointer data) { list_row_add_callback (widget, data, "Xmp.iptcExt.OrganisationInImageCode"); } static void -artwork_object_add_callback (GtkWidget *widget, gpointer data) +artwork_object_add_callback (GtkWidget *widget, + gpointer data) { list_row_add_callback (widget, data, "Xmp.iptcExt.ArtworkOrObject"); } static void -reg_entry_add_callback (GtkWidget *widget, gpointer data) +reg_entry_add_callback (GtkWidget *widget, + gpointer data) { list_row_add_callback (widget, data, "Xmp.iptcExt.RegistryId"); } static void -image_creator_add_callback (GtkWidget *widget, gpointer data) +image_creator_add_callback (GtkWidget *widget, + gpointer data) { list_row_add_callback (widget, data, "Xmp.plus.ImageCreator"); } static void -copyright_own_add_callback (GtkWidget *widget, gpointer data) +copyright_own_add_callback (GtkWidget *widget, + gpointer data) { list_row_add_callback (widget, data, "Xmp.plus.CopyrightOwner"); } static void -licensor_add_callback (GtkWidget *widget, gpointer data) +licensor_add_callback (GtkWidget *widget, + gpointer data) { list_row_add_callback (widget, data, "Xmp.plus.Licensor"); } @@ -1483,237 +1504,225 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, gint32 numele = G_N_ELEMENTS (default_metadata_tags); /* Setup Buttons */ - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "add_licensor_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(licensor_add_callback), builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "rem_licensor_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(licensor_remove_callback), builder); + button_widget = builder_get_widget (builder, "add_licensor_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (licensor_add_callback), + builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "add_copyright_own_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(copyright_own_add_callback), builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "rem_copyright_own_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(copyright_own_remove_callback), builder); + button_widget = builder_get_widget (builder, "rem_licensor_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (licensor_remove_callback), + builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "add_image_creator_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(image_creator_add_callback), builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "rem_image_creator_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(image_creator_remove_callback), builder); + button_widget = builder_get_widget (builder, "add_copyright_own_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (copyright_own_add_callback), + builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "add_reg_entry_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(reg_entry_add_callback), builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "rem_reg_entry_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(reg_entry_remove_callback), builder); + button_widget = builder_get_widget (builder, "rem_copyright_own_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (copyright_own_remove_callback), + builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "add_artwork_object_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(artwork_object_add_callback), builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "rem_artwork_object_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(artwork_object_remove_callback), builder); + button_widget = builder_get_widget (builder, "add_image_creator_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (image_creator_add_callback), + builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "add_feat_org_code_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(feat_org_code_add_callback), builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "rem_feat_org_code_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(feat_org_code_remove_callback), builder); + button_widget = builder_get_widget (builder, "rem_image_creator_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (image_creator_remove_callback), + builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "add_feat_org_name_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(feat_org_name_add_callback), builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "rem_feat_org_name_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(feat_org_name_remove_callback), builder); + button_widget = builder_get_widget (builder, "add_reg_entry_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (reg_entry_add_callback), + builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "add_shown_location_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(shown_location_add_callback), builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "rem_shown_location_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(shown_location_remove_callback), builder); + button_widget = builder_get_widget (builder, "rem_reg_entry_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (reg_entry_remove_callback), + builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "add_model_rel_id_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(model_release_id_add_callback), builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "rem_model_rel_id_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(model_release_id_remove_callback), builder); + button_widget = builder_get_widget (builder, "add_artwork_object_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (artwork_object_add_callback), + builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "add_prop_rel_id_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(property_release_id_add_callback), builder); - button_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "rem_prop_rel_id_button")); - g_signal_connect(G_OBJECT(button_widget), - "clicked", G_CALLBACK(property_release_id_remove_callback), builder); + button_widget = builder_get_widget (builder, "rem_artwork_object_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (artwork_object_remove_callback), + builder); + + button_widget = builder_get_widget (builder, "add_feat_org_code_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (feat_org_code_add_callback), + builder); + + button_widget = builder_get_widget (builder, "rem_feat_org_code_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (feat_org_code_remove_callback), + builder); + + button_widget = builder_get_widget (builder, "add_feat_org_name_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (feat_org_name_add_callback), + builder); + + button_widget = builder_get_widget (builder, "rem_feat_org_name_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (feat_org_name_remove_callback), + builder); + + button_widget = builder_get_widget (builder, "add_shown_location_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (shown_location_add_callback), + builder); + + button_widget = builder_get_widget (builder, "rem_shown_location_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (shown_location_remove_callback), + builder); + + button_widget = builder_get_widget (builder, "add_model_rel_id_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (model_release_id_add_callback), + builder); + + button_widget = builder_get_widget (builder, "rem_model_rel_id_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (model_release_id_remove_callback), + builder); + + button_widget = builder_get_widget (builder, "add_prop_rel_id_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (property_release_id_add_callback), + builder); + + button_widget = builder_get_widget (builder, "rem_prop_rel_id_button"); + g_signal_connect (G_OBJECT (button_widget), "clicked", + G_CALLBACK (property_release_id_remove_callback), + builder); /* Setup Comboboxes */ - combo_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "Xmp.xmp.Rating")); - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_widget), + combo_widget = builder_get_widget (builder, "Xmp.xmp.Rating"); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget), _("Unrated")); - for (gint32 i=1; i < 6; i++) + for (i = 1; i < 6; i++) { - gchar *display; - display = g_strdup_printf("%d", i); - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_widget), - display); - if (display) - g_free(display); - } - gtk_combo_box_set_active (GTK_COMBO_BOX(combo_widget), 0); + gchar *display = g_strdup_printf ("%d", i); - combo_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "Xmp.xmpRights.Marked")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget), + display); + g_free (display); + } + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0); + + combo_widget = builder_get_widget (builder, "Xmp.xmpRights.Marked"); for (i = 0; i < 3; i++) { - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_widget), + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget), marked[i].display); } - gtk_combo_box_set_active (GTK_COMBO_BOX(combo_widget), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0); - combo_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "Xmp.photoshop.Urgency")); + combo_widget = builder_get_widget (builder, "Xmp.photoshop.Urgency"); for (i = 0; i < 9; i++) { - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_widget), + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget), urgency[i]); } - gtk_combo_box_set_active (GTK_COMBO_BOX(combo_widget), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0); - combo_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - "Xmp.plus.MinorModelAgeDisclosure")); + combo_widget = builder_get_widget (builder, "Xmp.plus.MinorModelAgeDisclosure"); for (i = 0; i < 13; i++) { - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_widget), + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget), minormodelagedisclosure[i].display); } - gtk_combo_box_set_active (GTK_COMBO_BOX(combo_widget), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0); - combo_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - "Xmp.plus.ModelReleaseStatus")); + combo_widget = builder_get_widget (builder, "Xmp.plus.ModelReleaseStatus"); for (i = 0; i < 4; i++) { - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_widget), + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget), modelreleasestatus[i].display); } - gtk_combo_box_set_active (GTK_COMBO_BOX(combo_widget), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0); gtk_widget_get_size_request (combo_widget, &width, &height); gtk_widget_set_size_request (combo_widget, 180, height); - combo_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - "Xmp.iptcExt.DigitalSourceType")); + combo_widget = builder_get_widget (builder, "Xmp.iptcExt.DigitalSourceType"); for (i = 0; i < 4; i++) { - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_widget), + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget), digitalsourcetype[i].display); } - gtk_combo_box_set_active (GTK_COMBO_BOX(combo_widget), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0); - combo_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - "Xmp.plus.PropertyReleaseStatus")); + combo_widget = builder_get_widget (builder, "Xmp.plus.PropertyReleaseStatus"); for (i = 0; i < 4; i++) { - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_widget), + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget), propertyreleasestatus[i].display); } - gtk_combo_box_set_active (GTK_COMBO_BOX(combo_widget), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0); gtk_widget_get_size_request (combo_widget, &width, &height); gtk_widget_set_size_request (combo_widget, 180, height); - combo_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - "Xmp.DICOM.PatientSex")); + combo_widget = builder_get_widget (builder, "Xmp.DICOM.PatientSex"); for (i = 0; i < 4; i++) { - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_widget), + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget), dicom[i].display); } - gtk_combo_box_set_active (GTK_COMBO_BOX(combo_widget), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0); - combo_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - "Exif.GPSInfo.GPSLatitudeRef")); + combo_widget = builder_get_widget (builder, "Exif.GPSInfo.GPSLatitudeRef"); for (i = 0; i < 3; i++) { - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_widget), + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget), gpslatref[i]); } - gtk_combo_box_set_active (GTK_COMBO_BOX(combo_widget), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0); - combo_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - "Exif.GPSInfo.GPSLongitudeRef")); + combo_widget = builder_get_widget (builder, "Exif.GPSInfo.GPSLongitudeRef"); for (i = 0; i < 3; i++) { - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_widget), + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget), gpslngref[i]); } - gtk_combo_box_set_active (GTK_COMBO_BOX(combo_widget), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0); - combo_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - "Exif.GPSInfo.GPSAltitudeRef")); + combo_widget = builder_get_widget (builder, "Exif.GPSInfo.GPSAltitudeRef"); for (i = 0; i < 3; i++) { - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_widget), + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget), gpsaltref[i]); } - gtk_combo_box_set_active (GTK_COMBO_BOX(combo_widget), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0); - combo_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - "GPSAltitudeSystem")); + combo_widget = builder_get_widget (builder, "GPSAltitudeSystem"); for (i = 0; i < 2; i++) { - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(combo_widget), + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget), gpsaltsys[i]); } - gtk_combo_box_set_active (GTK_COMBO_BOX(combo_widget), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0); - g_signal_connect(G_OBJECT(combo_widget), - "changed", G_CALLBACK(gpsaltsys_combo_callback), builder); + g_signal_connect (G_OBJECT (combo_widget), "changed", + G_CALLBACK (gpsaltsys_combo_callback), + builder); /* Set up text view heights */ for (i = 0; i < numele; i++) { - if (! strcmp("multi", default_metadata_tags[i].mode)) + if (! strcmp ("multi", default_metadata_tags[i].mode)) { - text_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - default_metadata_tags[i].tag)); + text_widget = builder_get_widget (builder, + default_metadata_tags[i].tag); gtk_widget_get_size_request (text_widget, &width, &height); gtk_widget_set_size_request (text_widget, width, height + 60); } @@ -1721,11 +1730,10 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, for (i = 0; i < creatorContactInfoHeader.size; i++) { - if (! strcmp("multi", creatorContactInfoTags[i].mode)) + if (! strcmp ("multi", creatorContactInfoTags[i].mode)) { - text_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - creatorContactInfoTags[i].id)); + text_widget = builder_get_widget (builder, + creatorContactInfoTags[i].id); gtk_widget_get_size_request (text_widget, &width, &height); gtk_widget_set_size_request (text_widget, width, height + 60); } @@ -1736,11 +1744,11 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, { GtkWidget *widget; - widget = GTK_WIDGET (gtk_builder_get_object (builder, - imageSupplierInfoTags[i].id)); + widget = builder_get_widget (builder, + imageSupplierInfoTags[i].id); value = gexiv2_metadata_get_tag_interpreted_string (metadata, - imageSupplierInfoTags[i].tag); + imageSupplierInfoTags[i].tag); if (value) { @@ -1749,28 +1757,28 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, value_clean = g_strdup(value); - if (strstr(value_clean, lang_default) != NULL) + if (strstr (value_clean, lang_default) != NULL) { remove_substring (value_clean, lang_default); - if (strstr(value_clean, " ") != NULL) + if (strstr (value_clean, " ") != NULL) { remove_substring (value_clean, " "); } } - if (strstr(value_clean, bag_default) != NULL) + if (strstr (value_clean, bag_default) != NULL) { remove_substring (value_clean, bag_default); - if (strstr(value_clean, " ") != NULL) + if (strstr (value_clean, " ") != NULL) { remove_substring (value_clean, " "); } } - if (strstr(value_clean, seq_default) != NULL) + if (strstr (value_clean, seq_default) != NULL) { remove_substring (value_clean, seq_default); - if (strstr(value_clean, " ") != NULL) + if (strstr (value_clean, " ") != NULL) { remove_substring (value_clean, " "); } @@ -1782,9 +1790,10 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, { gtk_entry_set_text (GTK_ENTRY (widget), value_utf); } - else if (! strcmp("multi", imageSupplierInfoTags[i].mode)) + else if (! strcmp ("multi", imageSupplierInfoTags[i].mode)) { GtkTextBuffer *buffer; + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); gtk_text_buffer_set_text (buffer, value_utf, -1); } @@ -1795,41 +1804,41 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, { GtkWidget *widget; - widget = GTK_WIDGET (gtk_builder_get_object (builder, - locationCreationInfoTags[i].id)); + widget = builder_get_widget (builder, + locationCreationInfoTags[i].id); value = gexiv2_metadata_get_tag_interpreted_string (metadata, - locationCreationInfoTags[i].tag); + locationCreationInfoTags[i].tag); if (value) { gchar *value_clean; gchar *value_utf; - value_clean = g_strdup(value); + value_clean = g_strdup (value); - if (strstr(value_clean, lang_default) != NULL) + if (strstr (value_clean, lang_default) != NULL) { remove_substring (value_clean, lang_default); - if (strstr(value_clean, " ") != NULL) + if (strstr (value_clean, " ") != NULL) { remove_substring (value_clean, " "); } } - if (strstr(value_clean, bag_default) != NULL) + if (strstr (value_clean, bag_default) != NULL) { remove_substring (value_clean, bag_default); - if (strstr(value_clean, " ") != NULL) + if (strstr (value_clean, " ") != NULL) { remove_substring (value_clean, " "); } } - if (strstr(value_clean, seq_default) != NULL) + if (strstr (value_clean, seq_default) != NULL) { remove_substring (value_clean, seq_default); - if (strstr(value_clean, " ") != NULL) + if (strstr (value_clean, " ") != NULL) { remove_substring (value_clean, " "); } @@ -1850,41 +1859,40 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, { GtkWidget *widget; - widget = GTK_WIDGET (gtk_builder_get_object (builder, - creatorContactInfoTags[i].id)); + widget = builder_get_widget (builder, creatorContactInfoTags[i].id); value = gexiv2_metadata_get_tag_interpreted_string (metadata, - creatorContactInfoTags[i].tag); + creatorContactInfoTags[i].tag); if (value) { gchar *value_clean; gchar *value_utf; - value_clean = g_strdup(value); + value_clean = g_strdup (value); if (strstr(value_clean, lang_default) != NULL) { remove_substring (value_clean, lang_default); - if (strstr(value_clean, " ") != NULL) + if (strstr (value_clean, " ") != NULL) { remove_substring (value_clean, " "); } } - if (strstr(value_clean, bag_default) != NULL) + if (strstr (value_clean, bag_default) != NULL) { remove_substring (value_clean, bag_default); - if (strstr(value_clean, " ") != NULL) + if (strstr (value_clean, " ") != NULL) { remove_substring (value_clean, " "); } } - if (strstr(value_clean, seq_default) != NULL) + if (strstr (value_clean, seq_default) != NULL) { remove_substring (value_clean, seq_default); - if (strstr(value_clean, " ") != NULL) + if (strstr (value_clean, " ") != NULL) { remove_substring (value_clean, " "); } @@ -1908,14 +1916,15 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, for (i = 0; i < numele; i++) { GtkWidget *widget; - widget = GTK_WIDGET (gtk_builder_get_object (builder, - default_metadata_tags[i].tag)); + + widget = builder_get_widget (builder, default_metadata_tags[i].tag); value = gexiv2_metadata_get_tag_interpreted_string (metadata, - default_metadata_tags[i].tag); - if (!value || value[0] == '\0') + default_metadata_tags[i].tag); + + if (! value || value[0] == '\0') { - int index; + gint index; if (value) g_free(value); @@ -1923,9 +1932,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, index = default_metadata_tags[i].other_tag_index; if (index > -1) { - value = - gexiv2_metadata_get_tag_interpreted_string (metadata, - equivalent_metadata_tags[index].tag); + value = gexiv2_metadata_get_tag_interpreted_string (metadata, + equivalent_metadata_tags[index].tag); } } @@ -1934,40 +1942,42 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, gchar *value_clean; gchar *value_utf; - value_clean = g_strdup(value); + value_clean = g_strdup (value); if (strstr(value_clean, lang_default) != NULL) { remove_substring (value_clean, lang_default); - if (strstr(value_clean, " ") != NULL) + if (strstr (value_clean, " ") != NULL) { remove_substring (value_clean, " "); } } - if (strstr(value_clean, bag_default) != NULL) + if (strstr (value_clean, bag_default) != NULL) { remove_substring (value_clean, bag_default); - if (strstr(value_clean, " ") != NULL) + if (strstr (value_clean, " ") != NULL) { remove_substring (value_clean, " "); } } - if (strstr(value_clean, seq_default) != NULL) + if (strstr (value_clean, seq_default) != NULL) { remove_substring (value_clean, seq_default); - if (strstr(value_clean, " ") != NULL) + if (strstr (value_clean, " ") != NULL) { remove_substring (value_clean, " "); } } - if (!strcmp ("Exif.GPSInfo.GPSAltitude", default_metadata_tags[i].tag)) + if (! strcmp ("Exif.GPSInfo.GPSAltitude", + default_metadata_tags[i].tag)) { gchar *new_value_clean[2]; + new_value_clean[0] = strtok(value_clean," "); - strcpy(value_clean, new_value_clean[0]); + strcpy (value_clean, new_value_clean[0]); } value_utf = g_locale_to_utf8 (value_clean, -1, NULL, NULL, NULL); @@ -1976,15 +1986,17 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, { gtk_entry_set_text (GTK_ENTRY (widget), value_utf); } - else if (!strcmp ("multi", default_metadata_tags[i].mode)) + else if (! strcmp ("multi", default_metadata_tags[i].mode)) { GtkTextBuffer *buffer; + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); gtk_text_buffer_set_text (buffer, value_utf, -1); } else if (!strcmp ("list", default_metadata_tags[i].mode)) { - if (!strcmp ("Xmp.plus.CopyrightOwner", default_metadata_tags[i].tag)) + if (! strcmp ("Xmp.plus.CopyrightOwner", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -1995,35 +2007,45 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, GtkTreeIter iter; gint store_index; - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); - // COPYRIGHT OWNER - NAME - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_CR_OWNER_NAME); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + /* COPYRIGHT OWNER - NAME */ + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_CR_OWNER_NAME); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (cr_owner_name_cell_edited_callback), treemodel); + G_CALLBACK (cr_owner_name_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_CR_OWNER_NAME)); } - // COPYRIGHT OWNER - ID - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_CR_OWNER_ID); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + /* COPYRIGHT OWNER - ID */ + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_CR_OWNER_ID); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (cr_owner_id_cell_edited_callback), treemodel); + G_CALLBACK (cr_owner_id_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_CR_OWNER_ID)); } @@ -2032,7 +2054,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, if (store_index > 0) { - for (int item = 0; item < store_index; item++) + gint item; + + for (item = 0; item < store_index; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2043,7 +2067,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2053,7 +2079,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } } } - else if (!strcmp ("Xmp.plus.ImageCreator", default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.plus.ImageCreator", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -2066,35 +2093,45 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, gchar arr1[256][256]; gchar arr2[256][256]; - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); - // IMAGE CREATOR - NAME - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_IMG_CR8_NAME); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + /* IMAGE CREATOR - NAME */ + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_IMG_CR8_NAME); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (img_cr8_name_cell_edited_callback), treemodel); + G_CALLBACK (img_cr8_name_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_IMG_CR8_NAME)); } - // IMAGE CREATOR - ID - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_IMG_CR8_ID); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + /* IMAGE CREATOR - ID */ + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_IMG_CR8_ID); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (img_cr8_id_cell_edited_callback), treemodel); + G_CALLBACK (img_cr8_id_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_IMG_CR8_ID)); } @@ -2103,7 +2140,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, if (store_index > 0) { - for (int item = 0; item < store_index; item++) + gint item; + + for (item = 0; item < store_index; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2114,7 +2153,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2124,8 +2165,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } } } - else if (!strcmp ("Xmp.iptcExt.ArtworkOrObject", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.iptcExt.ArtworkOrObject", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -2142,95 +2183,125 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, gchar arr5[256][256]; gchar arr6[256][256]; - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); /* ARTWORK OR OBJECT - TITLE */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_AOO_TITLE); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_AOO_TITLE); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (aoo_title_cell_edited_callback), treemodel); + G_CALLBACK (aoo_title_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_AOO_TITLE)); } /* ARTWORK OR OBJECT - DATE CREATED */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_AOO_DATE_CREAT); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_AOO_DATE_CREAT); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); for (r = rlist; r != NULL; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (aoo_date_creat_cell_edited_callback), treemodel); + G_CALLBACK (aoo_date_creat_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_AOO_DATE_CREAT)); } /* ARTWORK OR OBJECT - CREATOR */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_AOO_CREATOR); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_AOO_CREATOR); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); for (r = rlist; r != NULL; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (aoo_creator_cell_edited_callback), treemodel); + G_CALLBACK (aoo_creator_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_AOO_CREATOR)); } /* ARTWORK OR OBJECT - SOURCE */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_AOO_SOURCE); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_AOO_SOURCE); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (aoo_source_cell_edited_callback), treemodel); + G_CALLBACK (aoo_source_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_AOO_SOURCE)); } /* ARTWORK OR OBJECT - SOURCE INVENTORY ID */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_AOO_SRC_INV_ID); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_AOO_SRC_INV_ID); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (aoo_source_inv_cell_edited_callback), treemodel); + G_CALLBACK (aoo_source_inv_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_AOO_SRC_INV_ID)); } /* ARTWORK OR OBJECT - COPYRIGHT NOTICE */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_AOO_CR_NOT); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_AOO_CR_NOT); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (aoo_copyright_notice_cell_edited_callback), treemodel); + G_CALLBACK (aoo_copyright_notice_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_AOO_CR_NOT)); } @@ -2239,7 +2310,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, if (store_index > 0) { - for (int item = 0; item < store_index; item++) + gint item; + + for (item = 0; item < store_index; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2254,7 +2327,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2268,7 +2343,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } } } - else if (!strcmp ("Xmp.iptcExt.RegistryId", default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.iptcExt.RegistryId", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -2281,12 +2357,13 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, gchar arr1[256][256]; gchar arr2[256][256]; - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); /* LOCATION SHOWN - SUB LOCATION */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_REGSITRY_ORG_ID); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_REGSITRY_ORG_ID); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); for (r = rlist; r != NULL; r = r->next) { renderer = (GtkCellRenderer*) r->data; @@ -2302,15 +2379,19 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, /* LOCATION SHOWN - CITY */ column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_REGSITRY_ITEM_ID); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (reg_item_id_cell_edited_callback), treemodel); + G_CALLBACK (reg_item_id_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_REGSITRY_ITEM_ID)); } @@ -2319,7 +2400,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, if (store_index > 0) { - for (int item = 0; item < store_index; item++) + gint item; + + for (item = 0; item < store_index; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2330,7 +2413,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2340,8 +2425,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } } } - else if (!strcmp ("Xmp.iptcExt.OrganisationInImageName", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.iptcExt.OrganisationInImageName", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -2357,42 +2442,50 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, /* seperate list on commas */ store_index = 0; - for(i_ctr=0, str=strtok(value,",;"); str!= NULL; i_ctr++, str=strtok(NULL,",;")) + for (i_ctr = 0, str = strtok (value, ",;"); + str; + i_ctr++, str = strtok (NULL, ",;")) { /* remove leading whitespace */ - int l = strlen(str); - while(isspace(str[l - 1])) --l; - while(* str && isspace(* str)) ++str, --l; + gint l = strlen (str); + + while (isspace (str[l - 1])) --l; + while (* str && isspace (*str)) ++str, --l; /* stuff into array */ - strcpy( arr[i_ctr], str); + strcpy (arr[i_ctr], str); store_index++; } - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); - gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW ( - widget)), + gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)), GTK_SELECTION_SINGLE); column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), 0); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (organisation_image_name_cell_edited_callback), treemodel); + G_CALLBACK (organisation_image_name_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_ORG_IMG_NAME)); } if (store_index > 0) { - for (int item = 0; item < store_index; item++) + gint item; + + for (item = 0; item < store_index; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2402,7 +2495,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2411,8 +2506,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } } } - else if (!strcmp ("Xmp.iptcExt.OrganisationInImageCode", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.iptcExt.OrganisationInImageCode", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -2428,42 +2523,50 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, /* seperate list on commas */ store_index = 0; - for(i_ctr=0, str=strtok(value,",;"); str!= NULL; i_ctr++, str=strtok(NULL,",;")) + for (i_ctr = 0, str = strtok (value, ",;"); + str; + i_ctr++, str = strtok (NULL, ",;")) { /* remove leading whitespace */ - int l = strlen(str); - while(isspace(str[l - 1])) --l; - while(* str && isspace(* str)) ++str, --l; + gint l = strlen (str); + + while (isspace (str[l - 1])) --l; + while (* str && isspace (*str)) ++str, --l; /* stuff into array */ - strcpy( arr[i_ctr], str); + strcpy (arr[i_ctr], str); store_index++; } - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); - gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW ( - widget)), + gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)), GTK_SELECTION_SINGLE); column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), 0); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (organisation_image_code_cell_edited_callback), treemodel); + G_CALLBACK (organisation_image_code_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COL_ORG_IMG_CODE)); } if (store_index > 0) { - for (int item = 0; item < store_index; item++) + gint item; + + for (item = 0; item < store_index; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2473,7 +2576,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2482,8 +2587,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } } } - else if (!strcmp ("Xmp.plus.PropertyReleaseID", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.plus.PropertyReleaseID", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -2499,48 +2604,58 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, /* seperate list on commas */ store_index = 0; - for(i_ctr=0, str=strtok(value,",;"); str!= NULL; i_ctr++, str=strtok(NULL,",;")) + for(i_ctr = 0, str = strtok (value, ",;"); + str; + i_ctr++, str = strtok (NULL, ",;")) { /* remove leading whitespace */ - int l = strlen(str); - while(isspace(str[l - 1])) --l; - while(* str && isspace(* str)) ++str, --l; + gint l = strlen (str); + + while (isspace (str[l - 1])) --l; + while (* str && isspace (*str)) ++str, --l; /* stuff into array */ - strcpy( arr[i_ctr], str); + strcpy (arr[i_ctr], str); store_index++; } - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); - gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW ( - widget)), + gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)), GTK_SELECTION_SINGLE); column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), 0); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (prop_rel_id_cell_edited_callback), treemodel); + G_CALLBACK (prop_rel_id_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_PROP_REL_ID)); + "column", + GINT_TO_POINTER (COL_PROP_REL_ID)); } if (store_index > 0) { - for (int item = 0; item < store_index; item++) + gint item; + + for (item = 0; item < store_index; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, COL_PROP_REL_ID, &arr[item], -1); } + if (store_index == 1) { gtk_list_store_append (liststore, &iter); @@ -2551,7 +2666,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2560,7 +2677,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } } } - else if (!strcmp ("Xmp.plus.ModelReleaseID", default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.plus.ModelReleaseID", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -2576,48 +2694,58 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, /* seperate list on commas */ store_index = 0; - for(i_ctr=0, str=strtok(value,",;"); str!= NULL; i_ctr++, str=strtok(NULL,",;")) + for (i_ctr = 0, str = strtok (value, ",;"); + str; + i_ctr++, str = strtok (NULL, ",;")) { /* remove leading whitespace */ - int l = strlen(str); - while(isspace(str[l - 1])) --l; - while(* str && isspace(* str)) ++str, --l; + gint l = strlen (str); + + while (isspace (str[l - 1])) --l; + while (*str && isspace (*str)) ++str, --l; /* stuff into array */ - strcpy( arr[i_ctr], str); + strcpy (arr[i_ctr], str); store_index++; } - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); - gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW ( - widget)), + gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)), GTK_SELECTION_SINGLE); column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), 0); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (mod_rel_id_cell_edited_callback), treemodel); + G_CALLBACK (mod_rel_id_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_PROP_REL_ID)); + "column", + GINT_TO_POINTER (COL_PROP_REL_ID)); } if (store_index > 0) { - for (int item = 0; item < store_index; item++) + gint item; + + for (item = 0; item < store_index; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, COL_MOD_REL_ID, &arr[item], -1); } + if (store_index == 1) { gtk_list_store_append (liststore, &iter); @@ -2628,7 +2756,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -2638,252 +2768,272 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } } } - else if (!strcmp ("combo", default_metadata_tags[i].mode)) + else if (! strcmp ("combo", default_metadata_tags[i].mode)) { - gint32 data; + gint32 data = 0; - data = 0; - if (!strcmp ("Exif.GPSInfo.GPSLatitudeRef", default_metadata_tags[i].tag)) + if (! strcmp ("Exif.GPSInfo.GPSLatitudeRef", + default_metadata_tags[i].tag)) { - if (strncmp ("N", value, 1) == 0) + if (! strncmp ("N", value, 1)) { data = 1; } - else if (strncmp ("S", value, 1) == 0) + else if (! strncmp ("S", value, 1)) { data = 2; } - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), data); } - else if (!strcmp ("Exif.GPSInfo.GPSLongitudeRef", - default_metadata_tags[i].tag)) + else if (! strcmp ("Exif.GPSInfo.GPSLongitudeRef", + default_metadata_tags[i].tag)) { - if (strncmp ("E", value, 1) == 0) + if (! strncmp ("E", value, 1)) { data = 1; } - else if (strncmp ("W", value, 1) == 0) + else if (! strncmp ("W", value, 1)) { data = 2; } - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), data); } - else if (!strcmp ("Exif.GPSInfo.GPSAltitudeRef", - default_metadata_tags[i].tag)) + else if (! strcmp ("Exif.GPSInfo.GPSAltitudeRef", + default_metadata_tags[i].tag)) { - if (strncmp ("A", value, 1) == 0) + if (! strncmp ("A", value, 1)) { data = 1; } - else if (strncmp ("B", value, 1) == 0) + else if (! strncmp ("B", value, 1)) { data = 2; } - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), data); } - else if (!strcmp ("Xmp.xmp.Rating", default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.xmp.Rating", default_metadata_tags[i].tag)) { - if (!strcmp ("1", value)) + if (! strcmp ("1", value)) { data = 1; } - else if (!strcmp ("2", value)) + else if (! strcmp ("2", value)) { data = 2; } - else if (!strcmp ("3", value)) + else if (! strcmp ("3", value)) { data = 3; } - else if (!strcmp ("4", value)) + else if (! strcmp ("4", value)) { data = 4; } - else if (!strcmp ("5", value)) + else if (! strcmp ("5", value)) { data = 5; } - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), data); } - else if (!strcmp ("Xmp.xmpRights.Marked", default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.xmpRights.Marked", + default_metadata_tags[i].tag)) { - if (!strcmp ("True", value)) + if (! strcmp ("True", value)) { data = 1; } - else if (!strcmp ("False", value)) + else if (! strcmp ("False", value)) { data = 2; } - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), data); } - else if (!strcmp ("Xmp.photoshop.Urgency", default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.photoshop.Urgency", + default_metadata_tags[i].tag)) { - if (!strcmp ("1", value)) + if (! strcmp ("1", value)) { data = 1; } - else if (!strcmp ("2", value)) + else if (! strcmp ("2", value)) { data = 2; } - else if (!strcmp ("3", value)) + else if (! strcmp ("3", value)) { data = 3; } - else if (!strcmp ("4", value)) + else if (! strcmp ("4", value)) { data = 4; } - else if (!strcmp ("5", value)) + else if (! strcmp ("5", value)) { data = 5; } - else if (!strcmp ("6", value)) + else if (! strcmp ("6", value)) { data = 6; } - else if (!strcmp ("7", value)) + else if (! strcmp ("7", value)) { data = 7; } - else if (!strcmp ("8", value)) + else if (! strcmp ("8", value)) { data = 8; } - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), data); } - else if (!strcmp ("Xmp.plus.MinorModelAgeDisclosure", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.plus.MinorModelAgeDisclosure", + default_metadata_tags[i].tag)) { - if (!strcmp ("Age Unknown", value)) + if (! strcmp ("Age Unknown", value)) { data = 0; } - else if (!strcmp ("Age 25 or Over", value)) + else if (! strcmp ("Age 25 or Over", value)) { data = 1; } - else if (!strcmp ("Age 24", value)) + else if (! strcmp ("Age 24", value)) { data = 2; } - else if (!strcmp ("Age 23", value)) + else if (! strcmp ("Age 23", value)) { data = 3; } - else if (!strcmp ("Age 22", value)) + else if (! strcmp ("Age 22", value)) { data = 4; } - else if (!strcmp ("Age 21", value)) + else if (! strcmp ("Age 21", value)) { data = 5; } - else if (!strcmp ("Age 20", value)) + else if (! strcmp ("Age 20", value)) { data = 6; } - else if (!strcmp ("Age 19", value)) + else if (! strcmp ("Age 19", value)) { data = 7; } - else if (!strcmp ("Age 18", value)) + else if (! strcmp ("Age 18", value)) { data = 8; } - else if (!strcmp ("Age 17", value)) + else if (! strcmp ("Age 17", value)) { data = 9; } - else if (!strcmp ("Age 16", value)) + else if (! strcmp ("Age 16", value)) { data = 10; } - else if (!strcmp ("Age 15", value)) + else if (! strcmp ("Age 15", value)) { data = 11; } - else if (!strcmp ("Age 14 or Under", value)) + else if (! strcmp ("Age 14 or Under", value)) { data = 12; } - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), data); } - else if (!strcmp ("Xmp.plus.ModelReleaseStatus", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.plus.ModelReleaseStatus", + default_metadata_tags[i].tag)) { - for (int loop = 0; loop < 4; loop++) + gint loop; + + for (loop = 0; loop < 4; loop++) { - if (!strcmp (modelreleasestatus[loop].data, value)) + if (! strcmp (modelreleasestatus[loop].data, value)) { - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), loop); + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), loop); break; } - if (!strcmp (modelreleasestatus[loop].display, value)) + + if (! strcmp (modelreleasestatus[loop].display, value)) { - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), loop); + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), loop); break; } } } - else if (!strcmp ("Xmp.iptcExt.DigitalSourceType", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.iptcExt.DigitalSourceType", + default_metadata_tags[i].tag)) { - for (int loop = 0; loop < 4; loop++) + gint loop; + + for (loop = 0; loop < 4; loop++) { - if (!strcmp (digitalsourcetype[loop].data, value)) + if (! strcmp (digitalsourcetype[loop].data, value)) { - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), loop); + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), loop); break; } - if (!strcmp (digitalsourcetype[loop].display, value)) + + if (! strcmp (digitalsourcetype[loop].display, value)) { - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), loop); + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), loop); break; } } } - else if (!strcmp ("Xmp.plus.PropertyReleaseStatus", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.plus.PropertyReleaseStatus", + default_metadata_tags[i].tag)) { - for (int loop = 0; loop < 4; loop++) + gint loop; + + for (loop = 0; loop < 4; loop++) { - if (!strcmp (propertyreleasestatus[loop].data, value)) + if (! strcmp (propertyreleasestatus[loop].data, value)) { - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), loop); + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), loop); break; } - if (!strcmp (propertyreleasestatus[loop].display, value)) + + if (! strcmp (propertyreleasestatus[loop].display, value)) { - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), loop); + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), loop); break; } } } - else if (!strcmp ("Xmp.DICOM.PatientSex", default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.DICOM.PatientSex", + default_metadata_tags[i].tag)) { - if (!strcmp ("male", value)) + if (! strcmp ("male", value)) { data = 1; } - else if (!strcmp ("female", value)) + else if (! strcmp ("female", value)) { data = 2; } - else if (!strcmp ("other", value)) + else if (! strcmp ("other", value)) { data = 3; } - gtk_combo_box_set_active (GTK_COMBO_BOX(widget), data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), data); } } } else { - if (!strcmp ("list", default_metadata_tags[i].mode)) + if (! strcmp ("list", default_metadata_tags[i].mode)) { - if (!strcmp ("Xmp.plus.Licensor", default_metadata_tags[i].tag)) + if (! strcmp ("Xmp.plus.Licensor", default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -2897,12 +3047,13 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, GtkTreeIter phoneiter; gint counter; - counter = - count_tags(metadata, (gchar*)licensor_header, - (char**)licensor, licensor_items); + counter = count_tags (metadata, licensor_header, + licensor, + G_N_ELEMENTS (licensor)); - get_tags(metadata, (gchar*)licensor_header, - (char**)&licensor, licensor_items, counter); + get_tags (metadata, licensor_header, + licensor, + G_N_ELEMENTS (licensor), counter); phonestore = gtk_list_store_new(1, G_TYPE_STRING); gtk_list_store_append (phonestore, &phoneiter); @@ -2910,160 +3061,213 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, for (int i=1; i < 6; i++) { gtk_list_store_append (phonestore, &phoneiter); - gtk_list_store_set (phonestore, &phoneiter, 0, phone_types[i].display, -1); + gtk_list_store_set (phonestore, &phoneiter, + 0, phone_types[i].display, -1); } phonemodel = GTK_TREE_MODEL (phonestore); - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); /* LICENSOR - NAME */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LICENSOR_NAME); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_LICENSOR_NAME); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (licensor_name_cell_edited_callback), treemodel); + G_CALLBACK (licensor_name_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LICENSOR_NAME)); + "column", + GINT_TO_POINTER (COL_LICENSOR_NAME)); } /* LICENSOR - ID */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LICENSOR_ID); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_LICENSOR_ID); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (licensor_id_cell_edited_callback), treemodel); + G_CALLBACK (licensor_id_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LICENSOR_ID)); + "column", + GINT_TO_POINTER (COL_LICENSOR_ID)); } /* LICENSOR - PHONE NUMBER 1 */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LICENSOR_PHONE1); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_LICENSOR_PHONE1); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (licensor_phone1_cell_edited_callback), treemodel); + G_CALLBACK (licensor_phone1_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LICENSOR_PHONE1)); + "column", + GINT_TO_POINTER (COL_LICENSOR_PHONE1)); } /* LICENSOR - PHONE TYPE 1 */ column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LICENSOR_PHONE_TYPE1); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, - "editable", TRUE, + "editable", TRUE, "text-column", 0, - "has-entry", FALSE, - "model", phonemodel, + "has-entry", FALSE, + "model", phonemodel, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (licensor_phone_type1_cell_edited_callback), widget); + G_CALLBACK (licensor_phone_type1_cell_edited_callback), + widget); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LICENSOR_PHONE_TYPE1)); + "column", + GINT_TO_POINTER (COL_LICENSOR_PHONE_TYPE1)); } /* LICENSOR - PHONE NUMBER 2 */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LICENSOR_PHONE2); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_LICENSOR_PHONE2); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (licensor_phone2_cell_edited_callback), treemodel); + G_CALLBACK (licensor_phone2_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LICENSOR_PHONE2)); + "column", + GINT_TO_POINTER (COL_LICENSOR_PHONE2)); } /* LICENSOR - PHONE TYPE 2 */ column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LICENSOR_PHONE_TYPE2); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, - "editable", TRUE, + "editable", TRUE, "text-column", 0, - "has-entry", FALSE, - "model", phonemodel, + "has-entry", FALSE, + "model", phonemodel, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (licensor_phone_type2_cell_edited_callback), widget); + G_CALLBACK (licensor_phone_type2_cell_edited_callback), + widget); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LICENSOR_PHONE_TYPE2)); + "column", + GINT_TO_POINTER (COL_LICENSOR_PHONE_TYPE2)); } /* LICENSOR - EMAIL */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LICENSOR_EMAIL); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_LICENSOR_EMAIL); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (licensor_email_cell_edited_callback), treemodel); + G_CALLBACK (licensor_email_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LICENSOR_EMAIL)); + "column", + GINT_TO_POINTER (COL_LICENSOR_EMAIL)); } /* LICENSOR - WEB ADDRESS */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LICENSOR_WEB); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_LICENSOR_WEB); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (licensor_web_cell_edited_callback), treemodel); + G_CALLBACK (licensor_web_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LICENSOR_WEB)); + "column", + GINT_TO_POINTER (COL_LICENSOR_WEB)); } if (counter > 0) { - for (int item = 0; item < counter; item++) + gint item; + + for (item = 0; item < counter; item++) { gchar type1[256]; gchar type2[256]; + gint types; - strcpy((gchar*)&type1, phone_types[0].display); - strcpy((gchar*)&type2, phone_types[0].display); + strcpy (type1, phone_types[0].display); + strcpy (type2, phone_types[0].display); - for (int types = 0; types < 6; types++) + for (types = 0; types < 6; types++) { - if (strcmp(tagdata[item][3], phone_types[types].data) == 0) + if (! strcmp (tagdata[item][3], + phone_types[types].data)) { - strcpy((gchar*)&type1, phone_types[types].display); + strcpy (type1, phone_types[types].display); } - if (strcmp(tagdata[item][5], phone_types[types].data) == 0) + + if (! strcmp (tagdata[item][5], + phone_types[types].data)) { - strcpy((gchar*)&type2, phone_types[types].display); + strcpy (type2, phone_types[types].display); } } @@ -3082,7 +3286,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -3098,7 +3304,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } } } - else if (!strcmp ("Xmp.plus.CopyrightOwner", default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.plus.CopyrightOwner", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -3109,49 +3316,64 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, GtkTreeIter iter; gint counter; - counter = - count_tags(metadata, (gchar*)copyrightowner_header, - (char**)copyrightowner, copyrightowner_items); + counter = count_tags (metadata, copyrightowner_header, + copyrightowner, + G_N_ELEMENTS (copyrightowner)); - get_tags(metadata, (gchar*)copyrightowner_header, - (char**)©rightowner, copyrightowner_items, counter); + get_tags (metadata, copyrightowner_header, + copyrightowner, + G_N_ELEMENTS (copyrightowner), counter); - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); /* COPYRIGHT OWNER - NAME */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_CR_OWNER_NAME); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_CR_OWNER_NAME); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (cr_owner_name_cell_edited_callback), treemodel); + G_CALLBACK (cr_owner_name_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_CR_OWNER_NAME)); + "column", + GINT_TO_POINTER (COL_CR_OWNER_NAME)); } /* COPYRIGHT OWNER - ID */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_CR_OWNER_ID); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_CR_OWNER_ID); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (cr_owner_id_cell_edited_callback), treemodel); + G_CALLBACK (cr_owner_id_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_CR_OWNER_ID)); + "column", + GINT_TO_POINTER (COL_CR_OWNER_ID)); } if (counter > 0) { - for (int item = 0; item < counter; item++) + gint item; + + for (item = 0; item < counter; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -3162,7 +3384,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -3172,7 +3396,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } } } - else if (!strcmp ("Xmp.plus.ImageCreator", default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.plus.ImageCreator", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -3183,49 +3408,64 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, GtkTreeIter iter; gint counter; - counter = - count_tags(metadata, (gchar*)imagecreator_header, - (char**)imagecreator, imagecreator_items); + counter = count_tags (metadata, imagecreator_header, + imagecreator, + G_N_ELEMENTS (imagecreator)); - get_tags(metadata, (gchar*)imagecreator_header, - (char**)&imagecreator, imagecreator_items, counter); + get_tags (metadata, imagecreator_header, + imagecreator, + G_N_ELEMENTS (imagecreator), counter); - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); /* IMAGE CREATOR - NAME */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_IMG_CR8_NAME); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_IMG_CR8_NAME); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (img_cr8_name_cell_edited_callback), treemodel); + G_CALLBACK (img_cr8_name_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_IMG_CR8_NAME)); + "column", + GINT_TO_POINTER (COL_IMG_CR8_NAME)); } /* IMAGE CREATOR - ID */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_IMG_CR8_ID); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_IMG_CR8_ID); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (img_cr8_id_cell_edited_callback), treemodel); + G_CALLBACK (img_cr8_id_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_IMG_CR8_ID)); + "column", + GINT_TO_POINTER (COL_IMG_CR8_ID)); } if (counter > 0) { - for (int item = 0; item < counter; item++) + gint item; + + for (item = 0; item < counter; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -3236,7 +3476,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -3246,8 +3488,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } } } - else if (!strcmp ("Xmp.iptcExt.ArtworkOrObject", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.iptcExt.ArtworkOrObject", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -3258,154 +3500,199 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, GtkTreeIter iter; gint counter; - counter = - count_tags(metadata, (gchar*)artworkorobject_header, - (char**)artworkorobject, artworkorobject_items); + counter = count_tags (metadata, artworkorobject_header, + artworkorobject, + G_N_ELEMENTS (artworkorobject)); - get_tags(metadata, (gchar*)artworkorobject_header, - (char**)&artworkorobject, artworkorobject_items, counter); + get_tags (metadata, artworkorobject_header, + artworkorobject, + G_N_ELEMENTS (artworkorobject), counter); - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); /* ARTWORK OR OBJECT - TITLE */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_AOO_TITLE); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_AOO_TITLE); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (aoo_title_cell_edited_callback), treemodel); + G_CALLBACK (aoo_title_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_AOO_TITLE)); + "column", + GINT_TO_POINTER (COL_AOO_TITLE)); } /* ARTWORK OR OBJECT - DATED CREATED */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_AOO_DATE_CREAT); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_AOO_DATE_CREAT); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (aoo_date_creat_cell_edited_callback), treemodel); + G_CALLBACK (aoo_date_creat_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_AOO_DATE_CREAT)); + "column", + GINT_TO_POINTER (COL_AOO_DATE_CREAT)); } /* ARTWORK OR OBJECT - CREATOR */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_AOO_CREATOR); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_AOO_CREATOR); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (aoo_creator_cell_edited_callback), treemodel); + G_CALLBACK (aoo_creator_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_AOO_CREATOR)); + "column", + GINT_TO_POINTER (COL_AOO_CREATOR)); } /* ARTWORK OR OBJECT - SOURCE */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_AOO_SOURCE); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_AOO_SOURCE); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (aoo_source_cell_edited_callback), treemodel); + G_CALLBACK (aoo_source_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_AOO_SOURCE)); + "column", + GINT_TO_POINTER (COL_AOO_SOURCE)); } /* ARTWORK OR OBJECT - SOURCE INVENTORY ID */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_AOO_SRC_INV_ID); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_AOO_SRC_INV_ID); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (aoo_source_inv_cell_edited_callback), treemodel); + G_CALLBACK (aoo_source_inv_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_AOO_SRC_INV_ID)); + "column", + GINT_TO_POINTER (COL_AOO_SRC_INV_ID)); } /* ARTWORK OR OBJECT - COPYRIGHT NOTICE */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_AOO_CR_NOT); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_AOO_CR_NOT); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (aoo_copyright_notice_cell_edited_callback), treemodel); + G_CALLBACK (aoo_copyright_notice_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_AOO_CR_NOT)); + "column", + GINT_TO_POINTER (COL_AOO_CR_NOT)); } if (counter > 0) { - for (int item = 0; item < counter; item++) + gint item; + + for (item = 0; item < counter; item++) { /* remove substring for language id in title field */ remove_substring (tagdata[item][4], lang_default); - if (strstr(tagdata[item][4], " ") != NULL) + if (strstr (tagdata[item][4], " ")) { remove_substring (tagdata[item][4], " "); } + remove_substring (tagdata[item][4], bag_default); - if (strstr(tagdata[item][4], " ") != NULL) + if (strstr (tagdata[item][4], " ")) { remove_substring (tagdata[item][4], " "); } + remove_substring (tagdata[item][4], seq_default); - if (strstr(tagdata[item][4], " ") != NULL) + if (strstr (tagdata[item][4], " ")) { remove_substring (tagdata[item][4], " "); } + gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, - COL_AOO_TITLE, tagdata[item][4], + COL_AOO_TITLE, tagdata[item][4], COL_AOO_DATE_CREAT, tagdata[item][0], - COL_AOO_CREATOR, tagdata[item][5], - COL_AOO_SOURCE, tagdata[item][1], + COL_AOO_CREATOR, tagdata[item][5], + COL_AOO_SOURCE, tagdata[item][1], COL_AOO_SRC_INV_ID, tagdata[item][2], - COL_AOO_CR_NOT, tagdata[item][3], + COL_AOO_CR_NOT, tagdata[item][3], -1); } } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, - COL_AOO_TITLE, NULL, + COL_AOO_TITLE, NULL, COL_AOO_DATE_CREAT, NULL, - COL_AOO_CREATOR, NULL, - COL_AOO_SOURCE, NULL, + COL_AOO_CREATOR, NULL, + COL_AOO_SOURCE, NULL, COL_AOO_SRC_INV_ID, NULL, - COL_AOO_CR_NOT, NULL, + COL_AOO_CR_NOT, NULL, -1); } } } - else if (!strcmp ("Xmp.iptcExt.RegistryId", default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.iptcExt.RegistryId", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -3416,50 +3703,64 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, GtkTreeIter iter; gint counter; - counter = - count_tags(metadata, (gchar*)registryid_header, - (char**)registryid, registryid_items); + counter = count_tags (metadata, registryid_header, + registryid, + G_N_ELEMENTS (registryid)); - get_tags(metadata, (gchar*)registryid_header, - (char**)®istryid, registryid_items, counter); + get_tags (metadata, registryid_header, + registryid, + G_N_ELEMENTS (registryid), counter); - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); /* REGISTRY - ORGANIZATION ID */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_REGSITRY_ORG_ID); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_REGSITRY_ORG_ID); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (reg_org_id_cell_edited_callback), treemodel); + G_CALLBACK (reg_org_id_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_REGSITRY_ORG_ID)); + "column", + GINT_TO_POINTER (COL_REGSITRY_ORG_ID)); } /* REGISTRY - ITEM ID */ column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_REGSITRY_ITEM_ID); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (reg_item_id_cell_edited_callback), treemodel); + G_CALLBACK (reg_item_id_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_REGSITRY_ITEM_ID)); + "column", + GINT_TO_POINTER (COL_REGSITRY_ITEM_ID)); } if (counter > 0) { - for (int item = 0; item < counter; item++) + gint item; + + for (item = 0; item < counter; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -3470,7 +3771,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -3480,8 +3783,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } } } - else if (!strcmp ("Xmp.iptcExt.LocationShown", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.iptcExt.LocationShown", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -3492,112 +3795,148 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, GtkTreeIter iter; gint counter; - counter = - count_tags(metadata, (gchar*)locationshown_header, - (char**)locationshown, locationshown_items); + counter = count_tags (metadata, locationshown_header, + locationshown, + G_N_ELEMENTS (locationshown)); - get_tags(metadata, (gchar*)locationshown_header, - (char**)&locationshown, locationshown_items, counter); + get_tags (metadata, locationshown_header, + locationshown, + G_N_ELEMENTS (locationshown), counter); - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); /* LOCATION SHOWN - SUB LOCATION */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LOC_SHO_SUB_LOC); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_LOC_SHO_SUB_LOC); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (loc_sho_sub_loc_cell_edited_callback), treemodel); + G_CALLBACK (loc_sho_sub_loc_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LOC_SHO_SUB_LOC)); + "column", + GINT_TO_POINTER (COL_LOC_SHO_SUB_LOC)); } /* LOCATION SHOWN - CITY */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LOC_SHO_CITY); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_LOC_SHO_CITY); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (loc_sho_city_cell_edited_callback), treemodel); + G_CALLBACK (loc_sho_city_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LOC_SHO_CITY)); + "column", + GINT_TO_POINTER (COL_LOC_SHO_CITY)); } /* LOCATION SHOWN - STATE PROVINCE */ column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LOC_SHO_STATE_PROV); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (loc_sho_state_prov_cell_edited_callback), treemodel); + G_CALLBACK (loc_sho_state_prov_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LOC_SHO_STATE_PROV)); + "column", + GINT_TO_POINTER (COL_LOC_SHO_STATE_PROV)); } /* LOCATION SHOWN - COUNTRY */ - column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LOC_SHO_CNTRY); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), + COL_LOC_SHO_CNTRY); + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (loc_sho_cntry_cell_edited_callback), treemodel); + G_CALLBACK (loc_sho_cntry_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LOC_SHO_CNTRY)); + "column", + GINT_TO_POINTER (COL_LOC_SHO_CNTRY)); } /* LOCATION SHOWN - COUNTRY ISO */ column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LOC_SHO_CNTRY_ISO); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (loc_sho_cntry_iso_cell_edited_callback), treemodel); + G_CALLBACK (loc_sho_cntry_iso_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LOC_SHO_CNTRY_ISO)); + "column", + GINT_TO_POINTER (COL_LOC_SHO_CNTRY_ISO)); } /* LOCATION SHOWN - WORLD REGION */ column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), COL_LOC_SHO_CNTRY_WRLD_REG); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (loc_sho_wrld_reg_cell_edited_callback), treemodel); + G_CALLBACK (loc_sho_wrld_reg_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_LOC_SHO_CNTRY_WRLD_REG)); + "column", + GINT_TO_POINTER (COL_LOC_SHO_CNTRY_WRLD_REG)); } if (counter > 0) { - for (int item = 0; item < counter; item++) + gint item; + + for (item = 0; item < counter; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -3609,6 +3948,7 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, COL_LOC_SHO_CNTRY_WRLD_REG, tagdata[item][5], -1); } + if (counter == 1) { gtk_list_store_append (liststore, &iter); @@ -3624,7 +3964,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } else { - for (int item = 0; item < 2; item++) + gint item; + + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -3638,8 +3980,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } } } - else if (!strcmp ("Xmp.iptcExt.OrganisationInImageName", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.iptcExt.OrganisationInImageName", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -3652,43 +3994,51 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, gint i_ctr; gint store_index; gchar arr[256][256]; + gint item; /* seperate list on commas */ store_index = 0; - for(i_ctr=0, str=strtok(value,",;"); str!= NULL; i_ctr++, str=strtok(NULL,",;")) + for (i_ctr = 0, str = strtok (value, ",;"); + str; + i_ctr++, str = strtok (NULL, ",;")) { /* remove leading whitespace */ - int l = strlen(str); - while(isspace(str[l - 1])) --l; - while(* str && isspace(* str)) ++str, --l; + gint l = strlen (str); + + while (isspace (str[l - 1])) --l; + while (*str && isspace (*str)) ++str, --l; /* stuff into array */ - strcpy( arr[i_ctr], str); + strcpy (arr[i_ctr], str); store_index++; } - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); - gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW ( - widget)), + gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)), GTK_SELECTION_SINGLE); column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), 0); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (organisation_image_name_cell_edited_callback), treemodel); + G_CALLBACK (organisation_image_name_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_ORG_IMG_NAME)); + "column", + GINT_TO_POINTER (COL_ORG_IMG_NAME)); } - for (int item = 0; item < 2; item++) + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -3696,8 +4046,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, -1); } } - else if (!strcmp ("Xmp.iptcExt.OrganisationInImageCode", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.iptcExt.OrganisationInImageCode", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -3706,47 +4056,55 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, GtkTreeModel *treemodel; GtkListStore *liststore; GtkTreeIter iter; - gchar *str; + gchar *str; int i_ctr; int store_index; - gchar arr[256][256]; + gchar arr[256][256]; + gint item; /* seperate list on commas */ store_index = 0; - for(i_ctr=0, str=strtok(value,",;"); str!= NULL; i_ctr++, str=strtok(NULL,",;")) + for (i_ctr = 0, str = strtok (value, ",;"); + str; + i_ctr++, str = strtok (NULL, ",;")) { /* remove leading whitespace */ - int l = strlen(str); - while(isspace(str[l - 1])) --l; - while(* str && isspace(* str)) ++str, --l; + gint l = strlen (str); + + while (isspace (str[l - 1])) --l; + while (*str && isspace (*str)) ++str, --l; /* stuff into array */ - strcpy( arr[i_ctr], str); + strcpy (arr[i_ctr], str); store_index++; } - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); - gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW ( - widget)), + gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)), GTK_SELECTION_SINGLE); column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), 0); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (organisation_image_code_cell_edited_callback), treemodel); + G_CALLBACK (organisation_image_code_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_ORG_IMG_CODE)); + "column", + GINT_TO_POINTER (COL_ORG_IMG_CODE)); } - for (int item = 0; item < 2; item++) + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -3754,8 +4112,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, -1); } } - else if (!strcmp ("Xmp.plus.PropertyReleaseID", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.plus.PropertyReleaseID", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -3764,48 +4122,55 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, GtkTreeModel *treemodel; GtkListStore *liststore; GtkTreeIter iter; - gchar *str; + gchar *str; int i_ctr; int store_index; - gchar arr[256][256]; + gchar arr[256][256]; + gint item; /* seperate list on commas */ store_index = 0; - for(i_ctr=0, str=strtok(value,",;"); str!= NULL; - i_ctr++, str=strtok(NULL,",;")) + for (i_ctr = 0, str = strtok (value, ",;"); + str; + i_ctr++, str = strtok (NULL, ",;")) { /* remove leading whitespace */ - int l = strlen(str); - while(isspace(str[l - 1])) --l; - while(* str && isspace(* str)) ++str, --l; + gint l = strlen (str); + + while (isspace (str[l - 1])) --l; + while (*str && isspace (*str)) ++str, --l; /* stuff into array */ - strcpy( arr[i_ctr], str); + strcpy (arr[i_ctr], str); store_index++; } - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); - gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW ( - widget)), + gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)), GTK_SELECTION_SINGLE); column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), 0); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (prop_rel_id_cell_edited_callback), treemodel); + G_CALLBACK (prop_rel_id_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_PROP_REL_ID)); + "column", + GINT_TO_POINTER (COL_PROP_REL_ID)); } - for (int item = 0; item < 2; item++) + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -3813,7 +4178,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, -1); } } - else if (!strcmp ("Xmp.plus.ModelReleaseID", default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.plus.ModelReleaseID", + default_metadata_tags[i].tag)) { GList *rlist; GList *r; @@ -3822,48 +4188,55 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, GtkTreeModel *treemodel; GtkListStore *liststore; GtkTreeIter iter; - gchar *str; + gchar *str; int i_ctr; int store_index; - gchar arr[256][256]; + gchar arr[256][256]; + gint item; /* seperate list on commas */ store_index = 0; - for(i_ctr=0, str=strtok(value,",;"); str!= NULL; - i_ctr++, str=strtok(NULL,",;")) + for (i_ctr = 0, str = strtok (value, ",;"); + str; + i_ctr++, str = strtok (NULL, ",;")) { /* remove leading whitespace */ - int l = strlen(str); - while(isspace(str[l - 1])) --l; - while(* str && isspace(* str)) ++str, --l; + gint l = strlen (str); + + while (isspace (str[l - 1])) --l; + while (*str && isspace (*str)) ++str, --l; /* stuff into array */ - strcpy( arr[i_ctr], str); + strcpy (arr[i_ctr], str); store_index++; } - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + liststore = GTK_LIST_STORE (treemodel); - gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW ( - widget)), + gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)), GTK_SELECTION_SINGLE); column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), 0); - rlist = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column)); - for (r = rlist; r != NULL; r = r->next) + rlist = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + for (r = rlist; r; r = r->next) { - renderer = (GtkCellRenderer*) r->data; + renderer = r->data; + g_object_set (renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, "edited", - G_CALLBACK (mod_rel_id_cell_edited_callback), treemodel); + G_CALLBACK (mod_rel_id_cell_edited_callback), + treemodel); + g_object_set_data (G_OBJECT (renderer), - "column", GINT_TO_POINTER (COL_PROP_REL_ID)); + "column", + GINT_TO_POINTER (COL_PROP_REL_ID)); } - for (int item = 0; item < 2; item++) + for (item = 0; item < 2; item++) { gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, @@ -3876,36 +4249,32 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata, } /* Set creation date */ - entry_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "create_date_button")); - g_signal_connect(entry_widget, "clicked", - G_CALLBACK (on_create_date_button_clicked), - GTK_WIDGET (gtk_builder_get_object (builder, - "Xmp.photoshop.DateCreated"))); + entry_widget = builder_get_widget (builder, "create_date_button"); + g_signal_connect (entry_widget, "clicked", + G_CALLBACK (on_create_date_button_clicked), + builder_get_widget (builder, + "Xmp.photoshop.DateCreated")); /* Set patient dob date */ - entry_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "dob_date_button")); - g_signal_connect(entry_widget, "clicked", - G_CALLBACK (on_patient_dob_date_button_clicked), - GTK_WIDGET (gtk_builder_get_object (builder, - "Xmp.DICOM.PatientDOB"))); + entry_widget = builder_get_widget (builder, "dob_date_button"); + g_signal_connect (entry_widget, "clicked", + G_CALLBACK (on_patient_dob_date_button_clicked), + builder_get_widget (builder, + "Xmp.DICOM.PatientDOB")); /* Set study date */ - entry_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "study_date_button")); - g_signal_connect(entry_widget, "clicked", - G_CALLBACK (on_study_date_button_clicked), - GTK_WIDGET (gtk_builder_get_object (builder, - "Xmp.DICOM.StudyDateTime"))); + entry_widget = builder_get_widget (builder, "study_date_button"); + g_signal_connect (entry_widget, "clicked", + G_CALLBACK (on_study_date_button_clicked), + builder_get_widget (builder, + "Xmp.DICOM.StudyDateTime")); /* Set series date */ - entry_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "series_date_button")); - g_signal_connect(entry_widget, "clicked", - G_CALLBACK (on_series_date_button_clicked), - GTK_WIDGET (gtk_builder_get_object (builder, - "Xmp.DICOM.SeriesDateTime"))); + entry_widget = builder_get_widget (builder, "series_date_button"); + g_signal_connect (entry_widget, "clicked", + G_CALLBACK (on_series_date_button_clicked), + builder_get_widget (builder, + "Xmp.DICOM.SeriesDateTime")); } /* ============================================================================ @@ -3922,7 +4291,6 @@ metadata_editor_write_callback (GtkWidget *dialog, gint max_elements; gint i; GtkWidget *list_widget; - GtkListStore *liststore; GtkTreeIter iter; GtkTreeModel *treemodel; gchar *rc_data; @@ -3930,6 +4298,7 @@ metadata_editor_write_callback (GtkWidget *dialog, gchar output_data[256 * 1024]; gchar tag[1024]; gint counter; + gint row; i = 0; @@ -3939,29 +4308,26 @@ metadata_editor_write_callback (GtkWidget *dialog, /* DO ORG IMG NAME (LISTSTORE) */ - list_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - "Xmp.iptcExt.OrganisationInImageName")); + list_widget = builder_get_widget (builder, + "Xmp.iptcExt.OrganisationInImageName"); - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)list_widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (list_widget)); - number_of_rows = - gtk_tree_model_iter_n_children(GTK_TREE_MODEL(liststore), NULL); + number_of_rows = gtk_tree_model_iter_n_children (treemodel, NULL); output_data[0] = 0; - for (gint row = 0; row < number_of_rows; row++) + for (row = 0; row < number_of_rows; row++) { - if (gtk_tree_model_iter_nth_child(treemodel, &iter, NULL, row)) + if (gtk_tree_model_iter_nth_child (treemodel, &iter, NULL, row)) { gtk_tree_model_get (treemodel, &iter, COL_ORG_IMG_NAME, &rc_data, -1); - if (rc_data && strlen(rc_data) > 0) + if (rc_data && *rc_data) { - strcat((gchar*)&output_data, rc_data); + strcat (output_data, rc_data); if (row + 1 < number_of_rows) - strcat((gchar*)&output_data, ", "); + strcat (output_data, ", "); } } } @@ -3969,38 +4335,35 @@ metadata_editor_write_callback (GtkWidget *dialog, gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), "Xmp.iptcExt.OrganisationInImageName"); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - "Xmp.iptcExt.OrganisationInImageName", - (gchar*)&output_data)) + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + "Xmp.iptcExt.OrganisationInImageName", + output_data)) { g_printerr("failed to set tag [Xmp.iptcExt.OrganisationInImageName]\n"); } /* DO ORG IMG CODE (LISTSTORE) */ - list_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - "Xmp.iptcExt.OrganisationInImageCode")); + list_widget = builder_get_widget (builder, + "Xmp.iptcExt.OrganisationInImageCode"); - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)list_widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (list_widget)); - number_of_rows = - gtk_tree_model_iter_n_children(GTK_TREE_MODEL(liststore), NULL); + number_of_rows = gtk_tree_model_iter_n_children (treemodel, NULL); output_data[0] = 0; - for (gint row = 0; row < number_of_rows; row++) + for (row = 0; row < number_of_rows; row++) { - if (gtk_tree_model_iter_nth_child(treemodel, &iter, NULL, row)) + if (gtk_tree_model_iter_nth_child (treemodel, &iter, NULL, row)) { gtk_tree_model_get (treemodel, &iter, COL_ORG_IMG_CODE, &rc_data, -1); - if (rc_data && strlen(rc_data) > 0) + if (rc_data && *rc_data) { - strcat((gchar*)&output_data, rc_data); + strcat (output_data, rc_data); if (row + 1 < number_of_rows) - strcat((gchar*)&output_data, ", "); + strcat (output_data, ", "); } } } @@ -4008,37 +4371,34 @@ metadata_editor_write_callback (GtkWidget *dialog, gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), "Xmp.iptcExt.OrganisationInImageCode"); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - "Xmp.iptcExt.OrganisationInImageCode", - (gchar*)&output_data)) + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + "Xmp.iptcExt.OrganisationInImageCode", + output_data)) { - g_printerr("failed to set tag [Xmp.iptcExt.OrganisationInImageCode]\n"); + g_printerr ("failed to set tag [Xmp.iptcExt.OrganisationInImageCode]\n"); } /* DO MODEL RELEASE (LISTSTORE) */ - list_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "Xmp.plus.ModelReleaseID")); + list_widget = builder_get_widget (builder, "Xmp.plus.ModelReleaseID"); - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)list_widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (list_widget)); - number_of_rows = - gtk_tree_model_iter_n_children(GTK_TREE_MODEL(liststore), NULL); + number_of_rows = gtk_tree_model_iter_n_children (treemodel, NULL); output_data[0] = 0; - for (gint row = 0; row < number_of_rows; row++) + for (row = 0; row < number_of_rows; row++) { - if (gtk_tree_model_iter_nth_child(treemodel, &iter, NULL, row)) + if (gtk_tree_model_iter_nth_child (treemodel, &iter, NULL, row)) { gtk_tree_model_get (treemodel, &iter, COL_MOD_REL_ID, &rc_data, -1); - if (rc_data && strlen(rc_data) > 0) + if (rc_data && *rc_data) { - strcat((gchar*)&output_data, rc_data); + strcat (output_data, rc_data); if (row + 1 < number_of_rows) - strcat((gchar*)&output_data, ", "); + strcat (output_data, ", "); } } } @@ -4046,37 +4406,34 @@ metadata_editor_write_callback (GtkWidget *dialog, gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), "Xmp.plus.ModelReleaseID"); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - "Xmp.plus.ModelReleaseID", - (gchar*)&output_data)) + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + "Xmp.plus.ModelReleaseID", + output_data)) { - g_printerr("failed to set tag [Xmp.plus.ModelReleaseID]\n"); + g_printerr ("failed to set tag [Xmp.plus.ModelReleaseID]\n"); } /* DO PROPERTY RELEASE (LISTSTORE) */ - list_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "Xmp.plus.PropertyReleaseID")); + list_widget = builder_get_widget (builder, "Xmp.plus.PropertyReleaseID"); - liststore = GTK_LIST_STORE(gtk_tree_view_get_model((GtkTreeView *)list_widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (list_widget)); - number_of_rows = - gtk_tree_model_iter_n_children(GTK_TREE_MODEL(liststore), NULL); + number_of_rows = gtk_tree_model_iter_n_children (treemodel, NULL); output_data[0] = 0; - for (gint row = 0; row < number_of_rows; row++) + for (row = 0; row < number_of_rows; row++) { - if (gtk_tree_model_iter_nth_child(treemodel, &iter, NULL, row)) + if (gtk_tree_model_iter_nth_child (treemodel, &iter, NULL, row)) { gtk_tree_model_get (treemodel, &iter, COL_PROP_REL_ID, &rc_data, -1); - if (rc_data && strlen(rc_data) > 0) + if (rc_data && *rc_data) { - strcat((gchar*)&output_data, rc_data); + strcat (output_data, rc_data); if (row + 1 < number_of_rows) - strcat((gchar*)&output_data, ", "); + strcat (output_data, ", "); } } } @@ -4084,24 +4441,20 @@ metadata_editor_write_callback (GtkWidget *dialog, gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), "Xmp.plus.PropertyReleaseID"); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - "Xmp.plus.PropertyReleaseID", - (gchar*)&output_data)) + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + "Xmp.plus.PropertyReleaseID", + output_data)) { - g_printerr("failed to set tag [Xmp.plus.PropertyReleaseID]\n"); + g_printerr ("failed to set tag [Xmp.plus.PropertyReleaseID]\n"); } /* DO LOCATION SHOWN (LISTSTORE) */ - list_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "Xmp.iptcExt.LocationShown")); + list_widget = builder_get_widget (builder, "Xmp.iptcExt.LocationShown"); - liststore = GTK_LIST_STORE (gtk_tree_view_get_model((GtkTreeView *) - list_widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (list_widget)); - number_of_rows = - gtk_tree_model_iter_n_children (GTK_TREE_MODEL(liststore), NULL); + number_of_rows = gtk_tree_model_iter_n_children (treemodel, NULL); /* CLEAR LOCATION SHOW DATA */ @@ -4109,128 +4462,118 @@ metadata_editor_write_callback (GtkWidget *dialog, locationshown_header); output_data[0] = 0; - for (gint row = 0; row < 256; row++) + for (row = 0; row < 256; row++) { - for (int item = 0; item < locationshown_items; item++) + gint item; + + for (item = 0; item < G_N_ELEMENTS (locationshown); item++) { - g_sprintf((gchar*)&tag, "%s[%d]%s", - locationshown_header, row, locationshown[item]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + locationshown_header, row, locationshown[item]); + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); } } /* SET LOCATION SHOW DATA */ - gexiv2_metadata_set_xmp_tag_struct(GEXIV2_METADATA (g_metadata), - "Xmp.iptcExt.LocationShown", - GEXIV2_STRUCTURE_XA_BAG); + gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (g_metadata), + "Xmp.iptcExt.LocationShown", + GEXIV2_STRUCTURE_XA_BAG); counter = 1; - for (gint row = 0; row < number_of_rows; row++) + for (row = 0; row < number_of_rows; row++) { - if (gtk_tree_model_iter_nth_child(treemodel, &iter, NULL, row)) + if (gtk_tree_model_iter_nth_child (treemodel, &iter, NULL, row)) { gchar *tag_data; + gtk_tree_model_get (treemodel, &iter, - COL_LOC_SHO_SUB_LOC, - &tag_data, + COL_LOC_SHO_SUB_LOC, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - locationshown_header, counter, locationshown[0]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + locationshown_header, counter, locationshown[0]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_LOC_SHO_CITY, - &tag_data, + COL_LOC_SHO_CITY, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - locationshown_header, counter, locationshown[1]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + locationshown_header, counter, locationshown[1]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_LOC_SHO_STATE_PROV, - &tag_data, + COL_LOC_SHO_STATE_PROV, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - locationshown_header, counter, locationshown[2]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + locationshown_header, counter, locationshown[2]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_LOC_SHO_CNTRY, - &tag_data, + COL_LOC_SHO_CNTRY, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - locationshown_header, counter, locationshown[3]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + locationshown_header, counter, locationshown[3]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_LOC_SHO_CNTRY_ISO, - &tag_data, + COL_LOC_SHO_CNTRY_ISO, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - locationshown_header, counter, locationshown[4]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + locationshown_header, counter, locationshown[4]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_LOC_SHO_CNTRY_WRLD_REG, - &tag_data, + COL_LOC_SHO_CNTRY_WRLD_REG, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - locationshown_header, counter, locationshown[5]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + locationshown_header, counter, locationshown[5]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } counter++; @@ -4239,15 +4582,11 @@ metadata_editor_write_callback (GtkWidget *dialog, /* DO ARTWORK OR OBJECT (LISTSTORE) */ - list_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "Xmp.iptcExt.ArtworkOrObject")); + list_widget = builder_get_widget (builder, "Xmp.iptcExt.ArtworkOrObject"); - liststore = GTK_LIST_STORE (gtk_tree_view_get_model((GtkTreeView *) - list_widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (list_widget)); - number_of_rows = - gtk_tree_model_iter_n_children (GTK_TREE_MODEL(liststore), NULL); + number_of_rows = gtk_tree_model_iter_n_children (treemodel, NULL); /* CLEAR ARTWORK OR OBJECT DATA */ @@ -4255,129 +4594,120 @@ metadata_editor_write_callback (GtkWidget *dialog, artworkorobject_header); output_data[0] = 0; - for (gint row = 0; row < 256; row++) + for (row = 0; row < 256; row++) { - for (int item = 0; item < artworkorobject_items; item++) + gint item; + + for (item = 0; item < G_N_ELEMENTS (artworkorobject); item++) { - g_sprintf((gchar*)&tag, "%s[%d]%s", - artworkorobject_header, row, artworkorobject[item]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + artworkorobject_header, row, artworkorobject[item]); + + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); } } /* SET ARTWORK OR OBJECT DATA */ - gexiv2_metadata_set_xmp_tag_struct(GEXIV2_METADATA (g_metadata), - "Xmp.iptcExt.ArtworkOrObject", - GEXIV2_STRUCTURE_XA_BAG); + gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (g_metadata), + "Xmp.iptcExt.ArtworkOrObject", + GEXIV2_STRUCTURE_XA_BAG); counter = 1; - for (gint row = 0; row < number_of_rows; row++) + for (row = 0; row < number_of_rows; row++) { - if (gtk_tree_model_iter_nth_child(treemodel, &iter, NULL, row)) + if (gtk_tree_model_iter_nth_child (treemodel, &iter, NULL, row)) { gchar *tag_data; + gtk_tree_model_get (treemodel, &iter, - COL_AOO_TITLE, - &tag_data, + COL_AOO_TITLE, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - artworkorobject_header, counter, artworkorobject[0]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + artworkorobject_header, counter, artworkorobject[0]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_AOO_DATE_CREAT, - &tag_data, + COL_AOO_DATE_CREAT, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - artworkorobject_header, counter, artworkorobject[1]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + artworkorobject_header, counter, artworkorobject[1]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_AOO_CREATOR, - &tag_data, + COL_AOO_CREATOR, &tag_data, -1); g_sprintf((gchar*)&tag, "%s[%d]%s", artworkorobject_header, counter, artworkorobject[2]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_AOO_SOURCE, - &tag_data, + COL_AOO_SOURCE, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - artworkorobject_header, counter, artworkorobject[3]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + artworkorobject_header, counter, artworkorobject[3]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_AOO_SRC_INV_ID, - &tag_data, + COL_AOO_SRC_INV_ID, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - artworkorobject_header, counter, artworkorobject[4]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + artworkorobject_header, counter, artworkorobject[4]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_AOO_CR_NOT, - &tag_data, + COL_AOO_CR_NOT, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - artworkorobject_header, counter, artworkorobject[5]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + artworkorobject_header, counter, artworkorobject[5]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } counter++; @@ -4386,15 +4716,11 @@ metadata_editor_write_callback (GtkWidget *dialog, /* DO REGISTRY ID (LISTSTORE) */ - list_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "Xmp.iptcExt.RegistryId")); + list_widget = builder_get_widget (builder, "Xmp.iptcExt.RegistryId"); - liststore = GTK_LIST_STORE (gtk_tree_view_get_model((GtkTreeView *) - list_widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (list_widget)); - number_of_rows = - gtk_tree_model_iter_n_children (GTK_TREE_MODEL(liststore), NULL); + number_of_rows = gtk_tree_model_iter_n_children (treemodel, NULL); /* CLEAR REGISTRY ID DATA */ @@ -4402,61 +4728,60 @@ metadata_editor_write_callback (GtkWidget *dialog, registryid_header); output_data[0] = 0; - for (gint row = 0; row < 256; row++) + for (row = 0; row < 256; row++) { - for (int item = 0; item < registryid_items; item++) + gint item; + + for (item = 0; item < G_N_ELEMENTS (registryid); item++) { - g_sprintf((gchar*)&tag, "%s[%d]%s", - registryid_header, row, registryid[item]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + registryid_header, row, registryid[item]); + + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); } } /* SET REGISTRY ID DATA */ - gexiv2_metadata_set_xmp_tag_struct(GEXIV2_METADATA (g_metadata), - "Xmp.iptcExt.RegistryId", - GEXIV2_STRUCTURE_XA_BAG); + gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (g_metadata), + "Xmp.iptcExt.RegistryId", + GEXIV2_STRUCTURE_XA_BAG); counter = 1; - for (gint row = 0; row < number_of_rows; row++) + for (row = 0; row < number_of_rows; row++) { - if (gtk_tree_model_iter_nth_child(treemodel, &iter, NULL, row)) + if (gtk_tree_model_iter_nth_child (treemodel, &iter, NULL, row)) { gchar *tag_data; + gtk_tree_model_get (treemodel, &iter, - COL_REGSITRY_ORG_ID, - &tag_data, + COL_REGSITRY_ORG_ID, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - registryid_header, counter, registryid[0]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + registryid_header, counter, registryid[0]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_REGSITRY_ITEM_ID, - &tag_data, + COL_REGSITRY_ITEM_ID, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - registryid_header, counter, registryid[1]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + registryid_header, counter, registryid[1]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } counter++; @@ -4465,15 +4790,11 @@ metadata_editor_write_callback (GtkWidget *dialog, /* DO IMAGE CREATOR (LISTSTORE) */ - list_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "Xmp.plus.ImageCreator")); + list_widget = builder_get_widget (builder, "Xmp.plus.ImageCreator"); - liststore = GTK_LIST_STORE (gtk_tree_view_get_model((GtkTreeView *) - list_widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (list_widget)); - number_of_rows = - gtk_tree_model_iter_n_children (GTK_TREE_MODEL(liststore), NULL); + number_of_rows = gtk_tree_model_iter_n_children (treemodel, NULL); /* CLEAR IMAGE CREATOR DATA */ @@ -4481,61 +4802,60 @@ metadata_editor_write_callback (GtkWidget *dialog, imagecreator_header); output_data[0] = 0; - for (gint row = 0; row < 256; row++) + for (row = 0; row < 256; row++) { - for (int item = 0; item < imagecreator_items; item++) + gint item; + + for (item = 0; item < G_N_ELEMENTS (imagecreator); item++) { - g_sprintf((gchar*)&tag, "%s[%d]%s", - imagecreator_header, row, imagecreator[item]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + imagecreator_header, row, imagecreator[item]); + + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); } } /* SET IMAGE CREATOR DATA */ - gexiv2_metadata_set_xmp_tag_struct(GEXIV2_METADATA (g_metadata), - "Xmp.plus.ImageCreator", - GEXIV2_STRUCTURE_XA_SEQ); + gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (g_metadata), + "Xmp.plus.ImageCreator", + GEXIV2_STRUCTURE_XA_SEQ); counter = 1; - for (gint row = 0; row < number_of_rows; row++) + for (row = 0; row < number_of_rows; row++) { - if (gtk_tree_model_iter_nth_child(treemodel, &iter, NULL, row)) + if (gtk_tree_model_iter_nth_child (treemodel, &iter, NULL, row)) { gchar *tag_data; + gtk_tree_model_get (treemodel, &iter, - COL_IMG_CR8_NAME, - &tag_data, + COL_IMG_CR8_NAME, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - imagecreator_header, counter, imagecreator[0]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + imagecreator_header, counter, imagecreator[0]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_IMG_CR8_ID, - &tag_data, + COL_IMG_CR8_ID, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - imagecreator_header, counter, imagecreator[1]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + imagecreator_header, counter, imagecreator[1]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } counter++; @@ -4544,15 +4864,11 @@ metadata_editor_write_callback (GtkWidget *dialog, /* DO COPYRIGHT OWNER (LISTSTORE) */ - list_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "Xmp.plus.CopyrightOwner")); + list_widget = builder_get_widget (builder, "Xmp.plus.CopyrightOwner"); - liststore = GTK_LIST_STORE (gtk_tree_view_get_model((GtkTreeView *) - list_widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (list_widget)); - number_of_rows = - gtk_tree_model_iter_n_children (GTK_TREE_MODEL(liststore), NULL); + number_of_rows = gtk_tree_model_iter_n_children (treemodel, NULL); /* CLEAR COPYRIGHT OWNER DATA */ @@ -4560,61 +4876,60 @@ metadata_editor_write_callback (GtkWidget *dialog, copyrightowner_header); output_data[0] = 0; - for (gint row = 0; row < 256; row++) + for (row = 0; row < 256; row++) { - for (int item = 0; item < copyrightowner_items; item++) + gint item; + + for (item = 0; item < G_N_ELEMENTS (copyrightowner); item++) { - g_sprintf((gchar*)&tag, "%s[%d]%s", - copyrightowner_header, row, copyrightowner[item]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + copyrightowner_header, row, copyrightowner[item]); + + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); } } /* SET COPYRIGHT OWNER DATA */ - gexiv2_metadata_set_xmp_tag_struct(GEXIV2_METADATA (g_metadata), - "Xmp.plus.CopyrightOwner", - GEXIV2_STRUCTURE_XA_SEQ); + gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (g_metadata), + "Xmp.plus.CopyrightOwner", + GEXIV2_STRUCTURE_XA_SEQ); counter = 1; - for (gint row = 0; row < number_of_rows; row++) + for (row = 0; row < number_of_rows; row++) { - if (gtk_tree_model_iter_nth_child(treemodel, &iter, NULL, row)) + if (gtk_tree_model_iter_nth_child (treemodel, &iter, NULL, row)) { gchar *tag_data; + gtk_tree_model_get (treemodel, &iter, - COL_CR_OWNER_NAME, - &tag_data, + COL_CR_OWNER_NAME, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - copyrightowner_header, counter, copyrightowner[0]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + copyrightowner_header, counter, copyrightowner[0]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_CR_OWNER_ID, - &tag_data, + COL_CR_OWNER_ID, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - copyrightowner_header, counter, copyrightowner[1]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + copyrightowner_header, counter, copyrightowner[1]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } counter++; @@ -4623,15 +4938,11 @@ metadata_editor_write_callback (GtkWidget *dialog, /* DO LICENSOR (LISTSTORE) */ - list_widget = - GTK_WIDGET (gtk_builder_get_object (builder, "Xmp.plus.Licensor")); + list_widget = builder_get_widget (builder, "Xmp.plus.Licensor"); - liststore = GTK_LIST_STORE (gtk_tree_view_get_model((GtkTreeView *) - list_widget)); - treemodel = GTK_TREE_MODEL (liststore); + treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (list_widget)); - number_of_rows = - gtk_tree_model_iter_n_children (GTK_TREE_MODEL(liststore), NULL); + number_of_rows = gtk_tree_model_iter_n_children (treemodel, NULL); /* CLEAR LICENSOR DATA */ @@ -4639,188 +4950,175 @@ metadata_editor_write_callback (GtkWidget *dialog, licensor_header); output_data[0] = 0; - for (gint row = 0; row < 256; row++) + for (row = 0; row < 256; row++) { - for (int item = 0; item < licensor_items; item++) + gint item; + + for (item = 0; item < G_N_ELEMENTS (licensor); item++) { - g_sprintf((gchar*)&tag, "%s[%d]%s", - licensor_header, row, licensor[item]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + licensor_header, row, licensor[item]); + + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); } } /* SET LICENSOR DATA */ - gexiv2_metadata_set_xmp_tag_struct(GEXIV2_METADATA (g_metadata), - "Xmp.plus.Licensor", - GEXIV2_STRUCTURE_XA_SEQ); + gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (g_metadata), + "Xmp.plus.Licensor", + GEXIV2_STRUCTURE_XA_SEQ); counter = 1; - for (gint row = 0; row < number_of_rows; row++) + for (row = 0; row < number_of_rows; row++) { - if (gtk_tree_model_iter_nth_child(treemodel, &iter, NULL, row)) + if (gtk_tree_model_iter_nth_child (treemodel, &iter, NULL, row)) { gchar *tag_data; - gchar type1[256]; - gchar type2[256]; + gchar type1[256]; + gchar type2[256]; + gint types; gtk_tree_model_get (treemodel, &iter, - COL_LICENSOR_NAME, - &tag_data, + COL_LICENSOR_NAME, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - licensor_header, counter, licensor[0]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + licensor_header, counter, licensor[0]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_LICENSOR_ID, - &tag_data, + COL_LICENSOR_ID, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - licensor_header, counter, licensor[1]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + licensor_header, counter, licensor[1]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_LICENSOR_PHONE1, - &tag_data, + COL_LICENSOR_PHONE1, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - licensor_header, counter, licensor[2]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + licensor_header, counter, licensor[2]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_LICENSOR_PHONE_TYPE1, - &tag_data, + COL_LICENSOR_PHONE_TYPE1, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - licensor_header, counter, licensor[3]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + licensor_header, counter, licensor[3]); - strcpy((gchar*)&type1, phone_types[0].data); - for (gint types = 0; types < 6; types++) + strcpy (type1, phone_types[0].data); + + for (types = 0; types < 6; types++) { - if (strcmp(tag_data, phone_types[types].display) == 0) + if (! strcmp (tag_data, phone_types[types].display)) { - strcpy((gchar*)&type1, phone_types[types].data); + strcpy (type1, phone_types[types].data); break; } } - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - (gchar*)&type1)) + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, type1)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_LICENSOR_PHONE2, - &tag_data, + COL_LICENSOR_PHONE2, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - licensor_header, counter, licensor[4]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + licensor_header, counter, licensor[4]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_LICENSOR_PHONE_TYPE2, - &tag_data, + COL_LICENSOR_PHONE_TYPE2, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - licensor_header, counter, licensor[5]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + licensor_header, counter, licensor[5]); - strcpy((gchar*)&type2, phone_types[0].data); - for (gint types = 0; types < 6; types++) + strcpy (type2, phone_types[0].data); + + for (types = 0; types < 6; types++) { - if (strcmp(tag_data, phone_types[types].display) == 0) + if (! strcmp (tag_data, phone_types[types].display)) { - strcpy((gchar*)&type2, phone_types[types].data); + strcpy (type2, phone_types[types].data); break; } } - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - (gchar*)&type2)) + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, type2)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_LICENSOR_EMAIL, - &tag_data, + COL_LICENSOR_EMAIL, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - licensor_header, counter, licensor[6]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + licensor_header, counter, licensor[6]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } gtk_tree_model_get (treemodel, &iter, - COL_LICENSOR_WEB, - &tag_data, + COL_LICENSOR_WEB, &tag_data, -1); - g_sprintf((gchar*)&tag, "%s[%d]%s", - licensor_header, counter, licensor[7]); + g_snprintf (tag, sizeof (tag), "%s[%d]%s", + licensor_header, counter, licensor[7]); - gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - (gchar*)&tag); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - (gchar*)&tag, - tag_data)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), tag); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + tag, tag_data)) { - g_printerr("failed to set tag [%s]\n", (gchar*)&tag); + g_printerr ("failed to set tag [%s]\n", tag); } counter++; @@ -4829,19 +5127,20 @@ metadata_editor_write_callback (GtkWidget *dialog, /* DO CREATOR TAGS */ - if (hasCreatorTagData(builder)) + if (hasCreatorTagData (builder)) { - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - creatorContactInfoHeader.header, - "type=\"Struct\"")) + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + creatorContactInfoHeader.header, + "type=\"Struct\"")) { - g_printerr("failed to set tag [%s]\n", creatorContactInfoTags[i].tag); + g_printerr ("failed to set tag [%s]\n", + creatorContactInfoTags[i].tag); } for (i = 0; i < creatorContactInfoHeader.size; i++) { GObject *object = gtk_builder_get_object (builder, - creatorContactInfoTags[i].id); + creatorContactInfoTags[i].id); if (! strcmp ("single", creatorContactInfoTags[i].mode)) { @@ -4851,10 +5150,11 @@ metadata_editor_write_callback (GtkWidget *dialog, creatorContactInfoTags[i].tag, gtk_entry_get_text (entry))) { - g_printerr("failed to set tag [%s]\n", creatorContactInfoTags[i].tag); + g_printerr ("failed to set tag [%s]\n", + creatorContactInfoTags[i].tag); } } - else if (!strcmp ("multi", default_metadata_tags[i].mode)) + else if (! strcmp ("multi", default_metadata_tags[i].mode)) { GtkTextView *text_view = GTK_TEXT_VIEW (object); GtkTextBuffer *buffer; @@ -4868,15 +5168,15 @@ metadata_editor_write_callback (GtkWidget *dialog, text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - creatorContactInfoTags[i].tag, - text)) + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + creatorContactInfoTags[i].tag, + text)) { - g_printerr("failed to set tag [%s]\n", creatorContactInfoTags[i].tag); + g_printerr ("failed to set tag [%s]\n", + creatorContactInfoTags[i].tag); } - if (text) - g_free (text); + g_free (text); } } } @@ -4887,6 +5187,7 @@ metadata_editor_write_callback (GtkWidget *dialog, { gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), creatorContactInfoHeader.header); + for (i = 0; i < creatorContactInfoHeader.size; i++) { gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), @@ -4899,100 +5200,105 @@ metadata_editor_write_callback (GtkWidget *dialog, for (i = 0; i < max_elements; i++) { GObject *object = gtk_builder_get_object (builder, - default_metadata_tags[i].tag); + default_metadata_tags[i].tag); /* SINGLE TAGS */ if (! strcmp ("single", default_metadata_tags[i].mode)) { - GtkEntry *entry = GTK_ENTRY (object); - gchar *value_entry = g_strdup(gtk_entry_get_text (entry)); + GtkEntry *entry = GTK_ENTRY (object); + gchar *value_entry = g_strdup (gtk_entry_get_text (entry)); - if (!strcmp ("Exif.GPSInfo.GPSLongitude", default_metadata_tags[i].tag)) + if (! strcmp ("Exif.GPSInfo.GPSLongitude", + default_metadata_tags[i].tag)) { const gchar delimiters_dms[] = " deg'\""; - gchar *s = g_strdup(value_entry); + gchar *s = g_strdup (value_entry); gchar lng[256]; gchar *str1; gchar *str2; gchar *str3; - if (strstr(s, ".")) - { - double degs; - int deg; - int min; - int sec; - degs = atof(s); - if (degs < 0) degs *= -1; - deg = (int)degs; - min = (int)((degs - deg) * 60.f); - sec = (int)((degs - (float)deg - (float)(min / 60.f)) * 60.f * 60.f); - str1 = (gchar*) malloc(256); - str2 = (gchar*) malloc(256); - str3 = (gchar*) malloc(256); - g_sprintf(str1, "%d", deg); - g_sprintf(str2, "%d", min); - g_sprintf(str3, "%d", sec); + if (strstr (s, ".")) + { + gdouble degs; + gint deg; + gint min; + gint sec; + + degs = atof (s); + if (degs < 0) + degs *= -1; + deg = (gint) degs; + min = (gint) ((degs - deg) * 60.f); + sec = (gint) ((degs - (float) deg - (float) (min / 60.f)) * 60.f * 60.f); + str1 = malloc (256); + str2 = malloc (256); + str3 = malloc (256); + g_sprintf (str1, "%d", deg); + g_sprintf (str2, "%d", min); + g_sprintf (str3, "%d", sec); } else { - str1 = strtok(s, delimiters_dms); - str2 = strtok(NULL, delimiters_dms); - str3 = strtok(NULL, delimiters_dms); + str1 = strtok (s, delimiters_dms); + str2 = strtok (NULL, delimiters_dms); + str3 = strtok (NULL, delimiters_dms); } - if (str1 != NULL) + if (str1) { - strcpy((gchar*)&lng, str1); - strcat((gchar*)&lng, "/1"); + strcpy (lng, str1); + strcat (lng, "/1"); } else { - strcpy((gchar*)&lng, "0/1"); + strcpy (lng, "0/1"); } - if (str2 != NULL) + if (str2) { - strcat((gchar*)&lng, " "); - strcat((gchar*)&lng, str2); - strcat((gchar*)&lng, "/1"); + strcat (lng, " "); + strcat (lng, str2); + strcat (lng, "/1"); } else { - strcat((gchar*)&lng, " "); - strcat((gchar*)&lng, "0/1"); + strcat (lng, " "); + strcat (lng, "0/1"); } - if (str3 != NULL) + if (str3) { - strcat((gchar*)&lng, " "); - strcat((gchar*)&lng, str3); - strcat((gchar*)&lng, "/1"); + strcat (lng, " "); + strcat (lng, str3); + strcat (lng, "/1"); } else { - strcat((gchar*)&lng, " "); - strcat((gchar*)&lng, "0/1"); + strcat (lng, " "); + strcat (lng, "0/1"); } - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - lng)) + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + lng)) { - g_printerr("failed to set tag [%s]\n", default_metadata_tags[i].tag); + g_printerr ("failed to set tag [%s]\n", + default_metadata_tags[i].tag); } - if (strstr(s, ".")) + if (strstr (s, ".")) { - free(str1); - free(str2); - free(str3); + free (str1); + free (str2); + free (str3); } - free(s); + free (s); } - else if (!strcmp ("Exif.GPSInfo.GPSLatitude", default_metadata_tags[i].tag)) + else if (! strcmp ("Exif.GPSInfo.GPSLatitude", + default_metadata_tags[i].tag)) { const gchar delimiters_dms[] = " deg'\""; gchar *s = g_strdup(value_entry); @@ -5001,144 +5307,153 @@ metadata_editor_write_callback (GtkWidget *dialog, gchar *str2; gchar *str3; - if (strstr(s, ".")) + if (strstr (s, ".")) { - double degs; - int deg; - int min; - int sec; + gdouble degs; + gint deg; + gint min; + gint sec; - degs = atof(s); - if (degs < 0) degs *= -1; - deg = (int)(degs); - min = (int)((degs - deg) * 60.f); - sec = (int)((degs - (float)deg - (float)(min / 60.f)) * 60.f * 60.f); - str1 = (gchar*) malloc(256); - str2 = (gchar*) malloc(256); - str3 = (gchar*) malloc(256); - g_sprintf(str1, "%d", deg); - g_sprintf(str2, "%d", min); - g_sprintf(str3, "%d", sec); + degs = atof (s); + if (degs < 0) + degs *= -1; + deg = (gint) (degs); + min = (gint) ((degs - deg) * 60.f); + sec = (gint) ((degs - (float) deg - (float) (min / 60.f)) * 60.f * 60.f); + str1 = malloc (256); + str2 = malloc (256); + str3 = malloc (256); + g_sprintf (str1, "%d", deg); + g_sprintf (str2, "%d", min); + g_sprintf (str3, "%d", sec); } else { - str1 = strtok(s, delimiters_dms); - str2 = strtok(NULL, delimiters_dms); - str3 = strtok(NULL, delimiters_dms); + str1 = strtok (s, delimiters_dms); + str2 = strtok (NULL, delimiters_dms); + str3 = strtok (NULL, delimiters_dms); } - if (str1 != NULL) + if (str1) { - strcpy((gchar*)&lat, str1); - strcat((gchar*)&lat, "/1"); + strcpy (lat, str1); + strcat (lat, "/1"); } else { - strcpy((gchar*)&lat, "0/1"); + strcpy (lat, "0/1"); } - if (str2 != NULL) + if (str2) { - strcat((gchar*)&lat, " "); - strcat((gchar*)&lat, str2); - strcat((gchar*)&lat, "/1"); + strcat (lat, " "); + strcat (lat, str2); + strcat (lat, "/1"); } else { - strcat((gchar*)&lat, " "); - strcat((gchar*)&lat, "0/1"); + strcat (lat, " "); + strcat (lat, "0/1"); } - if (str3 != NULL) + if (str3) { - strcat((gchar*)&lat, " "); - strcat((gchar*)&lat, str3); - strcat((gchar*)&lat, "/1"); + strcat (lat, " "); + strcat (lat, str3); + strcat (lat, "/1"); } else { - strcat((gchar*)&lat, " "); - strcat((gchar*)&lat, "0/1"); + strcat (lat, " "); + strcat (lat, "0/1"); } - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - lat)) + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + lat)) { - g_printerr("failed to set tag [%s]\n", default_metadata_tags[i].tag); + g_printerr ("failed to set tag [%s]\n", + default_metadata_tags[i].tag); } if (s) free(s); } - else if (!strcmp ("Exif.GPSInfo.GPSAltitude", default_metadata_tags[i].tag)) + else if (! strcmp ("Exif.GPSInfo.GPSAltitude", + default_metadata_tags[i].tag)) { GtkWidget *combo_widget; - gchar alt_str[256]; - double alt_d; - int msr; + gchar alt_str[256]; + gdouble alt_d; + gint msr; - combo_widget = - GTK_WIDGET (gtk_builder_get_object (builder, - "GPSAltitudeSystem")); - msr = gtk_combo_box_get_active (GTK_COMBO_BOX(combo_widget)); + combo_widget = builder_get_widget (builder, + "GPSAltitudeSystem"); + msr = gtk_combo_box_get_active (GTK_COMBO_BOX (combo_widget)); - alt_d = atof(gtk_entry_get_text (entry)); + alt_d = atof (gtk_entry_get_text (entry)); if (msr == 1) alt_d = (alt_d * 12 * 2.54d) / 100; alt_d *= 10.f; - g_sprintf((gchar*)&alt_str, "%d/10", (int)alt_d); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - alt_str)) + + g_snprintf(alt_str, sizeof (alt_str), "%d/10", (gint) alt_d); + + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + alt_str)) { - g_printerr("failed to set tag [%s]\n", default_metadata_tags[i].tag); + g_printerr ("failed to set tag [%s]\n", + default_metadata_tags[i].tag); } } else { - const char* text_value = gtk_entry_get_text (entry); + const gchar *text_value = gtk_entry_get_text (entry); + if (default_metadata_tags[i].xmp_type == GIMP_XMP_TEXT || default_metadata_tags[i].xmp_type == GIMP_XMP_NONE) { - gexiv2_metadata_clear_tag(GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag); - gexiv2_metadata_set_xmp_tag_struct(GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - GEXIV2_STRUCTURE_XA_NONE); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - text_value)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag); + gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + GEXIV2_STRUCTURE_XA_NONE); + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + text_value)) { - g_printerr("failed to set tag [%s]\n", default_metadata_tags[i].tag); + g_printerr ("failed to set tag [%s]\n", + default_metadata_tags[i].tag); } } else if (default_metadata_tags[i].xmp_type == GIMP_XMP_BAG) { - gexiv2_metadata_clear_tag(GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag); - gexiv2_metadata_set_xmp_tag_struct(GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - GEXIV2_STRUCTURE_XA_BAG); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - text_value)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag); + gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + GEXIV2_STRUCTURE_XA_BAG); + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + text_value)) { - g_printerr("failed to set tag [%s]\n", default_metadata_tags[i].tag); + g_printerr ("failed to set tag [%s]\n", + default_metadata_tags[i].tag); } } else if (default_metadata_tags[i].xmp_type == GIMP_XMP_SEQ) { - gexiv2_metadata_clear_tag(GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag); - gexiv2_metadata_set_xmp_tag_struct(GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - GEXIV2_STRUCTURE_XA_SEQ); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - text_value)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag); + gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + GEXIV2_STRUCTURE_XA_SEQ); + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + text_value)) { - g_printerr("failed to set tag [%s]\n", default_metadata_tags[i].tag); + g_printerr ("failed to set tag [%s]\n", + default_metadata_tags[i].tag); } } } @@ -5146,7 +5461,7 @@ metadata_editor_write_callback (GtkWidget *dialog, /* MULTI TAGS */ - else if (!strcmp ("multi", default_metadata_tags[i].mode)) + else if (! strcmp ("multi", default_metadata_tags[i].mode)) { GtkTextView *text_view = GTK_TEXT_VIEW (object); GtkTextBuffer *buffer; @@ -5163,221 +5478,234 @@ metadata_editor_write_callback (GtkWidget *dialog, if (default_metadata_tags[i].xmp_type == GIMP_XMP_TEXT || default_metadata_tags[i].xmp_type == GIMP_XMP_NONE) { - gexiv2_metadata_clear_tag(GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag); - gexiv2_metadata_set_xmp_tag_struct(GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - GEXIV2_STRUCTURE_XA_NONE); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - text)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag); + gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + GEXIV2_STRUCTURE_XA_NONE); + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + text)) { - g_printerr("failed to set tag [%s]\n", default_metadata_tags[i].tag); + g_printerr ("failed to set tag [%s]\n", + default_metadata_tags[i].tag); } } else if (default_metadata_tags[i].xmp_type == GIMP_XMP_BAG) { - gexiv2_metadata_clear_tag(GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag); - gexiv2_metadata_set_xmp_tag_struct(GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - GEXIV2_STRUCTURE_XA_BAG); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - text)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag); + gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + GEXIV2_STRUCTURE_XA_BAG); + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + text)) { - g_printerr("failed to set tag [%s]\n", default_metadata_tags[i].tag); + g_printerr ("failed to set tag [%s]\n", + default_metadata_tags[i].tag); } } else if (default_metadata_tags[i].xmp_type == GIMP_XMP_SEQ) { - gexiv2_metadata_clear_tag(GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag); - gexiv2_metadata_set_xmp_tag_struct(GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - GEXIV2_STRUCTURE_XA_SEQ); - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - text)) + gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag); + gexiv2_metadata_set_xmp_tag_struct (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + GEXIV2_STRUCTURE_XA_SEQ); + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + text)) { - g_printerr("failed to set tag [%s]\n", default_metadata_tags[i].tag); + g_printerr ("failed to set tag [%s]\n", + default_metadata_tags[i].tag); } } if (text) g_free (text); } - else if (!strcmp ("list", default_metadata_tags[i].mode)) + else if (! strcmp ("list", default_metadata_tags[i].mode)) { /* MIGHT DO SOMETHING HERE */ } /* COMBO TAGS */ - else if (!strcmp ("combo", default_metadata_tags[i].mode)) + else if (! strcmp ("combo", default_metadata_tags[i].mode)) { GtkComboBoxText *combo; - gint32 value; + gint32 value; combo = GTK_COMBO_BOX_TEXT (object); - value = gtk_combo_box_get_active (GTK_COMBO_BOX(combo)); - if (!strcmp ("Xmp.xmp.Rating", default_metadata_tags[i].tag)) + value = gtk_combo_box_get_active (GTK_COMBO_BOX (combo)); + + if (! strcmp ("Xmp.xmp.Rating", default_metadata_tags[i].tag)) { if (value == 0) { - if (!gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag)) + if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag)) { - g_printerr("failed to clear tag [%s]\n", - default_metadata_tags[i].tag); + g_printerr ("failed to clear tag [%s]\n", + default_metadata_tags[i].tag); } } else { gchar *save; - save = g_strdup_printf("%d", value); + + save = g_strdup_printf ("%d", value); + gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, save); - if (save) - g_free(save); + default_metadata_tags[i].tag, + save); + g_free(save); } } - else if (!strcmp ("Xmp.DICOM.PatientSex", default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.DICOM.PatientSex", + default_metadata_tags[i].tag)) { switch (value) { case 0: - if (!gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag)) + if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag)) { - g_printerr("failed to clear tag [%s]\n", - default_metadata_tags[i].tag); + g_printerr ("failed to clear tag [%s]\n", + default_metadata_tags[i].tag); } break; case 1: - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - "male")) + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + "male")) { - g_printerr("failed to set tag [%s]\n", - default_metadata_tags[i].tag); + g_printerr ("failed to set tag [%s]\n", + default_metadata_tags[i].tag); } break; case 2: - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - "female")) + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + "female")) { - g_printerr("failed to set tag [%s]\n", - default_metadata_tags[i].tag); + g_printerr ("failed to set tag [%s]\n", + default_metadata_tags[i].tag); } break; case 3: - if (!gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, - "other")) + if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag, + "other")) { - g_printerr("failed to set tag [%s]\n", - default_metadata_tags[i].tag); + g_printerr ("failed to set tag [%s]\n", + default_metadata_tags[i].tag); } break; } } - else if (!strcmp ("Exif.GPSInfo.GPSLongitudeRef", - default_metadata_tags[i].tag)) + else if (! strcmp ("Exif.GPSInfo.GPSLongitudeRef", + default_metadata_tags[i].tag)) { switch (value) { case 0: - if (!gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag)) + if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag)) { - g_printerr("failed to clear tag [%s]\n", - default_metadata_tags[i].tag); + g_printerr ("failed to clear tag [%s]\n", + default_metadata_tags[i].tag); } break; case 1: gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, "E"); + default_metadata_tags[i].tag, + "E"); break; case 2: gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, "W"); + default_metadata_tags[i].tag, + "W"); break; } } - else if (!strcmp ("Exif.GPSInfo.GPSLatitudeRef", - default_metadata_tags[i].tag)) + else if (! strcmp ("Exif.GPSInfo.GPSLatitudeRef", + default_metadata_tags[i].tag)) { switch (value) { case 0: - if (!gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag)) + if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag)) { - g_printerr("failed to clear tag [%s]\n", - default_metadata_tags[i].tag); + g_printerr ("failed to clear tag [%s]\n", + default_metadata_tags[i].tag); } break; case 1: gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, "N"); + default_metadata_tags[i].tag, + "N"); break; case 2: gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, "S"); + default_metadata_tags[i].tag, + "S"); break; } } - else if (!strcmp ("Exif.GPSInfo.GPSAltitudeRef", - default_metadata_tags[i].tag)) + else if (! strcmp ("Exif.GPSInfo.GPSAltitudeRef", + default_metadata_tags[i].tag)) { switch (value) { case 0: - if (!gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag)) + if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag)) { - g_printerr("failed to clear tag [%s]\n", - default_metadata_tags[i].tag); + g_printerr ("failed to clear tag [%s]\n", + default_metadata_tags[i].tag); } break; case 1: gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, "0"); + default_metadata_tags[i].tag, + "0"); break; case 2: gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag, "1"); + default_metadata_tags[i].tag, + "1"); break; } } - else if (!strcmp ("Xmp.plus.ModelReleaseStatus", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.plus.ModelReleaseStatus", + default_metadata_tags[i].tag)) { gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), default_metadata_tags[i].tag, modelreleasestatus[value].data); } - else if (!strcmp ("Xmp.plus.PropertyReleaseStatus", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.plus.PropertyReleaseStatus", + default_metadata_tags[i].tag)) { if (value == 0) { - if (!gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag)) + if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag)) { - g_printerr("failed to clear tag [%s]\n", - default_metadata_tags[i].tag); + g_printerr ("failed to clear tag [%s]\n", + default_metadata_tags[i].tag); } } else @@ -5387,16 +5715,16 @@ metadata_editor_write_callback (GtkWidget *dialog, propertyreleasestatus[value].data); } } - else if (!strcmp ("Xmp.plus.MinorModelAgeDisclosure", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.plus.MinorModelAgeDisclosure", + default_metadata_tags[i].tag)) { if (value == 0) { - if (!gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), - default_metadata_tags[i].tag)) + if (! gexiv2_metadata_clear_tag (GEXIV2_METADATA (g_metadata), + default_metadata_tags[i].tag)) { - g_printerr("failed to clear tag [%s]\n", - default_metadata_tags[i].tag); + g_printerr ("failed to clear tag [%s]\n", + default_metadata_tags[i].tag); } } else @@ -5406,8 +5734,8 @@ metadata_editor_write_callback (GtkWidget *dialog, minormodelagedisclosure[value].data); } } - else if (!strcmp ("Xmp.iptcExt.DigitalSourceType", - default_metadata_tags[i].tag)) + else if (! strcmp ("Xmp.iptcExt.DigitalSourceType", + default_metadata_tags[i].tag)) { gexiv2_metadata_set_tag_string (GEXIV2_METADATA (g_metadata), default_metadata_tags[i].tag, @@ -5425,27 +5753,26 @@ metadata_editor_write_callback (GtkWidget *dialog, */ static void -import_dialog_metadata(metadata_editor *args) +import_dialog_metadata (metadata_editor *args) { GtkWidget *file_dialog; - gchar *filename; + gchar *filename; file_dialog = gtk_file_chooser_dialog_new ("Import Metadata File", - NULL, - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, - GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, - GTK_RESPONSE_ACCEPT, - NULL); + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, + GTK_RESPONSE_ACCEPT, + NULL); gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (file_dialog), args->filename); if (gtk_dialog_run (GTK_DIALOG (file_dialog)) == GTK_RESPONSE_ACCEPT) { - filename = - gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_dialog)); + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_dialog)); if (filename) { @@ -5463,29 +5790,28 @@ import_dialog_metadata(metadata_editor *args) } static void -export_dialog_metadata(metadata_editor *args) +export_dialog_metadata (metadata_editor *args) { GtkWidget *file_dialog; - gchar *filename; + gchar *filename; file_dialog = gtk_file_chooser_dialog_new ("Export Metadata File", - NULL, - GTK_FILE_CHOOSER_ACTION_SAVE, - GTK_STOCK_CANCEL, - GTK_RESPONSE_CANCEL, - GTK_STOCK_SAVE, - GTK_RESPONSE_ACCEPT, - NULL); + NULL, + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE, + GTK_RESPONSE_ACCEPT, + NULL); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (file_dialog), - TRUE); + TRUE); gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (file_dialog), args->filename); if (gtk_dialog_run (GTK_DIALOG (file_dialog)) == GTK_RESPONSE_ACCEPT) { - filename = - gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_dialog)); + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_dialog)); if (filename) { @@ -5507,21 +5833,21 @@ impex_combo_callback (GtkComboBoxText *combo, gpointer data) { metadata_editor *args; - gint32 selection; + gint32 selection; args = data; - selection = gtk_combo_box_get_active (GTK_COMBO_BOX(combo)); + selection = gtk_combo_box_get_active (GTK_COMBO_BOX (combo)); switch(selection) { case 1: /* Import */ - import_dialog_metadata(args); - gtk_combo_box_set_active (GTK_COMBO_BOX(combo), 0); + import_dialog_metadata (args); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); break; case 2: /* Export */ - export_dialog_metadata(args); - gtk_combo_box_set_active (GTK_COMBO_BOX(combo), 0); + export_dialog_metadata (args); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); break; } } @@ -5538,34 +5864,36 @@ gpsaltsys_combo_callback (GtkComboBoxText *combo, double alt_d; builder = data; - selection = gtk_combo_box_get_active (GTK_COMBO_BOX(combo)); + selection = gtk_combo_box_get_active (GTK_COMBO_BOX (combo)); - entry = - GTK_WIDGET (gtk_builder_get_object (builder, "Exif.GPSInfo.GPSAltitude")); + entry = builder_get_widget (builder, "Exif.GPSInfo.GPSAltitude"); switch(selection) { case 0: /* Meters */ if (last_gpsaltsys_sel != 0) { - alt_d = atof(gtk_entry_get_text (GTK_ENTRY(entry))); + alt_d = atof (gtk_entry_get_text (GTK_ENTRY (entry))); alt_d = (alt_d * (12 * 2.54d)) / 100; - g_sprintf((gchar*)&alt_str, "%2f", (float)alt_d); - gtk_entry_set_text (GTK_ENTRY(entry), (gchar*)&alt_str); + + g_snprintf (alt_str, sizeof (alt_str), "%2f", (float)alt_d); + + gtk_entry_set_text (GTK_ENTRY (entry), alt_str); } break; case 1: /* Feet */ if (last_gpsaltsys_sel != 1) { - alt_d = atof(gtk_entry_get_text (GTK_ENTRY(entry))); + alt_d = atof (gtk_entry_get_text (GTK_ENTRY (entry))); alt_d = alt_d * 3.28d; - g_sprintf((gchar*)&alt_str, "%2f", (float)alt_d); - gtk_entry_set_text (GTK_ENTRY(entry), (gchar*)&alt_str); + + g_snprintf (alt_str, sizeof (alt_str), "%2f", (float)alt_d); + + gtk_entry_set_text (GTK_ENTRY (entry), alt_str); } break; } last_gpsaltsys_sel = selection; } - diff --git a/plug-ins/metadata/metadata-tags.h b/plug-ins/metadata/metadata-tags.h index aa3515a572..74ed450926 100644 --- a/plug-ins/metadata/metadata-tags.h +++ b/plug-ins/metadata/metadata-tags.h @@ -404,7 +404,6 @@ static const TranslateTag imageSupplierInfoTags[] = /* Plus and IPTC extension tags */ -static const int licensor_items = 8; static const gchar *licensor_header = "Xmp.plus.Licensor"; static const gchar *licensor[] = { @@ -419,7 +418,6 @@ static const gchar *licensor[] = }; #ifdef USE_TAGS -static const int imagesupplier_items = 2; static const gchar *imagesupplier_header = "Xmp.plus.ImageSupplier"; static const gchar *imagesupplier[] = { @@ -428,7 +426,6 @@ static const gchar *imagesupplier[] = }; #endif -static const int imagecreator_items = 2; static const gchar *imagecreator_header = "Xmp.plus.ImageCreator"; static const gchar *imagecreator[] = { @@ -436,7 +433,6 @@ static const gchar *imagecreator[] = "/plus:ImageCreatorID" }; -static const int copyrightowner_items = 2; static const gchar *copyrightowner_header = "Xmp.plus.CopyrightOwner"; static const gchar *copyrightowner[] = { @@ -444,7 +440,6 @@ static const gchar *copyrightowner[] = "/plus:CopyrightOwnerID" }; -static const int registryid_items = 2; static const gchar *registryid_header = "Xmp.iptcExt.RegistryId"; static const gchar *registryid[] = { @@ -452,7 +447,6 @@ static const gchar *registryid[] = "/Iptc4xmpExt:RegItemId" }; -static const int artworkorobject_items = 6; static const gchar *artworkorobject_header = "Xmp.iptcExt.ArtworkOrObject"; static const gchar *artworkorobject[] = { @@ -464,7 +458,6 @@ static const gchar *artworkorobject[] = "/Iptc4xmpExt:AOCreator" }; -static const int locationshown_items = 6; static const gchar *locationshown_header = "Xmp.iptcExt.LocationShown"; static const gchar *locationshown[] = { @@ -477,7 +470,6 @@ static const gchar *locationshown[] = }; #ifdef USE_TAGS -static const int locationcreated_items = 6; static const gchar *locationcreated_header = "Xmp.iptcExt.LocationCreated"; static const gchar *locationcreated[] = { diff --git a/plug-ins/metadata/metadata-xml.c b/plug-ins/metadata/metadata-xml.c index aa57b01570..517378a1b8 100644 --- a/plug-ins/metadata/metadata-xml.c +++ b/plug-ins/metadata/metadata-xml.c @@ -235,7 +235,7 @@ set_tag_ui (metadata_editor *args, int index, COL_LICENSOR_EMAIL, list_tag_data[row][7], COL_LICENSOR_WEB, list_tag_data[row][8], -1); - for (item = 1; item < licensor_items+1; item++) + for (item = 1; item < G_N_ELEMENTS (licensor) + 1; item++) { if (list_tag_data[row][item]) { @@ -272,7 +272,7 @@ set_tag_ui (metadata_editor *args, int index, COL_IMG_CR8_NAME, list_tag_data[row][1], COL_IMG_CR8_ID, list_tag_data[row][2], -1); - for (item = 1; item < imagecreator_items+1; item++) + for (item = 1; item < G_N_ELEMENTS (imagecreator) + 1; item++) { if (list_tag_data[row][item]) { @@ -307,7 +307,7 @@ set_tag_ui (metadata_editor *args, int index, COL_AOO_SRC_INV_ID, list_tag_data[row][5], COL_AOO_CR_NOT, list_tag_data[row][6], -1); - for (item = 1; item < artworkorobject_items+1; item++) + for (item = 1; item < G_N_ELEMENTS (artworkorobject) + 1; item++) { if (list_tag_data[row][item]) { @@ -342,7 +342,7 @@ set_tag_ui (metadata_editor *args, int index, COL_REGSITRY_ORG_ID, list_tag_data[row][1], COL_REGSITRY_ITEM_ID, list_tag_data[row][2], -1); - for (item = 1; item < registryid_items+1; item++) + for (item = 1; item < G_N_ELEMENTS (registryid) + 1; item++) { if (list_tag_data[row][item]) { @@ -375,7 +375,7 @@ set_tag_ui (metadata_editor *args, int index, COL_CR_OWNER_NAME, list_tag_data[row][1], COL_CR_OWNER_ID, list_tag_data[row][2], -1); - for (item = 1; item < copyrightowner_items+1; item++) + for (item = 1; item < G_N_ELEMENTS (copyrightowner) + 1; item++) { if (list_tag_data[row][item]) { @@ -411,7 +411,7 @@ set_tag_ui (metadata_editor *args, int index, COL_LOC_SHO_CNTRY_ISO, list_tag_data[row][5], COL_LOC_SHO_CNTRY_WRLD_REG, list_tag_data[row][6], -1); - for (item = 1; item < locationshown_items+1; item++) + for (item = 1; item < G_N_ELEMENTS (locationshown) + 1; item++) { if (list_tag_data[row][item]) {