From 6ee660075e0de58ba704a3b0f6fe82f742533eee Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sun, 18 Nov 2007 17:55:52 +0000 Subject: [PATCH] add SAVE_DIALOG log domain. 2007-11-18 Michael Natterer * app/gimp-log.[ch]: add SAVE_DIALOG log domain. * app/dialogs/file-save-dialog: port debug output to GIMP_LOG(). svn path=/trunk/; revision=24186 --- ChangeLog | 6 +++ app/dialogs/file-save-dialog.c | 93 ++++++++++++---------------------- app/gimp-log.c | 3 +- app/gimp-log.h | 3 +- 4 files changed, 41 insertions(+), 64 deletions(-) diff --git a/ChangeLog b/ChangeLog index 325a134195..a7b369cbdf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-11-18 Michael Natterer + + * app/gimp-log.[ch]: add SAVE_DIALOG log domain. + + * app/dialogs/file-save-dialog: port debug output to GIMP_LOG(). + 2007-11-18 Michael Natterer * app/gimp-log.[ch]: add DIALOG_FACTORY log domain. diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c index 8472e96a02..45940a9eab 100644 --- a/app/dialogs/file-save-dialog.c +++ b/app/dialogs/file-save-dialog.c @@ -49,6 +49,7 @@ #include "file-save-dialog.h" +#include "gimp-log.h" #include "gimp-intl.h" @@ -218,18 +219,13 @@ file_save_dialog_check_uri (GtkWidget *save_dialog, /* first check if the user entered an extension at all */ if (! basename_proc) { -#ifdef DEBUG_SPEW - g_print ("%s: basename has no valid extension\n", - G_STRFUNC); -#endif + GIMP_LOG (SAVE_DIALOG, "basename has no valid extension"); + if (! strchr (basename, '.')) { const gchar *ext = NULL; -#ifdef DEBUG_SPEW - g_print ("%s: basename has no '.', trying to add extension\n", - G_STRFUNC); -#endif + GIMP_LOG (SAVE_DIALOG, "basename has no '.', trying to add extension"); if (! save_proc) { @@ -246,10 +242,7 @@ file_save_dialog_check_uri (GtkWidget *save_dialog, gchar *ext_basename = g_strconcat (basename, ".", ext, NULL); gchar *utf8; -#ifdef DEBUG_SPEW - g_print ("%s: appending .%s to basename\n", - G_STRFUNC, ext); -#endif + GIMP_LOG (SAVE_DIALOG, "appending .%s to basename", ext); g_free (uri); g_free (basename); @@ -267,10 +260,9 @@ file_save_dialog_check_uri (GtkWidget *save_dialog, utf8); g_free (utf8); -#ifdef DEBUG_SPEW - g_print ("%s: set basename to %s, rerunning response and " - "bailing out\n", G_STRFUNC, basename); -#endif + GIMP_LOG (SAVE_DIALOG, + "set basename to %s, rerunning response and bailing out", + basename); /* call the response callback again, so the * overwrite-confirm logic can check the changed uri @@ -284,10 +276,8 @@ file_save_dialog_check_uri (GtkWidget *save_dialog, } else { -#ifdef DEBUG_SPEW - g_print ("%s: save_proc has no extensions, continuing without\n", - G_STRFUNC); -#endif + GIMP_LOG (SAVE_DIALOG, + "save_proc has no extensions, continuing without"); /* there may be file formats with no extension at all, use * the selected proc in this case. @@ -300,10 +290,8 @@ file_save_dialog_check_uri (GtkWidget *save_dialog, if (! basename_proc) { -#ifdef DEBUG_SPEW - g_print ("%s: unable to figure save_proc, bailing out\n", - G_STRFUNC); -#endif + GIMP_LOG (SAVE_DIALOG, + "unable to figure save_proc, bailing out"); gimp_message (gimp, G_OBJECT (save_dialog), GIMP_MESSAGE_WARNING, _("The given filename does not have any known " @@ -317,11 +305,9 @@ file_save_dialog_check_uri (GtkWidget *save_dialog, } else if (save_proc && ! save_proc->extensions_list) { -#ifdef DEBUG_SPEW - g_print ("%s: basename has '.', but save_proc has no extensions, " - "accepting random extension\n", - G_STRFUNC); -#endif + GIMP_LOG (SAVE_DIALOG, + "basename has '.', but save_proc has no extensions, " + "accepting random extension"); /* accept any random extension if the file format has * no extensions at all @@ -336,17 +322,12 @@ file_save_dialog_check_uri (GtkWidget *save_dialog, /* then check if the selected format matches the entered extension */ if (! save_proc) { -#ifdef DEBUG_SPEW - g_print ("%s: no save_proc was selected from the list\n", - G_STRFUNC); -#endif + GIMP_LOG (SAVE_DIALOG, "no save_proc was selected from the list"); if (! basename_proc) { -#ifdef DEBUG_SPEW - g_print ("%s: basename had no useful extension, bailing out\n", - G_STRFUNC); -#endif + GIMP_LOG (SAVE_DIALOG, + "basename has no useful extension, bailing out"); gimp_message (gimp, G_OBJECT (save_dialog), GIMP_MESSAGE_WARNING, _("The given filename does not have any known " @@ -358,35 +339,26 @@ file_save_dialog_check_uri (GtkWidget *save_dialog, return FALSE; } -#ifdef DEBUG_SPEW - g_print ("%s: use URI's proc '%s' so indirect saving works\n", - G_STRFUNC, uri_proc->menu_label ? uri_proc->menu_label : "?"); -#endif + GIMP_LOG (SAVE_DIALOG, "use URI's proc '%s' so indirect saving works", + uri_proc->menu_label ? uri_proc->menu_label : ""); /* use the URI's proc if no save proc was selected */ save_proc = uri_proc; } else { -#ifdef DEBUG_SPEW - g_print ("%s: save_proc '%s' was selected from the list\n", - G_STRFUNC, save_proc->menu_label); -#endif + GIMP_LOG (SAVE_DIALOG, "save_proc '%s' was selected from the list", + save_proc->menu_label ? save_proc->menu_label : ""); if (save_proc != basename_proc) { -#ifdef DEBUG_SPEW - g_print ("%s: however the basename's proc is '%s'\n", - G_STRFUNC, - basename_proc ? basename_proc->menu_label : "NULL"); -#endif + GIMP_LOG (SAVE_DIALOG, "however the basename's proc is '%s'", + basename_proc ? basename_proc->menu_label : "NULL"); if (uri_proc != basename_proc) { -#ifdef DEBUG_SPEW - g_print ("%s: that's impossible for remote URIs, bailing out\n", - G_STRFUNC); -#endif + GIMP_LOG (SAVE_DIALOG, + "that's impossible for remote URIs, bailing out"); /* remote URI */ @@ -402,10 +374,8 @@ file_save_dialog_check_uri (GtkWidget *save_dialog, } else { -#ifdef DEBUG_SPEW - g_print ("%s: ask the user if she really wants that filename\n", - G_STRFUNC); -#endif + GIMP_LOG (SAVE_DIALOG, + "ask the user if she really wants that filename"); /* local URI */ @@ -419,10 +389,9 @@ file_save_dialog_check_uri (GtkWidget *save_dialog, } else if (save_proc != uri_proc) { -#ifdef DEBUG_SPEW - g_print ("%s: use URI's proc '%s' so indirect saving works\n", - G_STRFUNC, uri_proc->menu_label); -#endif + GIMP_LOG (SAVE_DIALOG, + "use URI's proc '%s' so indirect saving works", + uri_proc->menu_label ? uri_proc->menu_label : ""); /* need to use the URI's proc for saving because e.g. * the GIF plug-in can't save a GIF to sftp:// diff --git a/app/gimp-log.c b/app/gimp-log.c index b5a4bc2d5c..d4c6d5c579 100644 --- a/app/gimp-log.c +++ b/app/gimp-log.c @@ -38,7 +38,8 @@ gimp_log_init (void) { "tools", GIMP_LOG_TOOLS }, { "dnd", GIMP_LOG_DND }, { "help", GIMP_LOG_HELP }, - { "dialog-factory", GIMP_LOG_DIALOG_FACTORY } + { "dialog-factory", GIMP_LOG_DIALOG_FACTORY }, + { "save-dialog", GIMP_LOG_SAVE_DIALOG } }; gimp_log_flags = g_parse_debug_string (env_log_val, diff --git a/app/gimp-log.h b/app/gimp-log.h index 353e7a7102..612f09515f 100644 --- a/app/gimp-log.h +++ b/app/gimp-log.h @@ -25,7 +25,8 @@ typedef enum GIMP_LOG_TOOLS = 1 << 0, GIMP_LOG_DND = 1 << 1, GIMP_LOG_HELP = 1 << 2, - GIMP_LOG_DIALOG_FACTORY = 1 << 3 + GIMP_LOG_DIALOG_FACTORY = 1 << 3, + GIMP_LOG_SAVE_DIALOG = 1 << 4 } GimpLogFlags; -- GitLab