# HG changeset patch # User zas_ # Date 1207597642 0 # Node ID 65187a2309d3ab83a4977b8c41f53ec55a0c4b24 # Parent 3f14da3c3b9ad85c5bbe830eead39c8b233e336a Add the possibility to print file names with path. A checkbox was added to the Text tab in the Print dialog. Name checked and Path unchecked -> filename.jpg Name checked and Path checked -> /some/dir/filename.jpg Name unchecked and Path checked -> /some/dir/ Patch by Michael Mokeev and Laurent Monin. diff -r 3f14da3c3b9a -r 65187a2309d3 src/print.c --- a/src/print.c Mon Apr 07 19:06:17 2008 +0000 +++ b/src/print.c Mon Apr 07 19:47:22 2008 +0000 @@ -172,7 +172,8 @@ TEXT_INFO_FILENAME = 1 << 0, TEXT_INFO_FILEDATE = 1 << 1, TEXT_INFO_FILESIZE = 1 << 2, - TEXT_INFO_DIMENSIONS = 1 << 3 + TEXT_INFO_DIMENSIONS = 1 << 3, + TEXT_INFO_FILEPATH = 1 << 4 } TextInfo; typedef struct _PrintWindow PrintWindow; @@ -2034,7 +2035,18 @@ if (pw->text_fields & TEXT_INFO_FILENAME) { - g_string_append(string, filename_from_path(path)); + if (pw->text_fields & TEXT_INFO_FILEPATH) + g_string_append(string, path); + else + g_string_append(string, filename_from_path(path)); + newline = TRUE; + } + else if (pw->text_fields & TEXT_INFO_FILEPATH) + { + gchar *dirname = g_path_get_dirname(path); + + g_string_append_printf(string, "%s%s", dirname, G_DIR_SEPARATOR_S); + g_free(dirname); newline = TRUE; } if (pw->text_fields & TEXT_INFO_DIMENSIONS) @@ -3161,6 +3173,15 @@ print_text_field_set(pw, TEXT_INFO_FILENAME, active); } +static void print_text_cb_path(GtkWidget *widget, gpointer data) +{ + PrintWindow *pw = data; + gint active; + + active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + print_text_field_set(pw, TEXT_INFO_FILEPATH, active); +} + static void print_text_cb_date(GtkWidget *widget, gpointer data) { PrintWindow *pw = data; @@ -3204,6 +3225,8 @@ pref_checkbox_new(group, _("Name"), (pw->text_fields & TEXT_INFO_FILENAME), G_CALLBACK(print_text_cb_name), pw); + pref_checkbox_new(group, _("Path"), (pw->text_fields & TEXT_INFO_FILEPATH), + G_CALLBACK(print_text_cb_path), pw); pref_checkbox_new(group, _("Date"), (pw->text_fields & TEXT_INFO_FILEDATE), G_CALLBACK(print_text_cb_date), pw); pref_checkbox_new(group, _("Size"), (pw->text_fields & TEXT_INFO_FILESIZE),