diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2006-08-05 23:06:23 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2006-08-05 23:06:23 +0800 |
commit | a7d77f6d5eb0e0d73c1029dd751014efc21d95df (patch) | |
tree | 64314563f2a7321b6e11721605b07096accf3397 /embed | |
parent | 3fd222083b1d51093e6d736c8d657cfa9a43689f (diff) | |
download | gsoc2013-epiphany-a7d77f6d5eb0e0d73c1029dd751014efc21d95df.tar gsoc2013-epiphany-a7d77f6d5eb0e0d73c1029dd751014efc21d95df.tar.gz gsoc2013-epiphany-a7d77f6d5eb0e0d73c1029dd751014efc21d95df.tar.bz2 gsoc2013-epiphany-a7d77f6d5eb0e0d73c1029dd751014efc21d95df.tar.lz gsoc2013-epiphany-a7d77f6d5eb0e0d73c1029dd751014efc21d95df.tar.xz gsoc2013-epiphany-a7d77f6d5eb0e0d73c1029dd751014efc21d95df.tar.zst gsoc2013-epiphany-a7d77f6d5eb0e0d73c1029dd751014efc21d95df.zip |
A lib/ephy-print-utils.c: A lib/ephy-print-utils.h:
2006-08-05 Christian Persch <chpe@cvs.gnome.org>
* embed/ephy-embed-shell.c: (ephy_embed_shell_set_page_setup),
(ephy_embed_shell_get_page_setup),
(ephy_embed_shell_set_print_settings),
(ephy_embed_shell_get_print_settings):
A lib/ephy-print-utils.c:
A lib/ephy-print-utils.h:
* lib/ephy-string.c: (ephy_string_flags_from_string),
(ephy_string_flags_to_string), (ephy_string_enum_from_string),
(ephy_string_enum_to_string):
* lib/ephy-string.h:
Persist print settings and page setup.
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-embed-shell.c | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c index d4a1e4c38..9a40d7c6b 100644 --- a/embed/ephy-embed-shell.c +++ b/embed/ephy-embed-shell.c @@ -32,10 +32,14 @@ #include "ephy-encodings.h" #include "ephy-debug.h" #include "ephy-adblock-manager.h" +#include "ephy-print-utils.h" #include <glib/gi18n.h> #include <gtk/gtkmessagedialog.h> +#define PAGE_SETUP_FILENAME "page-setup.ini" +#define PRINT_SETTINGS_FILENAME "print-settings.ini" + #define EPHY_EMBED_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED_SHELL, EphyEmbedShellPrivate)) struct _EphyEmbedShellPrivate @@ -378,6 +382,7 @@ ephy_embed_shell_set_page_setup (EphyEmbedShell *shell, GtkPageSetup *page_setup) { EphyEmbedShellPrivate *priv; + char *path; g_return_if_fail (EPHY_IS_EMBED_SHELL (shell)); priv = shell->priv; @@ -392,9 +397,11 @@ ephy_embed_shell_set_page_setup (EphyEmbedShell *shell, g_object_unref (priv->page_setup); } - /* FIXME: save settings to disk! */ + priv->page_setup = page_setup ? page_setup : gtk_page_setup_new (); - priv->page_setup = page_setup; + path = g_build_filename (ephy_dot_dir (), PAGE_SETUP_FILENAME, NULL); + ephy_print_utils_page_setup_to_file (page_setup, path, NULL); + g_free (path); } GtkPageSetup * @@ -407,8 +414,16 @@ ephy_embed_shell_get_page_setup (EphyEmbedShell *shell) if (priv->page_setup == NULL) { - /* FIXME: load stored settings! */ - priv->page_setup = gtk_page_setup_new (); + char *path; + + path = g_build_filename (ephy_dot_dir (), PAGE_SETUP_FILENAME, NULL); + priv->page_setup = ephy_print_utils_page_setup_new_from_file (path, &error); + g_free (path); + + if (priv->page_setup == NULL) + { + priv->page_setup = gtk_page_setup_new (); + } } return priv->page_setup; @@ -419,6 +434,7 @@ ephy_embed_shell_set_print_settings (EphyEmbedShell *shell, GtkPrintSettings *settings) { EphyEmbedShellPrivate *priv; + char *path; g_return_if_fail (EPHY_IS_EMBED_SHELL (shell)); priv = shell->priv; @@ -433,9 +449,11 @@ ephy_embed_shell_set_print_settings (EphyEmbedShell *shell, g_object_unref (priv->print_settings); } - /* FIXME: save settings to disk! */ + priv->print_settings = settings ? settings : gtk_print_settings_new (); - priv->print_settings = settings; + path = g_build_filename (ephy_dot_dir (), PRINT_SETTINGS_FILENAME, NULL); + ephy_print_utils_settings_to_file (settings, path, NULL); + g_free (path); } GtkPrintSettings * @@ -448,8 +466,16 @@ ephy_embed_shell_get_print_settings (EphyEmbedShell *shell) if (priv->print_settings == NULL) { - /* FIXME: load stored settings! */ - priv->print_settings = gtk_print_settings_new (); + char *path; + + path = g_build_filename (ephy_dot_dir (), PRINT_SETTINGS_FILENAME, NULL); + priv->print_settings = ephy_print_utils_settings_new_from_file (path, &error); + g_free (path); + + if (priv->print_settings == NULL) + { + priv->print_settings = gtk_print_settings_new (); + } } return priv->print_settings; |