static void bar_pane_comment_set_selection(PaneCommentData *pcd, gboolean append) { GList *list = NULL; GList *work; gchar *comment = NULL; comment = text_widget_text_pull(pcd->comment_view); list = layout_selection_list(pcd->pane.lw); list = file_data_process_groups_in_selection(list, FALSE, NULL); work = list; while (work) { FileData *fd = work->data; work = work->next; if (fd == pcd->fd) continue; if (append) { metadata_append_string(fd, pcd->key, comment); } else { metadata_write_string(fd, pcd->key, comment); } } filelist_free(list); g_free(comment); }
static void bar_pane_exif_entry_changed(GtkEntry *text_entry, gpointer data) { ExifEntry *ee = data; gchar *text; if (!ee->ped->fd) return; text = text_widget_text_pull(ee->value_widget); metadata_write_string(ee->ped->fd, ee->key, text); g_free(text); }
static void bar_pane_comment_write(PaneCommentData *pcd) { gchar *comment; if (!pcd->fd) return; comment = text_widget_text_pull(pcd->comment_view); metadata_write_string(pcd->fd, pcd->key, comment); g_free(comment); }
GList *keyword_list_pull(GtkWidget *text_widget) { GList *list; gchar *text; text = text_widget_text_pull(text_widget); list = string_to_keywords_list(text); g_free(text); return list; }
static void bar_pane_comment_update(PaneCommentData *pcd) { gchar *comment = NULL; gchar *orig_comment = NULL; gchar *comment_not_null; GtkTextBuffer *comment_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(pcd->comment_view)); orig_comment = text_widget_text_pull(pcd->comment_view); comment = metadata_read_string(pcd->fd, pcd->key, METADATA_PLAIN); comment_not_null = (comment) ? comment : ""; if (strcmp(orig_comment, comment_not_null) != 0) { g_signal_handlers_block_by_func(comment_buffer, bar_pane_comment_changed, pcd); gtk_text_buffer_set_text(comment_buffer, comment_not_null, -1); g_signal_handlers_unblock_by_func(comment_buffer, bar_pane_comment_changed, pcd); } g_free(comment); g_free(orig_comment); gtk_widget_set_sensitive(pcd->comment_view, (pcd->fd != NULL)); }