[eog] Simplify setting print-to-file basename
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Simplify setting print-to-file basename
- Date: Sat, 1 Dec 2012 19:22:33 +0000 (UTC)
commit 252747ea73197ff0c9e52980907dd7bdd79951d7
Author: Felix Riemann <friemann gnome org>
Date: Sat Dec 1 20:21:42 2012 +0100
Simplify setting print-to-file basename
The logic that was used to determine the basename was
moved to eog_image_get_caption().
src/eog-window.c | 27 +++++++--------------------
1 files changed, 7 insertions(+), 20 deletions(-)
---
diff --git a/src/eog-window.c b/src/eog-window.c
index 6b0e12f..91fa9da 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -2203,28 +2203,15 @@ eog_window_stop_fullscreen (EogWindow *window, gboolean slideshow)
static void
set_basename_for_print_settings (GtkPrintSettings *print_settings, EogWindow *window)
{
- GFile *file;
- GFileInfo *info;
- const char *basename;
-
- file = eog_image_get_file (window->priv->image);
- info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
- G_FILE_QUERY_INFO_NONE,
- NULL,
- NULL);
- if (info)
- basename = g_file_info_get_display_name (info);
- else
- basename = NULL;
+ const char *basename = NULL;
- if (basename)
- gtk_print_settings_set (print_settings, GTK_PRINT_SETTINGS_OUTPUT_BASENAME, basename);
+ if(G_LIKELY (window->priv->image != NULL))
+ basename = eog_image_get_caption (window->priv->image);
- if (info)
- g_object_unref (info);
-
- g_object_unref (file);
+ if (G_LIKELY(basename))
+ gtk_print_settings_set (print_settings,
+ GTK_PRINT_SETTINGS_OUTPUT_BASENAME,
+ basename);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]