Mercurial > geeqie
changeset 1292:4a3ae0e6f1eb
droped Preferences dialog, sidebar should replace it completely
author | nadvornik |
---|---|
date | Sat, 14 Feb 2009 20:26:30 +0000 |
parents | 50ae02a4a675 |
children | 48e064b37ba6 |
files | src/Makefile.am src/bar.c src/bar_info.c src/bar_info.h src/bar_keywords.c src/bar_keywords.h src/collect-table.c src/collect.c src/dupe.c src/img-view.c src/info.c src/info.h src/layout_image.c src/layout_util.c src/options.c src/pan-view.c src/search.c src/view_file.c src/view_file_icon.c src/view_file_list.c |
diffstat | 20 files changed, 6 insertions(+), 2212 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Makefile.am Sat Feb 14 19:50:54 2009 +0000 +++ b/src/Makefile.am Sat Feb 14 20:26:30 2009 +0000 @@ -80,8 +80,6 @@ bar.h \ bar_comment.c \ bar_comment.h \ - bar_info.c \ - bar_info.h \ bar_keywords.c \ bar_keywords.h \ bar_exif.c \ @@ -154,8 +152,6 @@ image-overlay.h \ img-view.c \ img-view.h \ - info.c \ - info.h \ layout.c \ layout.h \ layout_config.c \
--- a/src/bar.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/bar.c Sat Feb 14 20:26:30 2009 +0000 @@ -16,7 +16,6 @@ #include "filedata.h" #include "history_list.h" -#include "info.h" #include "metadata.h" #include "misc.h" #include "ui_fileops.h"
--- a/src/bar_info.c Sat Feb 14 19:50:54 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1047 +0,0 @@ -/* - * Geeqie - * (C) 2004 John Ellis - * Copyright (C) 2008 - 2009 The Geeqie Team - * - * Author: John Ellis - * - * This software is released under the GNU General Public License (GNU GPL). - * Please read the included file COPYING for more information. - * This software comes with no warranty of any kind, use at your own risk! - */ - - -#include "main.h" -#include "bar_info.h" - -#include "filedata.h" -#include "history_list.h" -#include "info.h" -#include "metadata.h" -#include "misc.h" -#include "ui_fileops.h" -#include "ui_misc.h" -#include "ui_utildlg.h" -#include "utilops.h" - -static const gchar *keyword_favorite_defaults[] = { - N_("Favorite"), - N_("Todo"), - N_("People"), - N_("Places"), - N_("Art"), - N_("Nature"), - N_("Possessions"), - NULL -}; - - -static void bar_info_keyword_update_all(void); -static void bar_info_changed(GtkTextBuffer *buffer, gpointer data); - -/* - *------------------------------------------------------------------- - * keyword / comment utils - *------------------------------------------------------------------- - */ - - -static gchar *comment_pull(GtkWidget *textview) -{ - GtkTextBuffer *buffer; - GtkTextIter start, end; - - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); - gtk_text_buffer_get_bounds(buffer, &start, &end); - - return gtk_text_buffer_get_text(buffer, &start, &end, FALSE); -} - -GList *keyword_list_pull(GtkWidget *text_widget) -{ - GList *list; - gchar *text; - - if (GTK_IS_TEXT_VIEW(text_widget)) - { - text = comment_pull(text_widget); - } - else if (GTK_IS_ENTRY(text_widget)) - { - text = g_strdup(gtk_entry_get_text(GTK_ENTRY(text_widget))); - } - else - { - return NULL; - } - - list = string_to_keywords_list(text); - - g_free(text); - - return list; -} - -void keyword_list_push(GtkWidget *textview, GList *list) -{ - GtkTextBuffer *buffer; - GtkTextIter start, end; - - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); - gtk_text_buffer_get_bounds(buffer, &start, &end); - gtk_text_buffer_delete(buffer, &start, &end); - - while (list) - { - const gchar *word = list->data; - GtkTextIter iter; - - gtk_text_buffer_get_end_iter(buffer, &iter); - if (word) gtk_text_buffer_insert(buffer, &iter, word, -1); - gtk_text_buffer_get_end_iter(buffer, &iter); - gtk_text_buffer_insert(buffer, &iter, "\n", -1); - - list = list->next; - } -} - - -/* - *------------------------------------------------------------------- - * keyword list dialog - *------------------------------------------------------------------- - */ - -#define KEYWORD_DIALOG_WIDTH 200 -#define KEYWORD_DIALOG_HEIGHT 250 - -typedef struct _KeywordDlg KeywordDlg; -struct _KeywordDlg -{ - GenericDialog *gd; - GtkWidget *treeview; -}; - -static KeywordDlg *keyword_dialog = NULL; - - -static void keyword_dialog_cancel_cb(GenericDialog *gd, gpointer data) -{ - g_free(keyword_dialog); - keyword_dialog = NULL; -} - -static void keyword_dialog_ok_cb(GenericDialog *gd, gpointer data) -{ - KeywordDlg *kd = data; - GtkTreeModel *store; - GtkTreeIter iter; - gint valid; - - history_list_free_key("keywords"); - - store = gtk_tree_view_get_model(GTK_TREE_VIEW(kd->treeview)); - valid = gtk_tree_model_get_iter_first(store, &iter); - while (valid) - { - gchar *key; - - gtk_tree_model_get(store, &iter, 0, &key, -1); - valid = gtk_tree_model_iter_next(store, &iter); - - history_list_add_to_key("keywords", key, 0); - } - - keyword_dialog_cancel_cb(gd, data); - - bar_info_keyword_update_all(); -} - -static void keyword_dialog_add_cb(GtkWidget *button, gpointer data) -{ - KeywordDlg *kd = data; - GtkTreeSelection *selection; - GtkTreeModel *store; - GtkTreeIter sibling; - GtkTreeIter iter; - GtkTreePath *tpath; - - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(kd->treeview)); - if (gtk_tree_selection_get_selected(selection, &store, &sibling)) - { - gtk_list_store_insert_before(GTK_LIST_STORE(store), &iter, &sibling); - } - else - { - store = gtk_tree_view_get_model(GTK_TREE_VIEW(kd->treeview)); - gtk_list_store_append(GTK_LIST_STORE(store), &iter); - } - - gtk_list_store_set(GTK_LIST_STORE(store), &iter, 1, TRUE, -1); - - tpath = gtk_tree_model_get_path(store, &iter); - gtk_tree_view_set_cursor(GTK_TREE_VIEW(kd->treeview), tpath, - gtk_tree_view_get_column(GTK_TREE_VIEW(kd->treeview), 0), TRUE); - gtk_tree_path_free(tpath); -} - -static void keyword_dialog_remove_cb(GtkWidget *button, gpointer data) -{ - KeywordDlg *kd = data; - GtkTreeSelection *selection; - GtkTreeModel *store; - GtkTreeIter iter; - GtkTreeIter next; - GtkTreePath *tpath; - - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(kd->treeview)); - if (!gtk_tree_selection_get_selected(selection, &store, &iter)) return; - - tpath = NULL; - next = iter; - if (gtk_tree_model_iter_next(store, &next)) - { - tpath = gtk_tree_model_get_path(store, &next); - } - else - { - tpath = gtk_tree_model_get_path(store, &iter); - if (!gtk_tree_path_prev(tpath)) - { - gtk_tree_path_free(tpath); - tpath = NULL; - } - } - if (tpath) - { - gtk_tree_view_set_cursor(GTK_TREE_VIEW(kd->treeview), tpath, - gtk_tree_view_get_column(GTK_TREE_VIEW(kd->treeview), 0), FALSE); - gtk_tree_path_free(tpath); - } - - gtk_list_store_remove(GTK_LIST_STORE(store), &iter); -} - -static void keyword_dialog_edit_cb(GtkCellRendererText *renderer, const gchar *path, - const gchar *new_text, gpointer data) -{ - KeywordDlg *kd = data; - GtkTreeModel *store; - GtkTreeIter iter; - GtkTreePath *tpath; - - if (!new_text || strlen(new_text) == 0) return; - - store = gtk_tree_view_get_model(GTK_TREE_VIEW(kd->treeview)); - - tpath = gtk_tree_path_new_from_string(path); - gtk_tree_model_get_iter(store, &iter, tpath); - gtk_tree_path_free(tpath); - - gtk_list_store_set(GTK_LIST_STORE(store), &iter, 0, new_text, -1); -} - -static void keyword_dialog_populate(KeywordDlg *kd) -{ - GtkListStore *store; - GList *list; - - store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(kd->treeview))); - gtk_list_store_clear(store); - - list = history_list_get_by_key("keywords"); - list = g_list_last(list); - while (list) - { - GtkTreeIter iter; - - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, list->data, - 1, TRUE, -1); - - list = list->prev; - } -} - -static void keyword_dialog_show(void) -{ - GtkWidget *scrolled; - GtkListStore *store; - GtkTreeViewColumn *column; - GtkCellRenderer *renderer; - GtkWidget *hbox; - GtkWidget *button; - - if (keyword_dialog) - { - gtk_window_present(GTK_WINDOW(keyword_dialog->gd->dialog)); - return; - } - - keyword_dialog = g_new0(KeywordDlg, 1); - - keyword_dialog->gd = generic_dialog_new(_("Keyword Presets"), - "keyword_presets", NULL, TRUE, - keyword_dialog_cancel_cb, keyword_dialog); - generic_dialog_add_message(keyword_dialog->gd, NULL, _("Favorite keywords list"), NULL); - - generic_dialog_add_button(keyword_dialog->gd, GTK_STOCK_OK, NULL, - keyword_dialog_ok_cb, TRUE); - - scrolled = gtk_scrolled_window_new(NULL, NULL); - gtk_widget_set_size_request(scrolled, KEYWORD_DIALOG_WIDTH, KEYWORD_DIALOG_HEIGHT); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start(GTK_BOX(keyword_dialog->gd->vbox), scrolled, TRUE, TRUE, 5); - gtk_widget_show(scrolled); - - store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_BOOLEAN); - keyword_dialog->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); - g_object_unref(store); - - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(keyword_dialog->treeview), FALSE); - gtk_tree_view_set_search_column(GTK_TREE_VIEW(keyword_dialog->treeview), 0); - gtk_tree_view_set_reorderable(GTK_TREE_VIEW(keyword_dialog->treeview), TRUE); - - column = gtk_tree_view_column_new(); - gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); - renderer = gtk_cell_renderer_text_new(); - g_signal_connect(G_OBJECT(renderer), "edited", - G_CALLBACK(keyword_dialog_edit_cb), keyword_dialog); - gtk_tree_view_column_pack_start(column, renderer, TRUE); - gtk_tree_view_column_add_attribute(column, renderer, "text", 0); - gtk_tree_view_column_add_attribute(column, renderer, "editable", 1); - gtk_tree_view_append_column(GTK_TREE_VIEW(keyword_dialog->treeview), column); - - gtk_container_add(GTK_CONTAINER(scrolled), keyword_dialog->treeview); - gtk_widget_show(keyword_dialog->treeview); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(keyword_dialog->gd->vbox), hbox, FALSE, FALSE, 0); - gtk_widget_show(hbox); - - button = gtk_button_new_from_stock(GTK_STOCK_ADD); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(keyword_dialog_add_cb), keyword_dialog); - gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); - gtk_widget_show(button); - - button = gtk_button_new_from_stock(GTK_STOCK_REMOVE); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(keyword_dialog_remove_cb), keyword_dialog); - gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); - gtk_widget_show(button); - - keyword_dialog_populate(keyword_dialog); - - gtk_widget_show(keyword_dialog->gd->dialog); -} - - -static void bar_keyword_edit_cb(GtkWidget *button, gpointer data) -{ - keyword_dialog_show(); -} - - -/* - *------------------------------------------------------------------- - * info bar - *------------------------------------------------------------------- - */ - -typedef enum { - BAR_SORT_COPY, - BAR_SORT_MOVE, - BAR_SORT_LINK -} SortActionType; - -enum { - KEYWORD_COLUMN_TOGGLE = 0, - KEYWORD_COLUMN_TEXT, - KEYWORD_COLUMN_MARK -}; - -typedef struct _BarInfoData BarInfoData; -struct _BarInfoData -{ - GtkWidget *vbox; - GtkWidget *group_box; - GtkWidget *label_file_name; - GtkWidget *label_file_time; - - GtkWidget *keyword_view; - GtkWidget *keyword_treeview; - - GtkWidget *comment_view; - -#if 0 - GtkWidget *button_save; -#endif - GtkWidget *button_set_keywords_add; - GtkWidget *button_set_keywords_replace; - GtkWidget *button_set_comment_add; - GtkWidget *button_set_comment_replace; - - FileData *fd; - - GList *(*list_func)(gpointer); - gpointer list_data; -}; - - -static GList *bar_list = NULL; - - -static void bar_info_write(BarInfoData *bd) -{ - GList *list; - gchar *comment; - - if (!bd->fd) return; - - list = keyword_list_pull(bd->keyword_view); - comment = comment_pull(bd->comment_view); - - metadata_write_string(bd->fd, COMMENT_KEY, comment); - metadata_write_list(bd->fd, KEYWORD_KEY, list); - - string_list_free(list); - g_free(comment); -} - -static gchar *bar_info_get_mark_text(const gchar *key) -{ - gint i; - static gchar buf[10]; - - for (i = 0; i < FILEDATA_MARKS_SIZE; i++) - { - FileDataGetMarkFunc get_mark_func; - FileDataSetMarkFunc set_mark_func; - gpointer data; - file_data_get_registered_mark_func(i, &get_mark_func, &set_mark_func, &data); - if (get_mark_func == meta_data_get_keyword_mark && strcmp(data, key) == 0) - { - sprintf(buf, " %d ", i + 1); - return buf; - } - } - return " ... "; -} - -static void bar_keyword_list_sync(BarInfoData *bd, GList *keywords) -{ - GList *list; - GtkListStore *store; - GtkTreeIter iter; - - list = history_list_get_by_key("keywords"); - if (!list) - { - /* blank? set up a few example defaults */ - - gint i = 0; - - while (keyword_favorite_defaults[i] != NULL) - { - history_list_add_to_key("keywords", _(keyword_favorite_defaults[i]), 0); - i++; - } - - list = history_list_get_by_key("keywords"); - } - - store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(bd->keyword_treeview))); - - gtk_list_store_clear(store); - - list = g_list_last(list); - while (list) - { - gchar *key = list->data; - - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, KEYWORD_COLUMN_TOGGLE, find_string_in_list(keywords, key), - KEYWORD_COLUMN_TEXT, key, - KEYWORD_COLUMN_MARK, bar_info_get_mark_text(key), -1); - - list = list->prev; - } -} - -static void bar_info_keyword_update_all(void) -{ - GList *work; - - work = bar_list; - while (work) - { - BarInfoData *bd; - GList *keywords; - - bd = work->data; - work = work->next; - - keywords = keyword_list_pull(bd->keyword_view); - bar_keyword_list_sync(bd, keywords); - string_list_free(keywords); - } -} - -static void bar_info_update(BarInfoData *bd) -{ - GList *keywords = NULL; - gchar *comment = NULL; - GtkTextBuffer *keyword_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bd->keyword_view)); - GtkTextBuffer *comment_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bd->comment_view)); - - g_signal_handlers_block_by_func(keyword_buffer, bar_info_changed, bd); - g_signal_handlers_block_by_func(comment_buffer, bar_info_changed, bd); - - if (bd->label_file_name) - { - gtk_label_set_text(GTK_LABEL(bd->label_file_name), (bd->fd) ? bd->fd->name : ""); - } - if (bd->label_file_time) - { - gtk_label_set_text(GTK_LABEL(bd->label_file_time), (bd->fd) ? text_from_time(bd->fd->date) : ""); - } - - comment = metadata_read_string(bd->fd, COMMENT_KEY, METADATA_PLAIN); - gtk_text_buffer_set_text(comment_buffer, - (comment) ? comment : "", -1); - g_free(comment); - - keywords = metadata_read_list(bd->fd, KEYWORD_KEY, METADATA_PLAIN); - keyword_list_push(bd->keyword_view, keywords); - bar_keyword_list_sync(bd, keywords); - string_list_free(keywords); - - g_signal_handlers_unblock_by_func(keyword_buffer, bar_info_changed, bd); - g_signal_handlers_unblock_by_func(comment_buffer, bar_info_changed, bd); - - gtk_widget_set_sensitive(bd->group_box, (bd->fd != NULL)); -} - -void bar_info_set(GtkWidget *bar, FileData *fd) -{ - BarInfoData *bd; - - bd = g_object_get_data(G_OBJECT(bar), "bar_info_data"); - if (!bd) return; - - file_data_unref(bd->fd); - bd->fd = file_data_ref(fd); - - bar_info_update(bd); -} - -void bar_info_maint_renamed(GtkWidget *bar, FileData *fd) -{ - BarInfoData *bd; - - bd = g_object_get_data(G_OBJECT(bar), "bar_info_data"); - if (!bd) return; - - file_data_unref(bd->fd); - bd->fd = file_data_ref(fd); - - if (bd->label_file_name) - { - gtk_label_set_text(GTK_LABEL(bd->label_file_name), (bd->fd) ? bd->fd->name : ""); - } -} - -gint bar_info_event(GtkWidget *bar, GdkEvent *event) -{ - BarInfoData *bd; - - bd = g_object_get_data(G_OBJECT(bar), "bar_info_data"); - if (!bd) return FALSE; - - if (GTK_WIDGET_HAS_FOCUS(bd->keyword_view)) return gtk_widget_event(bd->keyword_view, event); - if (GTK_WIDGET_HAS_FOCUS(bd->comment_view)) return gtk_widget_event(bd->comment_view, event); - - return FALSE; -} - -static void bar_info_keyword_set(BarInfoData *bd, const gchar *keyword, gint active) -{ - GList *list; - gint found; - - if (!keyword) return; - - list = keyword_list_pull(bd->keyword_view); - found = find_string_in_list(list, keyword); - - if (active != found) - { - if (found) - { - GList *work = list; - - while (work) - { - gchar *key = work->data; - work = work->next; - - if (key && keyword && strcmp(key, keyword) == 0) - { - list = g_list_remove(list, key); - g_free(key); - } - } - } - else - { - list = g_list_append(list, g_strdup(keyword)); - } - - keyword_list_push(bd->keyword_view, list); - } - - string_list_free(list); -} - -static void bar_info_keyword_toggle(GtkCellRendererToggle *toggle, const gchar *path, gpointer data) -{ - BarInfoData *bd = data; - GtkTreeModel *store; - GtkTreeIter iter; - GtkTreePath *tpath; - gchar *key = NULL; - gboolean active; - - store = gtk_tree_view_get_model(GTK_TREE_VIEW(bd->keyword_treeview)); - - tpath = gtk_tree_path_new_from_string(path); - gtk_tree_model_get_iter(store, &iter, tpath); - gtk_tree_path_free(tpath); - - gtk_tree_model_get(store, &iter, KEYWORD_COLUMN_TOGGLE, &active, - KEYWORD_COLUMN_TEXT, &key, -1); - active = (!active); - gtk_list_store_set(GTK_LIST_STORE(store), &iter, KEYWORD_COLUMN_TOGGLE, active, -1); - - bar_info_keyword_set(bd, key, active); - g_free(key); -} - -static void bar_info_set_selection(BarInfoData *bd, gboolean set_keywords, gboolean set_comment, gboolean append) -{ - GList *keywords = NULL; - GList *list = NULL; - GList *work; - gchar *comment = NULL; - - if (!bd->list_func) return; - - if (set_keywords) - { - keywords = keyword_list_pull(bd->keyword_view); - } - - if (set_comment) - { - comment = comment_pull(bd->comment_view); - } - - if (append && !keywords && !comment) return; - - list = bd->list_func(bd->list_data); - work = list; - while (work) - { - FileData *fd = work->data; - work = work->next; - - if (append) - { - if (comment) metadata_append_string(fd, COMMENT_KEY, comment); - if (keywords) metadata_append_list(fd, KEYWORD_KEY, keywords); - } - else - { - if (comment) metadata_write_string(fd, COMMENT_KEY, comment); - if (keywords) metadata_write_list(fd, KEYWORD_KEY, keywords); - } - } - - filelist_free(list); - string_list_free(keywords); - g_free(comment); -} - -static void bar_info_set_keywords_add(GtkWidget *button, gpointer data) -{ - BarInfoData *bd = data; - - bar_info_set_selection(bd, TRUE, FALSE, TRUE); -} - -static void bar_info_set_keywords_replace(GtkWidget *button, gpointer data) -{ - BarInfoData *bd = data; - - bar_info_set_selection(bd, TRUE, FALSE, FALSE); -} - -static void bar_info_set_comment_add(GtkWidget *button, gpointer data) -{ - BarInfoData *bd = data; - - bar_info_set_selection(bd, FALSE, TRUE, TRUE); -} - -static void bar_info_set_comment_replace(GtkWidget *button, gpointer data) -{ - BarInfoData *bd = data; - - bar_info_set_selection(bd, FALSE, TRUE, FALSE); -} - -static void bar_info_notify_cb(FileData *fd, NotifyType type, gpointer data) -{ - BarInfoData *bd = data; - if (fd == bd->fd) bar_info_update(bd); -} - -static void bar_info_changed(GtkTextBuffer *buffer, gpointer data) -{ - BarInfoData *bd = data; - - file_data_unregister_notify_func(bar_info_notify_cb, bd); - bar_info_write(bd); - file_data_register_notify_func(bar_info_notify_cb, bd, NOTIFY_PRIORITY_LOW); -} - -static void bar_info_mark_edited (GtkCellRendererText *cell, const gchar *path, const gchar *text, gpointer data) -{ - BarInfoData *bd = data; - GtkTreeModel *store; - GtkTreeIter iter; - GtkTreePath *tpath; - gchar *key = NULL; - gint i; - FileDataGetMarkFunc get_mark_func; - FileDataSetMarkFunc set_mark_func; - gpointer mark_func_data; - - file_data_unregister_notify_func(bar_info_notify_cb, bd); - - store = gtk_tree_view_get_model(GTK_TREE_VIEW(bd->keyword_treeview)); - - tpath = gtk_tree_path_new_from_string(path); - gtk_tree_model_get_iter(store, &iter, tpath); - gtk_tree_path_free(tpath); - - gtk_tree_model_get(store, &iter, KEYWORD_COLUMN_TEXT, &key, -1); - - for (i = 0; i < FILEDATA_MARKS_SIZE; i++) - { - file_data_get_registered_mark_func(i, &get_mark_func, &set_mark_func, &mark_func_data); - if (get_mark_func == meta_data_get_keyword_mark && strcmp(mark_func_data, key) == 0) - { - g_free(mark_func_data); - file_data_register_mark_func(i, NULL, NULL, NULL); - } - } - - if (sscanf(text, " %d ", &i) &&i >=1 && i <= FILEDATA_MARKS_SIZE) - { - i--; - file_data_get_registered_mark_func(i, &get_mark_func, &set_mark_func, &mark_func_data); - if (get_mark_func == meta_data_get_keyword_mark && mark_func_data) g_free(mark_func_data); - file_data_register_mark_func(i, meta_data_get_keyword_mark, meta_data_set_keyword_mark, g_strdup(key)); - } - - g_free(key); - - file_data_register_notify_func(bar_info_notify_cb, bd, NOTIFY_PRIORITY_LOW); - bar_info_update(bd); -} - -void bar_info_close(GtkWidget *bar) -{ - BarInfoData *bd; - - bd = g_object_get_data(G_OBJECT(bar), "bar_info_data"); - if (!bd) return; - - gtk_widget_destroy(bd->vbox); -} - -static void bar_info_destroy(GtkWidget *widget, gpointer data) -{ - BarInfoData *bd = data; - - file_data_unregister_notify_func(bar_info_notify_cb, bd); - bar_list = g_list_remove(bar_list, bd); - - file_data_unref(bd->fd); - - g_free(bd); -} - -static GtkTreeModel *create_marks_list(void) -{ - GtkListStore *model; - GtkTreeIter iter; - gint i; - - /* create list store */ - model = gtk_list_store_new (1, G_TYPE_STRING); - for (i = 0; i < FILEDATA_MARKS_SIZE; i++) - { - char str[10]; - sprintf(str, " %d ", i + 1); - gtk_list_store_append (model, &iter); - gtk_list_store_set(model, &iter, 0, str, -1); - } - gtk_list_store_append (model, &iter); - gtk_list_store_set(model, &iter, 0, " ... ", -1); - return GTK_TREE_MODEL (model); -} - -GtkWidget *bar_info_new(FileData *fd, gint metadata_only, GtkWidget *bounding_widget) -{ - BarInfoData *bd; - GtkWidget *box; - GtkWidget *hbox; - GtkWidget *table; - GtkWidget *scrolled; - GtkTextBuffer *buffer; - GtkWidget *label; - GtkWidget *tbar; - GtkListStore *store; - GtkTreeViewColumn *column; - GtkCellRenderer *renderer; - - bd = g_new0(BarInfoData, 1); - - bd->list_func = NULL; - bd->list_data = NULL; - - bd->vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP); - g_object_set_data(G_OBJECT(bd->vbox), "bar_info_data", bd); - g_signal_connect(G_OBJECT(bd->vbox), "destroy", - G_CALLBACK(bar_info_destroy), bd); - - if (!metadata_only) - { - hbox = pref_box_new(bd->vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_GAP); - - label = sizer_new(bd->vbox, bounding_widget, SIZER_POS_LEFT); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - label = gtk_label_new(_("Keywords")); - pref_label_bold(label, TRUE, FALSE); - gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); - gtk_widget_show(label); - } - - bd->group_box = pref_box_new(bd->vbox, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); - - if (!metadata_only) - { - GtkWidget *table; - - table = pref_table_new(bd->group_box, 2, 2, FALSE, FALSE); - - bd->label_file_name = table_add_line(table, 0, 0, _("Filename:"), NULL); - bd->label_file_time = table_add_line(table, 0, 1, _("File date:"), NULL); - } - else - { - bd->label_file_name = NULL; - bd->label_file_time = NULL; - } - - table = gtk_table_new(3, 1, TRUE); - gtk_table_set_row_spacings(GTK_TABLE(table), PREF_PAD_GAP); - gtk_box_pack_start(GTK_BOX(bd->group_box), table, TRUE, TRUE, 0); - gtk_widget_show(table); - - /* keyword entry */ - - box = gtk_vbox_new(FALSE, 0); - gtk_table_attach(GTK_TABLE(table), box, 0, 1, 0, 2, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_widget_show(box); - - label = pref_label_new(box, _("Keywords:")); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - pref_label_bold(label, TRUE, FALSE); - - hbox = pref_box_new(box, TRUE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_GAP); - - scrolled = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start(GTK_BOX(hbox), scrolled, TRUE, TRUE, 0); - gtk_widget_show(scrolled); - - bd->keyword_view = gtk_text_view_new(); - gtk_container_add(GTK_CONTAINER(scrolled), bd->keyword_view); - gtk_widget_show(bd->keyword_view); - - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bd->keyword_view)); - g_signal_connect(G_OBJECT(buffer), "changed", - G_CALLBACK(bar_info_changed), bd); - - scrolled = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start(GTK_BOX(hbox), scrolled, TRUE, TRUE, 0); - gtk_widget_show(scrolled); - - store = gtk_list_store_new(3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING); - bd->keyword_treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); - g_object_unref(store); - - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(bd->keyword_treeview), FALSE); - - if (metadata_only) - { - gtk_tree_view_set_search_column(GTK_TREE_VIEW(bd->keyword_treeview), KEYWORD_COLUMN_TEXT); - } - else - { - gtk_tree_view_set_enable_search(GTK_TREE_VIEW(bd->keyword_treeview), FALSE); - } - - column = gtk_tree_view_column_new(); - gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); - - renderer = gtk_cell_renderer_toggle_new(); - gtk_tree_view_column_pack_start(column, renderer, FALSE); - gtk_tree_view_column_add_attribute(column, renderer, "active", KEYWORD_COLUMN_TOGGLE); - g_signal_connect(G_OBJECT(renderer), "toggled", - G_CALLBACK(bar_info_keyword_toggle), bd); - - renderer = gtk_cell_renderer_text_new(); - gtk_tree_view_column_pack_start(column, renderer, TRUE); - gtk_tree_view_column_add_attribute(column, renderer, "text", KEYWORD_COLUMN_TEXT); - - gtk_tree_view_append_column(GTK_TREE_VIEW(bd->keyword_treeview), column); - - column = gtk_tree_view_column_new(); - gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY); - - renderer = gtk_cell_renderer_combo_new(); - g_object_set(G_OBJECT(renderer), "editable", (gboolean)TRUE, - "model", create_marks_list(), - "text-column", 0, - "has-entry", FALSE, - NULL); - - gtk_tree_view_column_pack_start(column, renderer, TRUE); - gtk_tree_view_column_add_attribute(column, renderer, "text", KEYWORD_COLUMN_MARK); - g_signal_connect (renderer, "edited", - G_CALLBACK (bar_info_mark_edited), bd); - gtk_tree_view_append_column(GTK_TREE_VIEW(bd->keyword_treeview), column); - - - gtk_container_add(GTK_CONTAINER(scrolled), bd->keyword_treeview); - gtk_widget_show(bd->keyword_treeview); - - /* comment entry */ - - box = gtk_vbox_new(FALSE, 0); - gtk_table_attach(GTK_TABLE(table), box, 0, 1, 2, 3, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_widget_show(box); - - label = pref_label_new(box, _("Comment:")); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - pref_label_bold(label, TRUE, FALSE); - - scrolled = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start(GTK_BOX(box), scrolled, TRUE, TRUE, 0); - gtk_widget_show(scrolled); - - bd->comment_view = gtk_text_view_new(); - gtk_container_add(GTK_CONTAINER(scrolled), bd->comment_view); - gtk_widget_show(bd->comment_view); - - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bd->comment_view)); - g_signal_connect(G_OBJECT(buffer), "changed", - G_CALLBACK(bar_info_changed), bd); - - /* toolbar */ - - tbar = pref_toolbar_new(bd->group_box, GTK_TOOLBAR_ICONS); - - pref_toolbar_button(tbar, GTK_STOCK_INDEX, NULL, FALSE, - _("Edit favorite keywords list."), - G_CALLBACK(bar_keyword_edit_cb), bd); - pref_toolbar_spacer(tbar); - bd->button_set_keywords_add = pref_toolbar_button(tbar, GTK_STOCK_ADD, NULL, FALSE, - _("Add keywords to selected files"), - G_CALLBACK(bar_info_set_keywords_add), bd); - bd->button_set_keywords_replace = pref_toolbar_button(tbar, GTK_STOCK_CONVERT, NULL, FALSE, - _("Add keywords to selected files, replacing existing ones"), - G_CALLBACK(bar_info_set_keywords_replace), bd); - bd->button_set_comment_add = pref_toolbar_button(tbar, GTK_STOCK_DND_MULTIPLE, NULL, FALSE, - _("Add comment to selected files"), - G_CALLBACK(bar_info_set_comment_add), bd); - bd->button_set_comment_replace = pref_toolbar_button(tbar, GTK_STOCK_DND, NULL, FALSE, - _("Add comment to selected files, replacing existing one"), - G_CALLBACK(bar_info_set_comment_replace), bd); - -#if 0 - pref_toolbar_spacer(tbar); - bd->button_save = pref_toolbar_button(tbar, GTK_STOCK_SAVE, NULL, FALSE, - _("Save comment now"), - G_CALLBACK(bar_info_save), bd); -#endif - - bd->fd = file_data_ref(fd); - bar_info_update(bd); - - bar_info_selection(bd->vbox, 0); - - bar_list = g_list_append(bar_list, bd); - - file_data_register_notify_func(bar_info_notify_cb, bd, NOTIFY_PRIORITY_LOW); - - return bd->vbox; -} - -void bar_info_set_selection_func(GtkWidget *bar, GList *(*list_func)(gpointer data), gpointer data) -{ - BarInfoData *bd; - - bd = g_object_get_data(G_OBJECT(bar), "bar_info_data"); - if (!bd) return; - - bd->list_func = list_func; - bd->list_data = data; -} - -void bar_info_selection(GtkWidget *bar, gint count) -{ - BarInfoData *bd; - gint enable; - - bd = g_object_get_data(G_OBJECT(bar), "bar_info_data"); - if (!bd) return; - - enable = (count > 0 && bd->list_func != NULL); - - gtk_widget_set_sensitive(bd->button_set_keywords_add, enable); - gtk_widget_set_sensitive(bd->button_set_keywords_replace, enable); - gtk_widget_set_sensitive(bd->button_set_comment_add, enable); - gtk_widget_set_sensitive(bd->button_set_comment_replace, enable); - -} -/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/bar_info.h Sat Feb 14 19:50:54 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Geeqie - * (C) 2004 John Ellis - * Copyright (C) 2008 - 2009 The Geeqie Team - * - * Author: John Ellis - * - * This software is released under the GNU General Public License (GNU GPL). - * Please read the included file COPYING for more information. - * This software comes with no warranty of any kind, use at your own risk! - */ - - -#ifndef BAR_INFO_H -#define BAR_INFO_H - - -GtkWidget *bar_info_new(FileData *fd, gint metadata_only, GtkWidget *bounding_widget); -void bar_info_close(GtkWidget *bar); - -void bar_info_set(GtkWidget *bar, FileData *fd); -gint bar_info_event(GtkWidget *bar, GdkEvent *event); - -void bar_info_set_selection_func(GtkWidget *bar, GList *(*list_func)(gpointer data), gpointer data); -void bar_info_selection(GtkWidget *bar, gint count); - -void bar_info_maint_renamed(GtkWidget *bar, FileData *fd); - -GList *keyword_list_pull(GtkWidget *text_widget); -void keyword_list_push(GtkWidget *textview, GList *list); - - -#endif -/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/bar_keywords.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/bar_keywords.c Sat Feb 14 20:26:30 2009 +0000 @@ -16,7 +16,6 @@ #include "filedata.h" #include "history_list.h" -#include "info.h" #include "metadata.h" #include "misc.h" #include "ui_fileops.h" @@ -48,7 +47,7 @@ */ -static GList *keyword_list_pull(GtkWidget *text_widget) +GList *keyword_list_pull(GtkWidget *text_widget) { GList *list; gchar *text;
--- a/src/bar_keywords.h Sat Feb 14 19:50:54 2009 +0000 +++ b/src/bar_keywords.h Sat Feb 14 20:26:30 2009 +0000 @@ -16,5 +16,9 @@ GtkWidget *bar_pane_keywords_new(const gchar *title, const gchar *key); + +/* used in search.c */ +GList *keyword_list_pull(GtkWidget *text_widget); + #endif /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/collect-table.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/collect-table.c Sat Feb 14 20:26:30 2009 +0000 @@ -22,7 +22,6 @@ #include "editors.h" #include "filedata.h" #include "img-view.h" -#include "info.h" #include "layout.h" #include "layout_image.h" #include "menu.h" @@ -669,13 +668,6 @@ } } -static void collection_table_popup_info_cb(GtkWidget *widget, gpointer data) -{ - CollectTable *ct = data; - - info_window_new(NULL, collection_table_popup_file_list(ct), NULL); -} - static void collection_table_popup_copy_cb(GtkWidget *widget, gpointer data) { CollectTable *ct = data; @@ -889,8 +881,6 @@ G_CALLBACK(collection_table_popup_edit_cb), ct); gtk_widget_set_sensitive(item, over_icon); - menu_item_add_sensitive(menu, _("_Properties"), over_icon, - G_CALLBACK(collection_table_popup_info_cb), ct); menu_item_add_divider(menu); menu_item_add_stock_sensitive(menu, _("_Copy..."), GTK_STOCK_COPY, over_icon, G_CALLBACK(collection_table_popup_copy_cb), ct);
--- a/src/collect.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/collect.c Sat Feb 14 20:26:30 2009 +0000 @@ -20,7 +20,6 @@ #include "editors.h" #include "filedata.h" #include "img-view.h" -#include "info.h" #include "layout.h" #include "layout_image.h" #include "misc.h" @@ -861,9 +860,6 @@ case 'D': case 'd': file_util_delete(NULL, collection_table_selection_get_list(cw->table), cw->window); break; - case 'P': case 'p': - info_window_new(NULL, collection_table_selection_get_list(cw->table), NULL); - break; case 'S': case 's': collection_dialog_save_as(NULL, cw->cd); break;
--- a/src/dupe.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/dupe.c Sat Feb 14 20:26:30 2009 +0000 @@ -22,7 +22,6 @@ #include "filedata.h" #include "image-load.h" #include "img-view.h" -#include "info.h" #include "layout.h" #include "layout_image.h" #include "md5-util.h" @@ -2147,13 +2146,6 @@ dupe_window_edit_selected(dw, key); } -static void dupe_menu_info_cb(GtkWidget *widget, gpointer data) -{ - DupeWindow *dw = data; - - info_window_new(NULL, dupe_listview_get_selection(dw, dw->listview), NULL); -} - static void dupe_menu_collection_cb(GtkWidget *widget, gpointer data) { DupeWindow *dw = data; @@ -2254,8 +2246,6 @@ menu_item_add_divider(menu); submenu_add_edit(menu, &item, G_CALLBACK(dupe_menu_edit_cb), dw); if (!on_row) gtk_widget_set_sensitive(item, FALSE); - menu_item_add_stock_sensitive(menu, _("_Properties"), GTK_STOCK_PROPERTIES, on_row, - G_CALLBACK(dupe_menu_info_cb), dw); menu_item_add_stock_sensitive(menu, _("Add to new collection"), GTK_STOCK_INDEX, on_row, G_CALLBACK(dupe_menu_collection_cb), dw); menu_item_add_stock_sensitive(menu, _("Print..."), GTK_STOCK_PRINT, on_row, @@ -2939,9 +2929,6 @@ case 'D': case 'd': file_util_delete(NULL, dupe_listview_get_selection(dw, listview), dw->window); break; - case 'P': case 'p': - info_window_new(NULL, dupe_listview_get_selection(dw, listview), NULL); - break; default: stop_signal = FALSE; break;
--- a/src/img-view.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/img-view.c Sat Feb 14 20:26:30 2009 +0000 @@ -22,7 +22,6 @@ #include "fullscreen.h" #include "image.h" #include "image-overlay.h" -#include "info.h" #include "layout.h" #include "layout_image.h" #include "menu.h" @@ -421,9 +420,6 @@ case 'D': case 'd': file_util_delete(image_get_fd(imd), NULL, imd->widget); break; - case 'P': case 'p': - info_window_new(image_get_fd(imd), NULL, vw->fs ? vw->fs->window : NULL); - break; case 'W': case 'w': view_window_close(vw); break; @@ -1102,15 +1098,6 @@ image_alter(vw->imd, type); } -static void view_info_cb(GtkWidget *widget, gpointer data) -{ - ViewWindow *vw = data; - ImageWindow *imd; - - imd = view_window_active_image(vw); - info_window_new(image_get_fd(imd), NULL, vw->fs ? vw->fs->window : NULL); -} - static void view_wallpaper_cb(GtkWidget *widget, gpointer data) { ViewWindow *vw = data; @@ -1276,8 +1263,6 @@ submenu_add_alter(menu, G_CALLBACK(view_alter_cb), vw); - menu_item_add_stock(menu, _("_Properties"), GTK_STOCK_PROPERTIES, G_CALLBACK(view_info_cb), vw); - menu_item_add_stock(menu, _("View in _new window"), GTK_STOCK_NEW, G_CALLBACK(view_new_window_cb), vw); item = menu_item_add(menu, _("_Go to directory view"), G_CALLBACK(view_set_layout_path_cb), vw);
--- a/src/info.c Sat Feb 14 19:50:54 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,953 +0,0 @@ -/* - * Geeqie - * (C) 2004 John Ellis - * Copyright (C) 2008 - 2009 The Geeqie Team - * - * Author: John Ellis - * - * This software is released under the GNU General Public License (GNU GPL). - * Please read the included file COPYING for more information. - * This software comes with no warranty of any kind, use at your own risk! - */ - - -#include "main.h" -#include "info.h" - -#include "bar_info.h" -#include "bar_exif.h" -#include "dnd.h" -#include "filedata.h" -#include "image.h" -#include "image-load.h" -#include "pixbuf-renderer.h" -#include "ui_fileops.h" -#include "ui_misc.h" -#include "uri_utils.h" -#include "window.h" - -#include <pwd.h> -#include <grp.h> - - -#define IMAGE_SIZE_W 200 -#define IMAGE_SIZE_H 200 - - -typedef struct _TabData TabData; -struct _TabData -{ - void (*func_free)(gpointer data); - void (*func_sync)(InfoData *id, gpointer data); - void (*func_image)(InfoData *id, gpointer data); - gpointer data; - TabData *(*func_new)(InfoData *id); - GtkWidget *child; -}; - -typedef struct _InfoTabsPos InfoTabsPos; -struct _InfoTabsPos -{ - TabData *(*func)(InfoData *id); - guint pos; -}; - -static GList *info_tabs_pos_list = NULL; - -static void notebook_set_tab_reorderable(GtkNotebook *notebook, GtkWidget *child, gboolean reorderable) -{ -#if GTK_CHECK_VERSION(2,10,0) - gtk_notebook_set_tab_reorderable(notebook, child, reorderable); -#endif -} - -/* - *------------------------------------------------------------------- - * table utils - *------------------------------------------------------------------- - */ - -GtkWidget *table_add_line(GtkWidget *table, gint x, gint y, - const gchar *description, const gchar *text) -{ - GtkWidget *label; - - if (!text) text = ""; - - label = pref_table_label(table, x, y, description, 1.0); - pref_label_bold(label, TRUE, FALSE); - - label = pref_table_label(table, x + 1, y, text, 0.0); - return label; -} - -/* - *------------------------------------------------------------------- - * EXIF tab - *------------------------------------------------------------------- - */ - -static void info_tab_exif_image(InfoData *id, gpointer data) -{ - GtkWidget *bar = data; - FileData *fd; - - if (id->image->unknown) - { - fd = NULL; - } - else - { - fd = id->image->image_fd; - } - - bar_exif_set(bar, fd); -} - -static void info_tab_exif_sync(InfoData *id, gpointer data) -{ - GtkWidget *bar = data; - - bar_exif_set(bar, NULL); -} - -static TabData *info_tab_exif_new(InfoData *id) -{ - TabData *td; - GtkWidget *bar; - GtkWidget *label; - - bar = bar_exif_new(FALSE, NULL, FALSE, NULL); - gtk_container_set_border_width(GTK_CONTAINER(bar), PREF_PAD_BORDER); - - label = gtk_label_new(_("Exif")); - gtk_notebook_append_page(GTK_NOTEBOOK(id->notebook), bar, label); - notebook_set_tab_reorderable(GTK_NOTEBOOK(id->notebook), bar, TRUE); - gtk_widget_show(bar); - - /* register */ - td = g_new0(TabData, 1); - td->func_free = NULL; - td->func_sync = info_tab_exif_sync; - td->func_image = info_tab_exif_image; - td->data = bar; - td->func_new = info_tab_exif_new; - td->child = bar; - - return td; -} - -/* - *------------------------------------------------------------------- - * file attributes tab - *------------------------------------------------------------------- - */ - -typedef struct _InfoTabMeta InfoTabMeta; -struct _InfoTabMeta -{ - GtkWidget *bar_info; -}; - -static void info_tab_meta_free(gpointer data) -{ - InfoTabMeta *tab = data; - - g_free(tab); -} - -static void info_tab_meta_sync(InfoData *id, gpointer data) -{ - InfoTabMeta *tab = data; - - bar_info_set(tab->bar_info, id->fd); -} - -static GList *info_tab_meta_list_cb(gpointer data) -{ - InfoData *id = data; - - return filelist_copy(id->list); -} - -static TabData *info_tab_meta_new(InfoData *id) -{ - TabData *td; - InfoTabMeta *tab; - GtkWidget *label; - - tab = g_new0(InfoTabMeta, 1); - - tab->bar_info = bar_info_new(NULL, TRUE, NULL); - bar_info_set_selection_func(tab->bar_info, info_tab_meta_list_cb, id); - bar_info_selection(tab->bar_info, g_list_length(id->list) - 1); - - gtk_container_set_border_width(GTK_CONTAINER(tab->bar_info), PREF_PAD_BORDER); - - label = gtk_label_new(_("Keywords")); - gtk_notebook_append_page(GTK_NOTEBOOK(id->notebook), tab->bar_info, label); - notebook_set_tab_reorderable(GTK_NOTEBOOK(id->notebook), tab->bar_info, TRUE); - gtk_widget_show(tab->bar_info); - - /* register */ - td = g_new0(TabData, 1); - td->func_free = info_tab_meta_free; - td->func_sync = info_tab_meta_sync; - td->func_image = NULL; - td->data = tab; - td->func_new = info_tab_meta_new; - td->child = tab->bar_info; - - return td; -} - -/* - *------------------------------------------------------------------- - * general tab - *------------------------------------------------------------------- - */ - -typedef struct _InfoTabGeneral InfoTabGeneral; -struct _InfoTabGeneral -{ - GtkWidget *label_file_time; - GtkWidget *label_file_size; - GtkWidget *label_dimensions; - GtkWidget *label_transparent; - GtkWidget *label_image_size; - GtkWidget *label_compression; - GtkWidget *label_mime_type; - - GtkWidget *label_user; - GtkWidget *label_group; - GtkWidget *label_perms; - - gint compression_done; - gint64 byte_size; -}; - -static void info_tab_general_image(InfoData *id, gpointer data) -{ - InfoTabGeneral *tab = data; - gchar *buf; - guint mem_size; - gint has_alpha; - GdkPixbuf *pixbuf; - gint width, height; - - if (id->image->unknown) return; - - image_get_image_size(id->image, &width, &height); - - buf = g_strdup_printf("%d x %d", width, height); - gtk_label_set_text(GTK_LABEL(tab->label_dimensions), buf); - g_free(buf); - - pixbuf = image_get_pixbuf(id->image); - if (pixbuf) - { - has_alpha = gdk_pixbuf_get_has_alpha(pixbuf); - } - else - { - has_alpha = FALSE; - } - gtk_label_set_text(GTK_LABEL(tab->label_transparent), has_alpha ? _("yes") : _("no")); - - mem_size = width * height * ((has_alpha) ? 4 : 3); - buf = text_from_size_abrev(mem_size); - gtk_label_set_text(GTK_LABEL(tab->label_image_size), buf); - g_free(buf); - - if (!tab->compression_done && mem_size > 0) - { - buf = g_strdup_printf("%.1f%%", (gdouble)tab->byte_size / mem_size * 100.0); - gtk_label_set_text(GTK_LABEL(tab->label_compression), buf); - g_free(buf); - - tab->compression_done = TRUE; - } - - buf = image_loader_get_format(id->image->il); - if (buf) - gtk_label_set_text(GTK_LABEL(tab->label_mime_type), buf); - g_free(buf); -} - -static gchar *mode_number(mode_t m) -{ - gint mb, mu, mg, mo; - - mb = mu = mg = mo = 0; - - if (m & S_ISUID) mb |= 4; - if (m & S_ISGID) mb |= 2; - if (m & S_ISVTX) mb |= 1; - - if (m & S_IRUSR) mu |= 4; - if (m & S_IWUSR) mu |= 2; - if (m & S_IXUSR) mu |= 1; - - if (m & S_IRGRP) mg |= 4; - if (m & S_IWGRP) mg |= 2; - if (m & S_IXGRP) mg |= 1; - - if (m & S_IROTH) mo |= 4; - if (m & S_IWOTH) mo |= 2; - if (m & S_IXOTH) mo |= 1; - - return g_strdup_printf("%d%d%d%d", mb, mu, mg, mo); -} - -static void info_tab_general_sync_perm(InfoTabGeneral *tab, InfoData *id) -{ - struct stat st; - - if (!stat_utf8(id->fd->path, &st)) - { - gtk_label_set_text(GTK_LABEL(tab->label_user), ""); - gtk_label_set_text(GTK_LABEL(tab->label_group), ""); - gtk_label_set_text(GTK_LABEL(tab->label_perms), ""); - } - else - { - struct passwd *user; - struct group *grp; - gchar pbuf[12]; - gchar *pmod; - gchar *buf; - - user = getpwuid(st.st_uid); - gtk_label_set_text(GTK_LABEL(tab->label_user), (user) ? user->pw_name : ""); - - grp = getgrgid(st.st_gid); - gtk_label_set_text(GTK_LABEL(tab->label_group), (grp) ? grp->gr_name : ""); - - pbuf[0] = (st.st_mode & S_IRUSR) ? 'r' : '-'; - pbuf[1] = (st.st_mode & S_IWUSR) ? 'w' : '-'; - pbuf[2] = (st.st_mode & S_IXUSR) ? 'x' : '-'; - pbuf[3] = (st.st_mode & S_IRGRP) ? 'r' : '-'; - pbuf[4] = (st.st_mode & S_IWGRP) ? 'w' : '-'; - pbuf[5] = (st.st_mode & S_IXGRP) ? 'x' : '-'; - pbuf[6] = (st.st_mode & S_IROTH) ? 'r' : '-'; - pbuf[7] = (st.st_mode & S_IWOTH) ? 'w' : '-'; - pbuf[8] = (st.st_mode & S_IXOTH) ? 'x' : '-'; - pbuf[9] = '\0'; - - pmod = mode_number(st.st_mode); - buf = g_strdup_printf("%s (%s)", pbuf, pmod); - gtk_label_set_text(GTK_LABEL(tab->label_perms), buf); - g_free(buf); - g_free(pmod); - } -} - -static void info_tab_general_sync(InfoData *id, gpointer data) -{ - InfoTabGeneral *tab = data; - gchar *buf; - - gtk_label_set_text(GTK_LABEL(tab->label_file_time), text_from_time(id->fd->date)); - - tab->byte_size = id->fd->size; - - buf = text_from_size(tab->byte_size); - gtk_label_set_text(GTK_LABEL(tab->label_file_size), buf); - g_free(buf); - - gtk_label_set_text(GTK_LABEL(tab->label_dimensions), ""); - gtk_label_set_text(GTK_LABEL(tab->label_transparent), ""); - gtk_label_set_text(GTK_LABEL(tab->label_image_size), ""); - - gtk_label_set_text(GTK_LABEL(tab->label_compression), ""); - gtk_label_set_text(GTK_LABEL(tab->label_mime_type), ""); - - info_tab_general_sync_perm(tab, id); - - tab->compression_done = FALSE; -} - -static void info_tab_general_free(gpointer data) -{ - InfoTabGeneral *tab = data; - - g_free(tab); -} - -static TabData *info_tab_general_new(InfoData *id) -{ - TabData *td; - InfoTabGeneral *tab; - GtkWidget *table; - GtkWidget *label; - - tab = g_new0(InfoTabGeneral, 1); - - table = pref_table_new(NULL, 2, 11, FALSE, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(table), PREF_PAD_BORDER); - - tab->label_file_time = table_add_line(table, 0, 0, _("File date:"), NULL); - tab->label_file_size = table_add_line(table, 0, 1, _("File size:"), NULL); - - tab->label_dimensions = table_add_line(table, 0, 2, _("Dimensions:"), NULL); - tab->label_transparent = table_add_line(table, 0, 3, _("Transparent:"), NULL); - tab->label_image_size = table_add_line(table, 0, 4, _("Image size:"), NULL); - - tab->label_compression = table_add_line(table, 0, 5, _("Compress ratio:"), NULL); - tab->label_mime_type = table_add_line(table, 0, 6, _("File type:"), NULL); - - tab->label_user = table_add_line(table, 0, 7, _("Owner:"), NULL); - tab->label_group = table_add_line(table, 0, 8, _("Group:"), NULL); - tab->label_perms = table_add_line(table, 0, 9, "", NULL); - - label = gtk_label_new(_("General")); - gtk_notebook_append_page(GTK_NOTEBOOK(id->notebook), table, label); - notebook_set_tab_reorderable(GTK_NOTEBOOK(id->notebook), table, TRUE); - gtk_widget_show(table); - - /* register */ - td = g_new0(TabData, 1); - td->func_free = info_tab_general_free; - td->func_sync = info_tab_general_sync; - td->func_image = info_tab_general_image; - td->data = tab; - td->func_new = info_tab_general_new; - td->child = table; - - return td; -} - -/* - *------------------------------------------------------------------- - * tabs - *------------------------------------------------------------------- - */ - -static void info_tabs_sync(InfoData *id, gint image) -{ - GList *work; - - work = id->tab_list; - while (work) - { - TabData *td = work->data; - work = work->next; - - if (image) - { - if (td->func_image) td->func_image(id, td->data); - } - else - { - if (td->func_sync) td->func_sync(id, td->data); - } - } -} - -static void info_tabs_free(InfoData *id) -{ - GList *work; - - work = id->tab_list; - while (work) - { - TabData *td = work->data; - work = work->next; - - if (td->func_free) td->func_free(td->data); - g_free(td); - } - g_list_free(id->tab_list); - id->tab_list = NULL; -} - -static InfoTabsPos *info_tabs_pos_new(gpointer func, gint pos) -{ - InfoTabsPos *t = g_new0(InfoTabsPos, 1); - t->func = func; - t->pos = pos; - - return t; -} - -static void info_tabs_pos_list_append(gpointer func) -{ - static gint pos = 0; - - info_tabs_pos_list = g_list_append(info_tabs_pos_list, info_tabs_pos_new(func, pos++)); -} - -static gint compare_info_tabs_pos(gconstpointer a, gconstpointer b) -{ - InfoTabsPos *ta = (InfoTabsPos *) a; - InfoTabsPos *tb = (InfoTabsPos *) b; - - if (ta->pos > tb->pos) return 1; - return -1; -} - -static gpointer info_tab_new_funcs[] = { - info_tab_general_new, - info_tab_meta_new, - info_tab_exif_new, -}; - -gchar *info_tab_default_order(void) -{ - guint i; - static gchar str[G_N_ELEMENTS(info_tab_new_funcs) + 1]; - - for (i = 0; i < G_N_ELEMENTS(info_tab_new_funcs); i++) - str[i] = i + '1'; - str[i] = '\0'; - - return str; -} - -static void info_tab_get_order_string(gchar **dest) -{ - GList *work; - gchar str[G_N_ELEMENTS(info_tab_new_funcs) + 1]; - - g_assert(dest); - - if (!info_tabs_pos_list) - return; - - memset(str, 0, G_N_ELEMENTS(info_tab_new_funcs) + 1); - - work = info_tabs_pos_list; - while (work) - { - guint i; - InfoTabsPos *t = work->data; - work = work->next; - - for (i = 0; i < G_N_ELEMENTS(info_tab_new_funcs); i++) - { - if (t->func == info_tab_new_funcs[i]) - { - g_assert(t->pos < G_N_ELEMENTS(info_tab_new_funcs)); - str[t->pos] = i + '1'; - } - } - } - - if (strlen(str) != G_N_ELEMENTS(info_tab_new_funcs)) return; - - g_free(*dest); - *dest = g_strdup(str); -} - -static void info_tabs_init(InfoData *id) -{ - GList *work; - - if (!info_tabs_pos_list) - { - guint count = 0; - guint i; - gchar *order = options->properties.tabs_order; - - for (i = 0; i < strlen(order); i++) - { - guint n = order[i] - '1'; - - if (n >= G_N_ELEMENTS(info_tab_new_funcs)) break; - count++; - } - - if (count != G_N_ELEMENTS(info_tab_new_funcs)) - order = info_tab_default_order(); - - for (i = 0; i < strlen(order); i++) - { - guint n = order[i] - '1'; - - if (n >= G_N_ELEMENTS(info_tab_new_funcs)) continue; - if (g_list_find(info_tabs_pos_list, info_tab_new_funcs[n])) continue; - info_tabs_pos_list_append(info_tab_new_funcs[n]); - } - } - else - info_tabs_pos_list = g_list_sort(info_tabs_pos_list, compare_info_tabs_pos); - - info_tab_get_order_string(&options->properties.tabs_order); - - work = info_tabs_pos_list; - while (work) - { - InfoTabsPos *t = work->data; - work = work->next; - - id->tab_list = g_list_append(id->tab_list, t->func(id)); - } -} - -/* - *------------------------------------------------------------------- - * sync - *------------------------------------------------------------------- - */ - -static void info_window_sync(InfoData *id, FileData *fd) -{ - - if (!fd) return; - - gtk_entry_set_text(GTK_ENTRY(id->name_entry), fd->name); - - if (id->label_count) - { - gchar *buf; - buf = g_strdup_printf(_("Image %d of %d"), - g_list_index(id->list, (gpointer)fd) + 1, - g_list_length(id->list)); - gtk_label_set_text(GTK_LABEL(id->label_count), buf); - g_free(buf); - } - - info_tabs_sync(id, FALSE); - - id->updated = FALSE; - image_change_fd(id->image, fd, 0.0); -} - -static void info_notebook_reordered_cb(GtkNotebook *notebook, GtkWidget *child, guint page_num, gpointer data) -{ - InfoData *id = data; - GList *work; - - /* Save current tabs position to be able to restore them later. */ - work = id->tab_list; - while (work) - { - GList *tabpos; - TabData *td = work->data; - gint pos = gtk_notebook_page_num(GTK_NOTEBOOK(id->notebook), GTK_WIDGET(td->child)); - work = work->next; - - tabpos = info_tabs_pos_list; - while (tabpos) - { - InfoTabsPos *t = tabpos->data; - tabpos = tabpos->next; - - if (t->func == td->func_new) - { - t->pos = pos; - break; - } - } - } - - info_tabs_pos_list = g_list_sort(info_tabs_pos_list, compare_info_tabs_pos); - info_tab_get_order_string(&options->properties.tabs_order); -} - -/* - *------------------------------------------------------------------- - * drag n drop (dropping not supported!) - *------------------------------------------------------------------- - */ - -static void info_window_dnd_data_set(GtkWidget *widget, GdkDragContext *context, - GtkSelectionData *selection_data, guint info, - guint time, gpointer data) -{ - InfoData *id = data; - FileData *fd; - - fd = image_get_fd(id->image); - if (fd) - { - gchar *text; - gint len; - GList *list; - gint plain_text; - - switch (info) - { - case TARGET_URI_LIST: - plain_text = FALSE; - break; - case TARGET_TEXT_PLAIN: - default: - plain_text = TRUE; - break; - } - list = g_list_append(NULL, fd); - text = uri_text_from_filelist(list, &len, plain_text); - g_list_free(list); - - gtk_selection_data_set(selection_data, selection_data->target, - 8, (guchar *)text, len); - g_free(text); - } -} - -static void info_window_dnd_init(InfoData *id) -{ - ImageWindow *imd; - - imd = id->image; - - gtk_drag_source_set(imd->pr, GDK_BUTTON2_MASK, - dnd_file_drag_types, dnd_file_drag_types_count, - GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); - g_signal_connect(G_OBJECT(imd->pr), "drag_data_get", - G_CALLBACK(info_window_dnd_data_set), id); - -#if 0 - gtk_drag_dest_set(imd->pr, - GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, - dnd_file_drop_types, dnd_file_drop_types_count, - GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); - g_signal_connect(G_OBJECT(imd->pr), "drag_data_received", - G_CALLBACK(info_window_dnd_data_get), id); -#endif -} - -/* - *------------------------------------------------------------------- - * base window - *------------------------------------------------------------------- - */ - -static void info_window_image_update_cb(ImageWindow *imd, gpointer data) -{ - InfoData *id = data; - - /* only do this once after when loading a new image, - * for tabs that depend on image data (exif) - * Subsequent updates are ignored, as the image - * should not really changed if id->updated is TRUE. - */ - - if (id->updated) return; - if (imd->unknown) return; - - info_tabs_sync(id, TRUE); - id->updated = TRUE; -} - -static void info_window_back_cb(GtkWidget *widget, gpointer data) -{ - InfoData *id = data; - GList *work; - - work = g_list_find(id->list, (gpointer)id->fd); - if (!work || !work->prev) return; - - work = work->prev; - id->fd = work->data; - - info_window_sync(id, id->fd); - - gtk_widget_set_sensitive(id->button_back, (work->prev != NULL)); - gtk_widget_set_sensitive(id->button_next, TRUE); -} - -static void info_window_next_cb(GtkWidget *widget, gpointer data) -{ - InfoData *id = data; - GList *work; - - work = g_list_find(id->list, (gpointer)id->fd); - if (!work || !work->next) return; - - work = work->next; - id->fd = work->data; - - info_window_sync(id, id->fd); - - gtk_widget_set_sensitive(id->button_next, (work->next != NULL)); - gtk_widget_set_sensitive(id->button_back, TRUE); -} - -static void info_window_image_button_cb(ImageWindow *imd, GdkEventButton *event, gpointer data) -{ - if (event->button == MOUSE_BUTTON_LEFT) - { - info_window_next_cb(NULL, data); - } - else if (event->button == MOUSE_BUTTON_MIDDLE || event->button == MOUSE_BUTTON_RIGHT) - { - info_window_back_cb(NULL, data); - } -} - -static void info_window_image_scroll_cb(ImageWindow *imd, GdkEventScroll *event, gpointer data) -{ - if (event->direction == GDK_SCROLL_UP) - { - info_window_back_cb(NULL, data); - } - else if (event->direction == GDK_SCROLL_DOWN) - { - info_window_next_cb(NULL, data); - } -} - -static void info_window_close(InfoData *id) -{ - gdk_drawable_get_size(id->window->window, &options->layout.properties_window.w, &options->layout.properties_window.h); - options->layout.properties_window.w = MAX(options->layout.properties_window.w, DEF_PROPERTY_WIDTH); - options->layout.properties_window.h = MAX(options->layout.properties_window.h, DEF_PROPERTY_HEIGHT); - - gtk_widget_destroy(id->window); -} - -static void info_window_close_cb(GtkWidget *widget, gpointer data) -{ - InfoData *id = data; - - info_window_close(id); -} - -static gint info_window_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) -{ - InfoData *id = data; - - info_window_close(id); - return TRUE; -} - -static void info_window_destroy_cb(GtkWidget *widget, gpointer data) -{ - InfoData *id = data; - - info_tabs_free(id); - filelist_free(id->list); - g_free(id); -} - -void info_window_new(FileData *fd, GList *list, GtkWidget *parent) -{ - InfoData *id; - GtkWidget *main_vbox; - GtkWidget *paned; - GtkWidget *hbox; - GtkWidget *button; - GtkWidget *label; - GdkGeometry geometry; - static gboolean run_once = FALSE; - - if (!fd && !list) return; - - run_once = TRUE; - - if (!list) - { - list = g_list_append(NULL, file_data_ref(fd)); - } - - id = g_new0(InfoData, 1); - - id->list = list; - id->fd = (FileData *)id->list->data; - id->updated = FALSE; - - id->window = window_new(GTK_WINDOW_TOPLEVEL, "properties", NULL, NULL, _("Image properties")); - gtk_window_set_type_hint(GTK_WINDOW(id->window), GDK_WINDOW_TYPE_HINT_DIALOG); - id->parent = parent; - if (GTK_IS_WINDOW(id->parent)) { - gtk_window_set_keep_above(GTK_WINDOW(id->window), TRUE); -#if 0 - /* work, but behavior is not that great */ - gtk_window_set_transient_for(GTK_WINDOW(id->window), GTK_WINDOW(id->parent)); -#endif - } - gtk_window_set_resizable(GTK_WINDOW(id->window), TRUE); - - geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE; - geometry.min_height = DEFAULT_MINIMAL_WINDOW_SIZE; - geometry.base_width = DEF_PROPERTY_WIDTH; - geometry.base_height = DEF_PROPERTY_HEIGHT; - gtk_window_set_geometry_hints(GTK_WINDOW(id->window), NULL, &geometry, - GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE); - - if (options->layout.save_window_positions || run_once) - gtk_window_set_default_size(GTK_WINDOW(id->window), options->layout.properties_window.w, options->layout.properties_window.h); - else - gtk_window_set_default_size(GTK_WINDOW(id->window), DEF_PROPERTY_WIDTH, DEF_PROPERTY_HEIGHT); - - gtk_container_set_border_width(GTK_CONTAINER(id->window), PREF_PAD_BORDER); - - g_signal_connect(G_OBJECT(id->window), "delete_event", - G_CALLBACK(info_window_delete_cb), id); - g_signal_connect(G_OBJECT(id->window), "destroy", - G_CALLBACK(info_window_destroy_cb), id); - - paned = gtk_hpaned_new(); - gtk_container_add(GTK_CONTAINER(id->window), paned); - gtk_widget_show(paned); - - id->image = image_new(FALSE); - image_set_update_func(id->image, info_window_image_update_cb, id); - - image_set_button_func(id->image, info_window_image_button_cb, id); - image_set_scroll_func(id->image, info_window_image_scroll_cb, id); - - gtk_widget_set_size_request(id->image->widget, IMAGE_SIZE_W, IMAGE_SIZE_H); - gtk_paned_pack1(GTK_PANED(paned), id->image->widget, FALSE, TRUE); - gtk_widget_show(id->image->widget); - - main_vbox = gtk_vbox_new(FALSE, 0); - gtk_paned_pack2(GTK_PANED(paned), main_vbox, TRUE, TRUE); - gtk_widget_show(main_vbox); - - hbox = pref_box_new(main_vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); - label = pref_label_new(hbox, _("Filename:")); - pref_label_bold(label, TRUE, FALSE); - - id->name_entry = gtk_entry_new(); - gtk_editable_set_editable(GTK_EDITABLE(id->name_entry), FALSE); - gtk_box_pack_start(GTK_BOX(hbox), id->name_entry, TRUE, TRUE, 0); - gtk_widget_show(id->name_entry); - - id->notebook = gtk_notebook_new(); - gtk_notebook_set_tab_pos(GTK_NOTEBOOK(id->notebook), GTK_POS_TOP); - gtk_box_pack_start(GTK_BOX(main_vbox), id->notebook, TRUE, TRUE, 5); - g_signal_connect(G_OBJECT(id->notebook), "page-reordered", - G_CALLBACK(info_notebook_reordered_cb), id); - - gtk_widget_show(id->notebook); - - pref_spacer(main_vbox, PREF_PAD_GAP); - - hbox = pref_box_new(main_vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_GAP); - - id->button_back = pref_button_new(hbox, GTK_STOCK_GO_BACK, NULL, TRUE, - G_CALLBACK(info_window_back_cb), id); - gtk_widget_set_sensitive(id->button_back, FALSE); - - id->button_next = pref_button_new(hbox, GTK_STOCK_GO_FORWARD, NULL, TRUE, - G_CALLBACK(info_window_next_cb), id); - gtk_widget_set_sensitive(id->button_next, (id->list->next != NULL)); - - if (id->list->next) - { - id->label_count = pref_label_new(hbox, ""); - } - - button = pref_button_new(NULL, GTK_STOCK_CLOSE, NULL, FALSE, - G_CALLBACK(info_window_close_cb), id); - gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); - gtk_widget_show(button); - - /* set up tabs */ - - info_tabs_init(id); - - /* fill it */ - - info_window_sync(id, id->fd); - - /* finish */ - - info_window_dnd_init(id); - - gtk_widget_show(id->window); -} -/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/info.h Sat Feb 14 19:50:54 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Geeqie - * (C) 2004 John Ellis - * Copyright (C) 2008 - 2009 The Geeqie Team - * - * Author: John Ellis - * - * This software is released under the GNU General Public License (GNU GPL). - * Please read the included file COPYING for more information. - * This software comes with no warranty of any kind, use at your own risk! - */ - - -#ifndef INFO_H -#define INFO_H - -#define DEF_PROPERTY_WIDTH 600 -#define DEF_PROPERTY_HEIGHT 400 - - -typedef struct _InfoData InfoData; -struct _InfoData -{ - GtkWidget *window; - GtkWidget *parent; - - ImageWindow *image; - - GList *list; - - FileData *fd; - - GtkWidget *notebook; - GtkWidget *name_entry; - - GtkWidget *button_next; - GtkWidget *button_back; - GtkWidget *label_count; - - GList *tab_list; - - gint updated; -}; - - -void info_window_new(FileData *fd, GList *list, GtkWidget *parent); - -GtkWidget *table_add_line(GtkWidget *table, gint x, gint y, - const gchar *description, const gchar *text); - -gchar *info_tab_default_order(void); - -#endif -/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/layout_image.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/layout_image.c Sat Feb 14 20:26:30 2009 +0000 @@ -21,7 +21,6 @@ #include "image.h" #include "image-overlay.h" #include "img-view.h" -#include "info.h" #include "layout.h" #include "layout_util.h" #include "menu.h" @@ -338,13 +337,6 @@ image_alter(lw->image, type); } -static void li_pop_menu_info_cb(GtkWidget *widget, gpointer data) -{ - LayoutWindow *lw = data; - - info_window_new(layout_image_get_fd(lw), NULL, lw->full_screen ? lw->full_screen->window : NULL); -} - static void li_pop_menu_new_cb(GtkWidget *widget, gpointer data) { LayoutWindow *lw = data; @@ -494,9 +486,6 @@ item = submenu_add_alter(menu, G_CALLBACK(li_pop_menu_alter_cb), lw); - item = menu_item_add_stock(menu, _("_Properties"), GTK_STOCK_PROPERTIES, G_CALLBACK(li_pop_menu_info_cb), lw); - if (!path) gtk_widget_set_sensitive(item, FALSE); - item = menu_item_add_stock(menu, _("View in _new window"), GTK_STOCK_NEW, G_CALLBACK(li_pop_menu_new_cb), lw); if (!path || fullscreen) gtk_widget_set_sensitive(item, FALSE);
--- a/src/layout_util.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/layout_util.c Sat Feb 14 20:26:30 2009 +0000 @@ -27,7 +27,6 @@ #include "history_list.h" #include "image-overlay.h" #include "img-view.h" -#include "info.h" #include "layout_image.h" #include "logwindow.h" #include "misc.h" @@ -351,19 +350,6 @@ layout_image_alter(lw, ALTER_NONE); } -static void layout_menu_info_cb(GtkAction *action, gpointer data) -{ - LayoutWindow *lw = data; - GList *list; - FileData *fd = NULL; - - list = layout_selection_list(lw); - if (!list) fd = layout_image_get_fd(lw); - - info_window_new(fd, list, NULL); -} - - static void layout_menu_config_cb(GtkAction *action, gpointer data) { LayoutWindow *lw = data; @@ -1155,7 +1141,6 @@ { "Grayscale", NULL, N_("Toggle _grayscale"),"<shift>G", NULL, CB(layout_menu_alter_desaturate_cb) }, { "AlterNone", NULL, N_("_Original state"), "<shift>O", NULL, CB(layout_menu_alter_none_cb) }, - { "Properties",GTK_STOCK_PROPERTIES, N_("_Properties"), "<control>P", NULL, CB(layout_menu_info_cb) }, { "SelectAll", NULL, N_("Select _all"), "<control>A", NULL, CB(layout_menu_select_all_cb) }, { "SelectNone", NULL, N_("Select _none"), "<control><shift>A",NULL, CB(layout_menu_unselect_all_cb) }, { "SelectInvert", NULL, N_("_Invert Selection"), "<control><shift>I", NULL, CB(layout_menu_invert_selection_cb) }, @@ -1309,7 +1294,6 @@ " <menuitem action='Grayscale'/>" " <menuitem action='AlterNone'/>" " </menu>" -" <menuitem action='Properties'/>" " <placeholder name='PropertiesSection'/>" " <separator/>" " <menuitem action='Preferences'/>"
--- a/src/options.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/options.c Sat Feb 14 20:26:30 2009 +0000 @@ -17,7 +17,6 @@ #include "filefilter.h" #include "histogram.h" /* HCHAN_RGB */ #include "image-overlay.h" /* OSD_SHOW_NOTHING */ -#include "info.h" #include "layout.h" #include "layout_image.h" #include "rcfile.h" @@ -106,8 +105,6 @@ options->layout.main_window.x = 0; options->layout.main_window.y = 0; options->layout.order = NULL; - options->layout.properties_window.w = DEF_PROPERTY_WIDTH; - options->layout.properties_window.h = DEF_PROPERTY_HEIGHT; options->layout.save_window_positions = TRUE; options->layout.show_directory_date = FALSE; options->layout.show_marks = FALSE; @@ -197,7 +194,6 @@ set_default_image_overlay_template_string(&options->image_overlay.common.template_string); options->sidecar.ext = g_strdup(".jpg;%raw;.xmp"); options->layout.order = g_strdup("123"); - options->properties.tabs_order = g_strdup(info_tab_default_order()); options->shell.path = g_strdup(GQ_DEFAULT_SHELL_PATH); options->shell.options = g_strdup(GQ_DEFAULT_SHELL_OPTIONS);
--- a/src/pan-view.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/pan-view.c Sat Feb 14 20:26:30 2009 +0000 @@ -22,7 +22,6 @@ #include "fullscreen.h" #include "history_list.h" #include "img-view.h" -#include "info.h" #include "menu.h" #include "misc.h" #include "pan-types.h" @@ -1315,9 +1314,6 @@ case 'D': case 'd': if (fd) file_util_delete(fd, NULL, GTK_WIDGET(pr)); break; - case 'P': case 'p': - if (fd) info_window_new(fd, NULL, NULL); - break; case 'F': case 'f': pan_search_toggle_visible(pw, TRUE); break; @@ -2677,15 +2673,6 @@ } } -static void pan_info_cb(GtkWidget *widget, gpointer data) -{ - PanWindow *pw = data; - FileData *fd; - - fd = pan_menu_click_fd(pw); - if (fd) info_window_new(fd, NULL, NULL); -} - static void pan_zoom_in_cb(GtkWidget *widget, gpointer data) { PanWindow *pw = data; @@ -2812,9 +2799,6 @@ submenu_add_edit(menu, &item, G_CALLBACK(pan_edit_cb), pw); gtk_widget_set_sensitive(item, active); - menu_item_add_stock_sensitive(menu, _("_Properties"), GTK_STOCK_PROPERTIES, active, - G_CALLBACK(pan_info_cb), pw); - menu_item_add_stock_sensitive(menu, _("View in _new window"), GTK_STOCK_NEW, active, G_CALLBACK(pan_new_window_cb), pw);
--- a/src/search.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/search.c Sat Feb 14 20:26:30 2009 +0000 @@ -14,7 +14,6 @@ #include "main.h" #include "search.h" -#include "bar_info.h" #include "cache.h" #include "collect.h" #include "collect-table.h" @@ -24,7 +23,6 @@ #include "filedata.h" #include "image-load.h" #include "img-view.h" -#include "info.h" #include "layout_image.h" #include "menu.h" #include "metadata.h" @@ -41,6 +39,7 @@ #include "uri_utils.h" #include "utilops.h" #include "window.h" +#include "bar_keywords.h" #include <gdk/gdkkeysyms.h> /* for keyboard values */ @@ -916,13 +915,6 @@ search_result_edit_selected(sd, key); } -static void sr_menu_info_cb(GtkWidget *widget, gpointer data) -{ - SearchData *sd = data; - - info_window_new(NULL, search_result_selection_list(sd), NULL); -} - static void sr_menu_collection_cb(GtkWidget *widget, gpointer data) { SearchData *sd = data; @@ -1005,8 +997,6 @@ menu_item_add_divider(menu); submenu_add_edit(menu, &item, G_CALLBACK(sr_menu_edit_cb), sd); if (!on_row) gtk_widget_set_sensitive(item, FALSE); - menu_item_add_stock_sensitive(menu, _("_Properties"), GTK_STOCK_PROPERTIES, on_row, - G_CALLBACK(sr_menu_info_cb), sd); menu_item_add_stock_sensitive(menu, _("Add to new collection"), GTK_STOCK_INDEX, on_row, G_CALLBACK(sr_menu_collection_cb), sd); menu_item_add_stock_sensitive(menu, _("Print..."), GTK_STOCK_PRINT, on_row, @@ -1261,9 +1251,6 @@ case 'D': case 'd': file_util_delete(NULL, search_result_selection_list(sd), widget); break; - case 'P': case 'p': - info_window_new(NULL, search_result_selection_list(sd), NULL); - break; case 'A': case 'a': if (event->state & GDK_SHIFT_MASK) {
--- a/src/view_file.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/view_file.c Sat Feb 14 20:26:30 2009 +0000 @@ -13,7 +13,6 @@ #include "view_file.h" #include "editors.h" -#include "info.h" #include "layout.h" #include "menu.h" #include "ui_menu.h" @@ -311,13 +310,6 @@ filelist_free(list); } -static void vf_pop_menu_info_cb(GtkWidget *widget, gpointer data) -{ - ViewFile *vf = data; - - info_window_new(NULL, vf_pop_menu_file_list(vf), NULL); -} - static void vf_pop_menu_view_cb(GtkWidget *widget, gpointer data) { ViewFile *vf = data; @@ -558,8 +550,6 @@ submenu_add_edit(menu, &item, G_CALLBACK(vf_pop_menu_edit_cb), vf); gtk_widget_set_sensitive(item, active); - menu_item_add_stock_sensitive(menu, _("_Properties"), GTK_STOCK_PROPERTIES, active, - G_CALLBACK(vf_pop_menu_info_cb), vf); menu_item_add_stock_sensitive(menu, _("View in _new window"), GTK_STOCK_NEW, active, G_CALLBACK(vf_pop_menu_view_cb), vf);
--- a/src/view_file_icon.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/view_file_icon.c Sat Feb 14 20:26:30 2009 +0000 @@ -13,7 +13,6 @@ #include "main.h" #include "view_file_icon.h" -#include "bar_info.h" #include "bar.h" #include "cellrenderericon.h" #include "collect.h" @@ -22,7 +21,6 @@ #include "dnd.h" #include "editors.h" #include "img-view.h" -#include "info.h" #include "filedata.h" #include "layout.h" #include "layout_image.h"
--- a/src/view_file_list.c Sat Feb 14 19:50:54 2009 +0000 +++ b/src/view_file_list.c Sat Feb 14 20:26:30 2009 +0000 @@ -13,13 +13,11 @@ #include "main.h" #include "view_file_list.h" -#include "bar_info.h" #include "bar.h" #include "cache_maint.h" #include "dnd.h" #include "editors.h" #include "img-view.h" -#include "info.h" #include "layout.h" #include "layout_image.h" #include "menu.h"