WRITE_NL(); WRITE_STRING("</color_profiles>");
}
+static void write_marks_tooltips(GString *outstr, gint indent)
+{
+ gint i;
+
+ WRITE_NL(); WRITE_STRING("<marks_tooltips>");
+ indent++;
+ for (i = 0; i < FILEDATA_MARKS_SIZE; i++)
+ {
+ WRITE_NL();
+ write_char_option(outstr, indent, "<tooltip text", options->marks_tooltips[i]);
+ WRITE_STRING("/>");
+ }
+ indent--;
+ WRITE_NL(); WRITE_STRING("</marks_tooltips>");
+}
+
/*
*-----------------------------------------------------------------------------
WRITE_SEPARATOR();
filter_write_list(outstr, indent);
+ WRITE_SEPARATOR();
+ write_marks_tooltips(outstr, indent);
+
WRITE_SEPARATOR();
keyword_tree_write_config(outstr, indent);
indent--;
}
+static void options_load_marks_tooltips(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error)
+{
+ gint i = GPOINTER_TO_INT(data);
+ if (i < 0 || i >= FILEDATA_MARKS_SIZE) return;
+ while (*attribute_names)
+ {
+ const gchar *option = *attribute_names++;
+ const gchar *value = *attribute_values++;
+ if (READ_CHAR_FULL("text", options->marks_tooltips[i])) continue;
+
+ log_printf("unkown attribute %s = %s\n", option, value);
+ }
+ i++;
+ options_parse_func_set_data(parser_data, GINT_TO_POINTER(i));
+}
/*
*-----------------------------------------------------------------------------
}
}
+static void options_parse_marks_tooltips(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error)
+{
+ if (g_ascii_strcasecmp(element_name, "tooltip") == 0)
+ {
+ options_load_marks_tooltips(parser_data, context, element_name, attribute_names, attribute_values, data, error);
+ options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL);
+ }
+ else
+ {
+ log_printf("unexpected in <profile>: <%s>\n", element_name);
+ options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL);
+ }
+}
+
static void options_parse_filter(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error)
{
if (g_ascii_strcasecmp(element_name, "file_type") == 0)
{
options_parse_func_push(parser_data, options_parse_filter, options_parse_filter_end, NULL);
}
+ else if (g_ascii_strcasecmp(element_name, "marks_tooltips") == 0)
+ {
+ options_load_marks_tooltips(parser_data, context, element_name, attribute_names, attribute_values, data, error);
+ options_parse_func_push(parser_data, options_parse_marks_tooltips, NULL, NULL);
+ }
else if (g_ascii_strcasecmp(element_name, "keyword_tree") == 0)
{
if (!keyword_tree) keyword_tree_new();
#include "thumb.h"
#include "ui_menu.h"
#include "ui_fileops.h"
+#include "ui_misc.h"
#include "utilops.h"
#include "view_file/view_file_list.h"
#include "view_file/view_file_icon.h"
+#include "window.h"
/*
*-----------------------------------------------------------------------------
vf_refresh_idle(vf);
}
+typedef struct _MarksTextEntry MarksTextEntry;
+struct _MarksTextEntry {
+ GenericDialog *gd;
+ gint mark_no;
+ GtkWidget *edit_widget;
+ gchar *text_entry;
+ GtkWidget *parent;
+};
+
+static void vf_marks_tooltip_cancel_cb(GenericDialog *gd, gpointer data)
+{
+ MarksTextEntry *mte = data;
+
+ g_free(mte->text_entry);
+ generic_dialog_close(gd);
+}
+
+static void vf_marks_tooltip_ok_cb(GenericDialog *gd, gpointer data)
+{
+ MarksTextEntry *mte = data;
+
+ g_free(options->marks_tooltips[mte->mark_no]);
+ options->marks_tooltips[mte->mark_no] = g_strdup(gtk_entry_get_text(GTK_ENTRY(mte->edit_widget)));
+
+ gtk_widget_set_tooltip_text(mte->parent, options->marks_tooltips[mte->mark_no]);
+
+ g_free(mte->text_entry);
+ generic_dialog_close(gd);
+}
+
+void vf_marks_filter_on_icon_press(GtkEntry *entry, GtkEntryIconPosition pos,
+ GdkEvent *event, gpointer userdata)
+{
+ MarksTextEntry *mte = userdata;
+
+ g_free(mte->text_entry);
+ mte->text_entry = g_strdup("");
+ gtk_entry_set_text(GTK_ENTRY(mte->edit_widget), "");
+}
+
+static void vf_marks_tooltip_help_cb(GenericDialog *gd, gpointer data)
+{
+ help_window_show("GuideImageMarks.html");
+}
+
+static gboolean vf_marks_tooltip_cb(GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer user_data)
+{
+ GtkWidget *table;
+ gint i = GPOINTER_TO_INT(user_data);
+ MarksTextEntry *mte;
+
+ if (event->button == MOUSE_BUTTON_RIGHT)
+ {
+ mte = g_new0(MarksTextEntry, 1);
+ mte->mark_no = i;
+ mte->text_entry = g_strdup(options->marks_tooltips[i]);
+ mte->parent = widget;
+
+ mte->gd = generic_dialog_new(_("Mark text"), "mark_text",
+ widget, FALSE,
+ vf_marks_tooltip_cancel_cb, mte);
+ generic_dialog_add_message(mte->gd, GTK_STOCK_DIALOG_QUESTION, _("Set mark text"),
+ _("This will set or clear the mark text."), FALSE);
+ generic_dialog_add_button(mte->gd, GTK_STOCK_OK, NULL,
+ vf_marks_tooltip_ok_cb, TRUE);
+ generic_dialog_add_button(mte->gd, GTK_STOCK_HELP, NULL,
+ vf_marks_tooltip_help_cb, FALSE);
+
+ table = pref_table_new(mte->gd->vbox, 3, 1, FALSE, TRUE);
+ pref_table_label(table, 0, 0, g_strdup_printf("%s%d", _("Mark "), mte->mark_no + 1), 1.0);
+ mte->edit_widget = gtk_entry_new();
+ gtk_widget_set_size_request(mte->edit_widget, 300, -1);
+ if (mte->text_entry)
+ {
+ gtk_entry_set_text(GTK_ENTRY(mte->edit_widget), mte->text_entry);
+ }
+ gtk_table_attach_defaults(GTK_TABLE(table), mte->edit_widget, 1, 2, 0, 1);
+ generic_dialog_attach_default(mte->gd, mte->edit_widget);
+
+ gtk_entry_set_icon_from_stock(GTK_ENTRY(mte->edit_widget),
+ GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
+ gtk_entry_set_icon_tooltip_text (GTK_ENTRY(mte->edit_widget),
+ GTK_ENTRY_ICON_SECONDARY, "Clear");
+ g_signal_connect(GTK_ENTRY(mte->edit_widget), "icon-press",
+ G_CALLBACK(vf_marks_filter_on_icon_press), mte);
+
+ gtk_widget_show(mte->edit_widget);
+ gtk_widget_grab_focus(mte->edit_widget);
+ gtk_widget_show(GTK_WIDGET(mte->gd->dialog));
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static GtkWidget *vf_marks_filter_init(ViewFile *vf)
{
gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(check), "toggled",
G_CALLBACK(vf_marks_filter_toggle_cb), vf);
+ g_signal_connect(G_OBJECT(check), "button_press_event",
+ G_CALLBACK(vf_marks_tooltip_cb), GINT_TO_POINTER(i));
+ gtk_widget_set_tooltip_text(check, options->marks_tooltips[i]);
gtk_widget_show(check);
vf->filter_check[i] = check;