diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2004-10-11 00:03:53 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2004-10-11 00:03:53 +0800 |
commit | ef0d06b1cca990d13d0f1e3e051248e795c4d79b (patch) | |
tree | c03d644960b6ae1863a8973a1cd1187d20a1db17 /embed/print-dialog.c | |
parent | 840e12a02b3e26c0697b81af8bdfdb5398017fb8 (diff) | |
download | gsoc2013-epiphany-ef0d06b1cca990d13d0f1e3e051248e795c4d79b.tar gsoc2013-epiphany-ef0d06b1cca990d13d0f1e3e051248e795c4d79b.tar.gz gsoc2013-epiphany-ef0d06b1cca990d13d0f1e3e051248e795c4d79b.tar.bz2 gsoc2013-epiphany-ef0d06b1cca990d13d0f1e3e051248e795c4d79b.tar.lz gsoc2013-epiphany-ef0d06b1cca990d13d0f1e3e051248e795c4d79b.tar.xz gsoc2013-epiphany-ef0d06b1cca990d13d0f1e3e051248e795c4d79b.tar.zst gsoc2013-epiphany-ef0d06b1cca990d13d0f1e3e051248e795c4d79b.zip |
reviewed by: Christian Persch <chpe@cvs.gnome.org>
2004-10-10 Marco Pesenti Gritti <marco@gnome.org>
reviewed by: Christian Persch <chpe@cvs.gnome.org>
* data/glade/print.glade:
* embed/ephy-embed-single.c: (ephy_embed_single_get_printer_list):
* embed/ephy-embed-single.h:
* embed/mozilla/ContentHandler.cpp:
* embed/mozilla/EphyBrowser.cpp:
* embed/mozilla/EphyHeaderSniffer.cpp:
* embed/mozilla/EphyUtils.cpp:
* embed/mozilla/EphyUtils.h:
* embed/mozilla/FilePicker.cpp:
* embed/mozilla/GtkNSSClientAuthDialogs.cpp:
* embed/mozilla/GtkNSSDialogs.cpp:
* embed/mozilla/GtkNSSKeyPairDialogs.cpp:
* embed/mozilla/MozillaPrivate.cpp:
* embed/mozilla/MozillaPrivate.h:
* embed/mozilla/PrintingPromptService.cpp:
* embed/mozilla/mozilla-embed-single.cpp:
* embed/mozilla/mozilla-embed.cpp:
* embed/print-dialog.c: (ephy_print_dialog_new):
* lib/ephy-dialog.c: (set_combo_box_from_value):
Move current MozillaPrivate helpers to EphyUtils.
Use MozillaPrivate for stuff that needs mozilla
internal strings.
Support multiple printers in the print dialog.
This is actually a bug fix because on several
distributions using hardcoded Poscript/default
will simply not work at all.
Diffstat (limited to 'embed/print-dialog.c')
-rwxr-xr-x | embed/print-dialog.c | 57 |
1 files changed, 50 insertions, 7 deletions
diff --git a/embed/print-dialog.c b/embed/print-dialog.c index e7b75538d..20132b973 100755 --- a/embed/print-dialog.c +++ b/embed/print-dialog.c @@ -25,6 +25,8 @@ #include "print-dialog.h" #include "ephy-embed-dialog.h" +#include "ephy-embed-single.h" +#include "ephy-embed-shell.h" #include "ephy-file-chooser.h" #include "ephy-file-helpers.h" #include "ephy-stock-icons.h" @@ -36,10 +38,13 @@ #include <gtk/gtkdialog.h> #include <gtk/gtkentry.h> #include <gtk/gtkstock.h> +#include <gtk/gtkcombobox.h> +#include <gtk/gtkcellrenderertext.h> +#include <gtk/gtkcelllayout.h> #include <libgnomevfs/gnome-vfs-utils.h> #include <glib/gi18n.h> -#define CONF_PRINT_PRINTER "/apps/epiphany/dialogs/print_printer" +#define CONF_PRINT_PRINTER "/apps/epiphany/dialogs/print_printer_name" #define CONF_PRINT_FILE "/apps/epiphany/dialogs/print_file" #define CONF_PRINT_DIR "/apps/epiphany/directories/print_to_file" #define CONF_PRINT_PRINTON "/apps/epiphany/dialogs/print_on" @@ -72,12 +77,18 @@ enum FROM_PROP }; +enum +{ + COL_PRINTER_DISPLAY_NAME, + COL_PRINTER_NAME +}; + static const EphyDialogProperty print_props [] = { { "print_dialog", NULL, PT_NORMAL, 0 }, { "printer_radiobutton", CONF_PRINT_PRINTON, PT_AUTOAPPLY, 0 }, - { "printer_entry", CONF_PRINT_PRINTER, PT_AUTOAPPLY, 0 }, + { "printer_combobox", CONF_PRINT_PRINTER, PT_AUTOAPPLY, G_TYPE_STRING }, { "file_entry", CONF_PRINT_FILE, PT_AUTOAPPLY, 0 }, { "browse_button", NULL, PT_NORMAL, 0 }, { "all_pages_radiobutton", CONF_PRINT_ALL_PAGES, PT_AUTOAPPLY, 0 }, @@ -356,7 +367,12 @@ ephy_print_dialog_new (GtkWidget *parent, EphyEmbed *embed) { EphyDialog *dialog; - GtkWidget *window, *button; + GtkWidget *widget; + GList *printers, *l; + GtkListStore *store; + GtkTreeIter iter; + GtkCellRenderer *renderer; + EphyEmbedSingle *single; dialog = EPHY_DIALOG (g_object_new (EPHY_TYPE_EMBED_DIALOG, "embed", embed, @@ -373,11 +389,38 @@ ephy_print_dialog_new (GtkWidget *parent, "print_dialog", NULL); - window = ephy_dialog_get_control (dialog, print_props[WINDOW_PROP].id); - gtk_window_set_icon_name (GTK_WINDOW (window), GTK_STOCK_PRINT); + widget = ephy_dialog_get_control (dialog, print_props[WINDOW_PROP].id); + gtk_window_set_icon_name (GTK_WINDOW (widget), GTK_STOCK_PRINT); - button = ephy_dialog_get_control (dialog, print_props[BROWSE_PROP].id); - gtk_widget_set_sensitive (button, eel_gconf_key_is_writable (CONF_PRINT_FILE)); + widget = ephy_dialog_get_control (dialog, print_props[BROWSE_PROP].id); + gtk_widget_set_sensitive (widget, eel_gconf_key_is_writable (CONF_PRINT_FILE)); + + widget = ephy_dialog_get_control (dialog, print_props[PRINTER_PROP].id); + single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); + store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); + + printers = ephy_embed_single_get_printer_list (single); + for (l = printers; l != NULL; l = l->next) + { + gtk_list_store_append (store, &iter); + gtk_list_store_set (store, &iter, + COL_PRINTER_DISPLAY_NAME, l->data, + COL_PRINTER_NAME, l->data, + -1); + } + g_list_foreach (printers, (GFunc)g_free, NULL); + g_list_free (printers); + + gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store)); + g_object_unref (store); + + renderer = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget), renderer, TRUE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget), renderer, + "text", COL_PRINTER_DISPLAY_NAME, + NULL); + ephy_dialog_set_data_column (dialog, print_props[PRINTER_PROP].id, + COL_PRINTER_NAME); return dialog; } |