aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@novell.com>2007-01-23 00:41:31 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2007-01-23 00:41:31 +0800
commit2a1d77a838cd309647088f13b81afce46d5ae90e (patch)
tree9f26bb2f33a3b9fa5f24578515939692abe2171f /e-util
parent0b9195cb2c24add072671f82d1d1498b78a8b217 (diff)
downloadgsoc2013-evolution-2a1d77a838cd309647088f13b81afce46d5ae90e.tar
gsoc2013-evolution-2a1d77a838cd309647088f13b81afce46d5ae90e.tar.gz
gsoc2013-evolution-2a1d77a838cd309647088f13b81afce46d5ae90e.tar.bz2
gsoc2013-evolution-2a1d77a838cd309647088f13b81afce46d5ae90e.tar.lz
gsoc2013-evolution-2a1d77a838cd309647088f13b81afce46d5ae90e.tar.xz
gsoc2013-evolution-2a1d77a838cd309647088f13b81afce46d5ae90e.tar.zst
gsoc2013-evolution-2a1d77a838cd309647088f13b81afce46d5ae90e.zip
** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22
2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. 2006-01-22 Srinivasa Ragavan <sragavan@novell.com> ** Committing Ebby Wiselyn's patch for GtkPrint API migration. svn path=/trunk/; revision=33134
Diffstat (limited to 'e-util')
-rw-r--r--e-util/ChangeLog9
-rw-r--r--e-util/e-print.c169
-rw-r--r--e-util/e-print.h6
3 files changed, 146 insertions, 38 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 57bf7fd461..0485d7d500 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,12 @@
+2007-01-22 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** GtkPrint API migration from Ebby Wiselyn.
+
+ * e-print.c: (e_print_load_config), (e_print_save_config),
+ (print_dialog_response), (e_print_get_dialog),
+ (e_print_get_dialog_with_config):
+ * e-print.h:
+
2006-11-28 Daniel Gryniewicz <dang@gentoo.org>
** Fix for bug #349966
diff --git a/e-util/e-print.c b/e-util/e-print.c
index 63d7bf3e1e..33eecca14b 100644
--- a/e-util/e-print.c
+++ b/e-util/e-print.c
@@ -23,75 +23,174 @@
#include <string.h>
#include <gconf/gconf-client.h>
#include "e-print.h"
-
-#define PRINT_CONFIG_KEY "/apps/evolution/shell/print_config"
-
-GnomePrintConfig *
+#include <gtk/gtk.h>
+#include <gtk/gtkprintunixdialog.h>
+#define PRINTER "/apps/evolution/shell/printer"
+#define SCALE "/apps/evolution/shell/scale"
+#define PRINT_PAGES "/apps/evolution/shell/print_pages"
+#define PAGE_RANGES "/apps/evolution/shell/page_ranges"
+#define PAGE_SET "/apps/evolution/shell/page_set"
+#define COLLATE "/apps/evolution/shell/collate"
+#define REVERSE "/apps/evolution/shell/reverse"
+#define N_COPIES "/apps/evolution/shell/n_copies"
+#define LPR_COMMANDLINE "/apps/evolution/shell/lpr_commandline"
+#define OUTPUT_URI "/apps/evolution/shell/output_uri"
+#define OUTPUT_FILE_FORMAT "/apps/evolution/shell/output_file_format"
+
+/* Loads the print settings that were saved previously */
+
+GtkPrintSettings *
e_print_load_config (void)
{
GConfClient *gconf;
- GnomePrintConfig *config;
- char *str;
+ GtkPrintSettings *settings;
+ gchar *printer_name;
+ gchar *collate;
+ gchar *n_copies;
+ gchar *print_pages;
+ gchar *page_set;
+ gchar *scale;
+ gchar *output_uri;
+ gchar *output_file_format;
+ gchar *reverse;
+ gchar *page_ranges;
+ gchar *lpr_commandline;
+
+ settings = gtk_print_settings_new ();
gconf = gconf_client_get_default ();
- str = gconf_client_get_string (gconf, PRINT_CONFIG_KEY, NULL);
- g_object_unref (gconf);
+
+ printer_name = gconf_client_get_string (gconf, PRINTER, NULL);
+ gtk_print_settings_set (settings, "printer", printer_name);
- if (!str)
- return gnome_print_config_default ();
+ n_copies = gconf_client_get_string (gconf, N_COPIES, NULL);
+ gtk_print_settings_set (settings, "n-copies",n_copies);
+
+ collate = gconf_client_get_string (gconf, COLLATE, NULL);
+ gtk_print_settings_set (settings, "collate", collate);
- config = gnome_print_config_from_string (str, 0);
+ lpr_commandline = gconf_client_get_string (gconf, LPR_COMMANDLINE, NULL);
+ gtk_print_settings_set (settings, "lpr-commandline", lpr_commandline);
- /* Its unlikely people will want to preserve this too often */
- gnome_print_config_set_int (config, GNOME_PRINT_KEY_NUM_COPIES, 1);
- gnome_print_config_set_boolean (config, GNOME_PRINT_KEY_COLLATE, FALSE);
+ print_pages = gconf_client_get_string (gconf, PRINT_PAGES, NULL);
+ gtk_print_settings_set (settings, "print-pages", print_pages);
+
+ page_set = gconf_client_get_string (gconf, PAGE_SET, NULL);
+ gtk_print_settings_set (settings, "page-set", page_set);
- return config;
+ output_uri = gconf_client_get_string (gconf, OUTPUT_URI, NULL);
+ gtk_print_settings_set (settings, "output-uri", output_uri);
+
+ output_file_format = gconf_client_get_string (gconf, OUTPUT_FILE_FORMAT, NULL);
+ gtk_print_settings_set (settings, "output-file-format",output_file_format);
+
+ reverse = gconf_client_get_string (gconf, REVERSE, NULL);
+ gtk_print_settings_set (settings, "reverse", reverse);
+
+ scale = gconf_client_get_string (gconf, SCALE, NULL);
+ gtk_print_settings_set (settings, "scale", scale);
+
+ page_ranges = gconf_client_get_string (gconf, PAGE_RANGES, NULL);
+ gtk_print_settings_set (settings, "page-ranges", page_ranges);
+
+ g_free (printer_name);
+ g_free (collate);
+ g_free (n_copies);
+ g_free (print_pages);
+ g_free (page_set);
+ g_free (scale);
+ g_free (output_uri);
+ g_free (output_file_format);
+ g_free (reverse);
+ g_free (page_ranges);
+ g_free (lpr_commandline);
+ g_object_unref (gconf);
+ return settings;
}
-
+/* Saves the print settings */
+
void
-e_print_save_config (GnomePrintConfig *config)
+e_print_save_config (GtkPrintSettings *settings)
{
GConfClient *gconf;
- char *str;
-
- str = gnome_print_config_to_string (config, 0);
+ const gchar *printer_name;
+ const gchar *collate;
+ const gchar *n_copies;
+ const gchar *print_pages;
+ const gchar *page_set;
+ const gchar *scale;
+ const gchar *output_uri;
+ const gchar *output_file_format;
+ const gchar *reverse;
+ const gchar *page_ranges;
+ const gchar *lpr_commandline;
gconf = gconf_client_get_default ();
- gconf_client_set_string (gconf, PRINT_CONFIG_KEY, str, NULL);
+ printer_name = gtk_print_settings_get (settings, "printer");
+ gconf_client_set_string (gconf, PRINTER, printer_name, NULL);
+
+ scale = gtk_print_settings_get (settings, "scale");
+ gconf_client_set_string (gconf, SCALE, scale, NULL);
+
+ page_set = gtk_print_settings_get (settings, "page-set");
+ gconf_client_set_string (gconf, PAGE_SET, page_set, NULL);
+
+ print_pages = gtk_print_settings_get (settings, "print-pages");
+ gconf_client_set_string (gconf, PRINT_PAGES, print_pages, NULL);
+
+ lpr_commandline = gtk_print_settings_get (settings, "lpr-commandline");
+ gconf_client_set_string (gconf, LPR_COMMANDLINE, lpr_commandline, NULL);
+
+ collate = gtk_print_settings_get (settings, "collate");
+ gconf_client_set_string (gconf, COLLATE, collate, NULL);
+
+ output_uri = gtk_print_settings_get (settings, "output-uri");
+ gconf_client_set_string (gconf, OUTPUT_URI, output_uri, NULL);
+
+ output_file_format = gtk_print_settings_get (settings, "output-file-format");
+ gconf_client_set_string (gconf, OUTPUT_FILE_FORMAT, output_file_format, NULL);
+
+ reverse = gtk_print_settings_get (settings, "reverse");
+ gconf_client_set_string (gconf, REVERSE, reverse, NULL);
+
+ n_copies = gtk_print_settings_get (settings, "n_copies");
+ gconf_client_set_string (gconf, N_COPIES, n_copies, NULL);
+
+ page_ranges = gtk_print_settings_get (settings, "page-ranges");
+ gconf_client_set_string (gconf, PAGE_RANGES, "page-ranges",NULL);
+
g_object_unref (gconf);
}
static void
print_dialog_response(GtkWidget *widget, int resp, gpointer data)
{
- if (resp == GNOME_PRINT_DIALOG_RESPONSE_PRINT)
- e_print_save_config (gnome_print_dialog_get_config (GNOME_PRINT_DIALOG (widget)));
+ if (resp == GTK_RESPONSE_OK) {
+ e_print_save_config (gtk_print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG (widget)));
+ }
}
+/* Creates a dialog with the print settings */
GtkWidget *
e_print_get_dialog (const char *title, int flags)
{
- GnomePrintConfig *config;
+ GtkPrintSettings *settings;
GtkWidget *dialog;
- config = e_print_load_config ();
- dialog = e_print_get_dialog_with_config (title, flags, config);
- g_object_unref (config);
-
+ settings = e_print_load_config ();
+ dialog = e_print_get_dialog_with_config (title, flags, settings);
+ g_object_unref (settings);
return dialog;
}
GtkWidget *
-e_print_get_dialog_with_config (const char *title, int flags, GnomePrintConfig *config)
+e_print_get_dialog_with_config (const char *title, int flags, GtkPrintSettings *settings)
{
GtkWidget *dialog;
-
- dialog = g_object_new (GNOME_TYPE_PRINT_DIALOG, "print_config", config, NULL);
- gnome_print_dialog_construct (GNOME_PRINT_DIALOG (dialog), title, flags);
-
- g_signal_connect(dialog, "response", G_CALLBACK(print_dialog_response), NULL);
-
+
+ dialog = gtk_print_unix_dialog_new (title, NULL);
+ gtk_print_unix_dialog_set_settings (GTK_PRINT_UNIX_DIALOG(dialog), settings);
+ g_signal_connect(dialog, "response", G_CALLBACK(print_dialog_response), NULL);
return dialog;
}
diff --git a/e-util/e-print.h b/e-util/e-print.h
index 738da0f418..c8ca551203 100644
--- a/e-util/e-print.h
+++ b/e-util/e-print.h
@@ -28,11 +28,11 @@
G_BEGIN_DECLS
-GnomePrintConfig *e_print_load_config (void);
-void e_print_save_config (GnomePrintConfig *config);
+GtkPrintSettings *e_print_load_config (void);
+void e_print_save_config (GtkPrintSettings *settings);
GtkWidget *e_print_get_dialog (const char *title, int flags);
-GtkWidget *e_print_get_dialog_with_config (const char *title, int flags, GnomePrintConfig *config);
+GtkWidget *e_print_get_dialog_with_config (const char *title, int flags, GtkPrintSettings *settings);
G_END_DECLS