aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-07-22 01:25:53 +0800
committerChristian Persch <chpe@src.gnome.org>2006-07-22 01:25:53 +0800
commit800d438285ec852a357c2703a931a5c139b09cf2 (patch)
treefbd1f74b77660ff8b22855ab136bd79e00b5904b
parent17923704a6396397ceebe608cd0f0369dccef944 (diff)
downloadgsoc2013-epiphany-800d438285ec852a357c2703a931a5c139b09cf2.tar
gsoc2013-epiphany-800d438285ec852a357c2703a931a5c139b09cf2.tar.gz
gsoc2013-epiphany-800d438285ec852a357c2703a931a5c139b09cf2.tar.bz2
gsoc2013-epiphany-800d438285ec852a357c2703a931a5c139b09cf2.tar.lz
gsoc2013-epiphany-800d438285ec852a357c2703a931a5c139b09cf2.tar.xz
gsoc2013-epiphany-800d438285ec852a357c2703a931a5c139b09cf2.tar.zst
gsoc2013-epiphany-800d438285ec852a357c2703a931a5c139b09cf2.zip
Add our options in a custom tab in the print dialogue.
2006-07-21 Christian Persch <chpe@cvs.gnome.org> * data/epiphany.schemas.in: * data/glade/print.glade: * embed/mozilla/GeckoPrintService.cpp: * embed/mozilla/GeckoPrintService.h: * lib/ephy-gui.c: (ephy_gui_message_dialog_get_content_box), (ephy_gui_message_dialog_set_wrap_mode), (checkbutton_toggled_cb), (ephy_gui_connect_checkbutton_to_gconf): * lib/ephy-gui.h: Add our options in a custom tab in the print dialogue.
-rw-r--r--ChangeLog13
-rw-r--r--data/epiphany.schemas.in20
-rw-r--r--data/glade/print.glade579
-rw-r--r--embed/mozilla/GeckoPrintService.cpp284
-rw-r--r--embed/mozilla/GeckoPrintService.h1
-rw-r--r--lib/ephy-gui.c43
-rw-r--r--lib/ephy-gui.h13
7 files changed, 566 insertions, 387 deletions
diff --git a/ChangeLog b/ChangeLog
index 89c9f709e..66a5b04e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-07-21 Christian Persch <chpe@cvs.gnome.org>
+
+ * data/epiphany.schemas.in:
+ * data/glade/print.glade:
+ * embed/mozilla/GeckoPrintService.cpp:
+ * embed/mozilla/GeckoPrintService.h:
+ * lib/ephy-gui.c: (ephy_gui_message_dialog_get_content_box),
+ (ephy_gui_message_dialog_set_wrap_mode), (checkbutton_toggled_cb),
+ (ephy_gui_connect_checkbutton_to_gconf):
+ * lib/ephy-gui.h:
+
+ Add our options in a custom tab in the print dialogue.
+
2006-07-20 Christian Persch <chpe@cvs.gnome.org>
* lib/widgets/ephy-location-entry.c: (entry_key_press_cb),
diff --git a/data/epiphany.schemas.in b/data/epiphany.schemas.in
index e90c8abcb..382e8a1f3 100644
--- a/data/epiphany.schemas.in
+++ b/data/epiphany.schemas.in
@@ -292,6 +292,26 @@
</locale>
</schema>
<schema>
+ <key>/schemas/apps/epiphany/dialogs/print_background_colors</key>
+ <applyto>/apps/epiphany/dialogs/print_background_colors</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Whether to print the background color</short>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/dialogs/print_background_images</key>
+ <applyto>/apps/epiphany/dialogs/print_background_images</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Whether to print the background images</short>
+ </locale>
+ </schema>
+ <schema>
<key>/schemas/apps/epiphany/dialogs/print_page_numbers</key>
<applyto>/apps/epiphany/dialogs/print_page_numbers</applyto>
<owner>epiphany</owner>
diff --git a/data/glade/print.glade b/data/glade/print.glade
index 66ed201d8..12bfbaad7 100644
--- a/data/glade/print.glade
+++ b/data/glade/print.glade
@@ -4,16 +4,14 @@
<glade-interface>
<requires lib="gnome"/>
-<widget class="GtkDialog" id="print_setup_dialog">
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Print Setup</property>
+<widget class="GtkWindow" id="print_dialog_custom_tab">
+ <property name="visible">True</property>
+ <property name="title"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">False</property>
- <property name="destroy_with_parent">True</property>
- <property name="icon_name">stock_print-setup</property>
- <property name="role">epiphany-print-setup</property>
+ <property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
@@ -21,387 +19,332 @@
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
- <property name="has_separator">False</property>
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox8">
+ <child>
+ <widget class="GtkTable" id="custom_tab_container">
+ <property name="border_width">12</property>
<property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
<property name="homogeneous">False</property>
- <property name="spacing">2</property>
+ <property name="row_spacing">18</property>
+ <property name="column_spacing">18</property>
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area8">
+ <child>
+ <widget class="GtkVBox" id="vbox138">
<property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkButton" id="print_button">
+ <widget class="GtkLabel" id="label267">
<property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-close</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-7</property>
+ <property name="label" translatable="yes">&lt;b&gt;Headers&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
</widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
</child>
<child>
- <widget class="GtkButton" id="help_button">
+ <widget class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-help</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-11</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox124">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="print_page_title_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">P_age title</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="print_page_url_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Page address</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
</widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
</child>
</widget>
<packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
</packing>
</child>
<child>
- <widget class="GtkTable" id="table50">
- <property name="border_width">5</property>
+ <widget class="GtkVBox" id="vbox140">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
<property name="homogeneous">False</property>
- <property name="row_spacing">18</property>
- <property name="column_spacing">24</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkVBox" id="vbox138">
+ <widget class="GtkLabel" id="label269">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label267">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Headers&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkAlignment" id="alignment3">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">12</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkVBox" id="vbox124">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkCheckButton" id="print_page_title_checkbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">P_age title</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="print_page_url_checkbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Page address</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
+ <property name="label" translatable="yes">&lt;b&gt;Footers&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox140">
+ <widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
<child>
- <widget class="GtkLabel" id="label269">
+ <widget class="GtkVBox" id="vbox125">
<property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Footers&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkAlignment" id="alignment2">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">12</property>
- <property name="right_padding">0</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkVBox" id="vbox125">
+ <widget class="GtkCheckButton" id="print_page_numbers_checkbutton">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkCheckButton" id="print_page_numbers_checkbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Page _numbers</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Page _numbers</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkCheckButton" id="print_date_checkbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Date</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkCheckButton" id="print_date_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Date</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
</widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
</child>
</widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
</child>
</widget>
<packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox141">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkVBox" id="vbox141">
+ <widget class="GtkLabel" id="label272">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
+ <property name="label" translatable="yes">&lt;b&gt;Background&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="label272">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Colors&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment4">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
<child>
- <widget class="GtkAlignment" id="alignment4">
+ <widget class="GtkVBox" id="vbox142">
<property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">12</property>
- <property name="right_padding">0</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkVBox" id="vbox142">
+ <widget class="GtkCheckButton" id="print_bg_colors_checkbutton">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkRadioButton" id="print_color_radiobutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">C_olor</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Print background c_olors</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkRadioButton" id="print_grayscale_radiobutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Grayscale</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">print_color_radiobutton</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkCheckButton" id="print_bg_images_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Print background i_mages</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
</widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
</child>
</widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
</child>
</widget>
<packing>
- <property name="left_attach">0</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="left_attach">0</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
</packing>
</child>
</widget>
diff --git a/embed/mozilla/GeckoPrintService.cpp b/embed/mozilla/GeckoPrintService.cpp
index edbbc5303..3de2edf08 100644
--- a/embed/mozilla/GeckoPrintService.cpp
+++ b/embed/mozilla/GeckoPrintService.cpp
@@ -23,11 +23,14 @@
#include <glib.h>
#include <glib/gi18n.h>
-#include <gtk/gtkwindow.h>
+#include <gtk/gtkcheckbutton.h>
#include <gtk/gtkdialog.h>
-#include <gtk/gtkprintunixdialog.h>
+#include <gtk/gtklabel.h>
#include <gtk/gtkmessagedialog.h>
+#include <gtk/gtkprintunixdialog.h>
#include <gtk/gtkstock.h>
+#include <gtk/gtkwindow.h>
+#include <glade/glade-xml.h>
#include <nsStringAPI.h>
@@ -39,20 +42,34 @@
#include "ephy-debug.h"
#include "ephy-embed-shell.h"
#include "ephy-file-helpers.h"
+#include "ephy-gui.h"
#include "ephy-prefs.h"
#include "AutoJSContextStack.h"
+#include "AutoWindowModalState.h"
#include "EphyUtils.h"
#include "GeckoPrintSession.h"
#include "GeckoPrintService.h"
+/* Some printing keys */
+
+#define CONF_PRINT_BG_COLORS "/apps/epiphany/dialogs/print_background_colors"
+#define CONF_PRINT_BG_IMAGES "/apps/epiphany/dialogs/print_background_images"
+#define CONF_PRINT_COLOR "/apps/epiphany/dialogs/print_color"
+#define CONF_PRINT_DATE "/apps/epiphany/dialogs/print_date"
+#define CONF_PRINT_PAGE_NUMBERS "/apps/epiphany/dialogs/print_page_numbers"
+#define CONF_PRINT_PAGE_TITLE "/apps/epiphany/dialogs/print_page_title"
+#define CONF_PRINT_PAGE_URL "/apps/epiphany/dialogs/print_page_url"
+
#define LITERAL(s) NS_REINTERPRET_CAST(const nsAString::char_type*, NS_L(s))
/* From nsIDeviceContext.h */
#define NS_ERROR_GFX_PRINTER_BASE (1) /* adjustable :-) */
#define NS_ERROR_GFX_PRINTER_ACCESS_DENIED \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+5)
+#define NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND \
+ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+4)
NS_IMPL_ISUPPORTS1 (GeckoPrintService,
nsIPrintingPromptService)
@@ -85,59 +102,9 @@ GeckoPrintService::ShowPrintDialog (nsIDOMWindow *aParent,
GeckoPrintSession *session = GeckoPrintSession::FromSettings (aSettings);
NS_ENSURE_TRUE (session, NS_ERROR_INVALID_POINTER);
- GtkWidget *parent = EphyUtils::FindGtkParent (aParent);
- NS_ENSURE_TRUE(parent, NS_ERROR_INVALID_POINTER);
-
- PRBool isCalledFromScript = EphyJSUtils::IsCalledFromScript ();
-
- nsresult rv;
- AutoJSContextStack stack;
- rv = stack.Init ();
- if (NS_FAILED (rv)) {
- return rv;
- }
-
- EphyEmbedShell *shell = ephy_embed_shell_get_default ();
-
/* Print settings changes disallowed, just translate the settings */
if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINT_SETUP)) {
- /* FIXME: we need to call session->SetSettings first, and for that we need a
- * way to get the default printer object!
- */
- g_warning ("Printing with locked print setup doesn't work!");
- return NS_ERROR_FAILURE;
-
- /* If called from a script, give the user a way to cancel the print! */
- if (isCalledFromScript) {
- GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
- GtkDialogFlags (0),
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_CANCEL,
- "%s", _("Print this page?"));
- gtk_window_set_icon_name (GTK_WINDOW (dialog), "web-browser");
- gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_PRINT,
- GTK_RESPONSE_ACCEPT);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
-
- int response = gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
- if (response != GTK_RESPONSE_ACCEPT) {
- return NS_ERROR_ABORT;
- }
- }
-
- nsCString sourceFile;
- session->GetSourceFile (sourceFile);
- if (!sourceFile.IsEmpty ()) {
- rv = TranslateSettings (ephy_embed_shell_get_print_settings (shell),
- ephy_embed_shell_get_page_setup (shell),
- sourceFile, PR_TRUE, aSettings);
- } else {
- rv = NS_ERROR_FAILURE;
- }
-
- return rv;
+ return PrintUnattended (aParent, aSettings);
}
/* Not locked down, show the dialogue */
@@ -152,6 +119,35 @@ GeckoPrintService::ShowPrintDialog (nsIDOMWindow *aParent,
NS_ENSURE_SUCCESS (rv, rv);
#endif
+ GtkWidget *parent = EphyUtils::FindGtkParent (aParent);
+ NS_ENSURE_TRUE(parent, NS_ERROR_INVALID_POINTER);
+
+ nsresult rv;
+ AutoJSContextStack stack;
+ rv = stack.Init ();
+ if (NS_FAILED (rv)) {
+ return rv;
+ }
+
+ AutoWindowModalState modalState (aParent);
+
+ EphyEmbedShell *shell = ephy_embed_shell_get_default ();
+
+ GladeXML *xml = glade_xml_new (ephy_file ("print.glade"),
+ "print_dialog_custom_tab", NULL);
+ if (!xml) {
+ return NS_ERROR_FAILURE;
+ }
+
+ /* Build the custom tab */
+ GtkWidget *custom_tab = glade_xml_get_widget (xml, "custom_tab_container");
+ ephy_gui_connect_checkbutton_to_gconf (glade_xml_get_widget (xml, "print_bg_colors_checkbutton"), CONF_PRINT_BG_COLORS);
+ ephy_gui_connect_checkbutton_to_gconf (glade_xml_get_widget (xml, "print_bg_images_checkbutton"), CONF_PRINT_BG_IMAGES);
+ ephy_gui_connect_checkbutton_to_gconf (glade_xml_get_widget (xml, "print_date_checkbutton"), CONF_PRINT_DATE);
+ ephy_gui_connect_checkbutton_to_gconf (glade_xml_get_widget (xml, "print_page_numbers_checkbutton"), CONF_PRINT_PAGE_NUMBERS);
+ ephy_gui_connect_checkbutton_to_gconf (glade_xml_get_widget (xml, "print_page_title_checkbutton"), CONF_PRINT_PAGE_TITLE);
+ ephy_gui_connect_checkbutton_to_gconf (glade_xml_get_widget (xml, "print_page_url_checkbutton"), CONF_PRINT_PAGE_URL);
+
/* FIXME: this sucks! find some way to do all of this async! */
GtkWidget *dialog = gtk_print_unix_dialog_new (NULL /* FIXME title */,
GTK_WINDOW (parent));
@@ -170,6 +166,13 @@ GeckoPrintService::ShowPrintDialog (nsIDOMWindow *aParent,
gtk_print_unix_dialog_set_settings (print_dialog,
ephy_embed_shell_get_print_settings (shell));
+ /* Remove custom tab from its dummy window and put it in the print dialogue */
+ g_object_ref_sink (custom_tab);
+ gtk_container_remove (GTK_CONTAINER (custom_tab->parent), custom_tab);
+ gtk_print_unix_dialog_add_custom_tab (print_dialog, custom_tab,
+ gtk_label_new (_("Options"))); /* FIXME better name! */
+ g_object_unref (custom_tab);
+
gtk_window_set_icon_name (GTK_WINDOW (dialog), "web-browser");
int response = gtk_dialog_run (GTK_DIALOG (dialog));
@@ -281,6 +284,8 @@ NS_IMETHODIMP GeckoPrintService::ShowPageSetup (nsIDOMWindow *aParent,
return rv;
}
+ AutoWindowModalState modalState (aParent);
+
EphyEmbedShell *shell = ephy_embed_shell_get_default ();
GtkPageSetup *new_setup =
gtk_print_run_page_setup_dialog (GTK_WINDOW (parent),
@@ -308,6 +313,156 @@ GeckoPrintService::ShowPrinterProperties (nsIDOMWindow *aParent,
return NS_ERROR_NOT_IMPLEMENTED;
}
+/* Private methods */
+
+#if 0
+typedef struct
+{
+ GMainLoop *mainLoop;
+ GtkPrinter *mPrinter;
+ guint timeout;
+ int response;
+ guint cancelled : 1;
+} FindPrinterData;
+
+static void
+FreeFindPrinterData (FindPrinterData *data)
+{
+ if (data->printer) {
+ g_object_unref (data->printer);
+ }
+}
+
+static void
+DialogResponseCallback (GtkWidget *aDialog,
+ int aResponse,
+ FindPrinterData *data)
+{
+ data->response = aResponse;
+ g_main_loop_quit (data->mainloop);
+}
+
+static void
+TimeoutCallback (FindPrinterData *data)
+{
+ data->cancelled = TRUE;
+ g_main_loop_quit (data->mainLoop);
+ data->mainLoop = NULL;
+ return FALSE;
+}
+
+static gboolean
+PrinterEnumerateCallback (GtkPrinter *aPrinter,
+ FindPrinterData *data)
+{
+ if (data->cancelled)
+ return TRUE;
+
+ if ((data->printerName &&
+ strcmp (data->printerName, gtk_printer_get_name (aPrinter)) == 0) ||
+ (!data->printerName &&
+ gtk_printer_is_default (aPrinter))) {
+ data->printer = g_object_ref (aPrinter);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+#endif
+
+nsresult
+GeckoPrintService::PrintUnattended (nsIDOMWindow *aParent,
+ nsIPrintSettings *aPrintSettings)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+#if 0
+ GtkWidget *parent = EphyUtils::FindGtkParent (aParent);
+ NS_ENSURE_TRUE(parent, NS_ERROR_INVALID_POINTER);
+
+ PRBool isCalledFromScript = EphyJSUtils::IsCalledFromScript ();
+
+ nsresult rv;
+ AutoJSContextStack stack;
+ rv = stack.Init ();
+ if (NS_FAILED (rv)) {
+ return rv;
+ }
+
+ AutoWindowModalState modalState (aParent);
+
+ EphyEmbedShell *shell = ephy_embed_shell_get_default ();
+ GtkPrintSettings *settings = ephy_embed_shell_get_print_settings (shell);
+ NS_ENSURE_TRUE (settings, NS_ERROR_FAILURE);
+
+ const char *printer = gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_PRINTER);
+#if 0
+ if (!printer || !printer[0]) {
+ return NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND;
+ }
+#endif
+ /* We need to find the printer, so we need to run a mainloop.
+ * If called from a script, give the user a way to cancel the print;
+ * otherwise we'll just show a generic progress message.
+ */
+ GtkWidget *dialog;
+ if (isCalledFromScript) {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GtkDialogFlags (0),
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_CANCEL,
+ "%s", _("Print this page?"));
+ gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_PRINT,
+ GTK_RESPONSE_ACCEPT);
+ } else {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GtkDialogFlags (0),
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_CANCEL,
+ "%s", _("Preparing to print"));
+ }
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), "web-browser");
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+
+ FindPrinterData *data = g_new0 (PrinterData, 1);
+ data->dialog = dialog;
+
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (DialogResponseCallback), data);
+
+ /* Don't run forever */
+ data->timeoutId = g_timeout_add (PRINTER_ENUMERATE_TIMEOUT,
+ (GSourceFunc) EnumerateTimoutCallback,
+ data);
+ /* Enumerate printers until we find our printer */
+ gtk_enumerate_printers ((GtkPrinterFunc) PrinterEnumerateCallback,
+ data,
+ (GDestroyNotify) EnumerateDestroyCallback, FALSE);
+
+ /* Now run the mainloop */
+ int response = gtk_dialog_run (GTK_DIALOG (dialog));
+ Printer
+ gtk_widget_destroy (dialog);
+
+ if (response != GTK_RESPONSE_ACCEPT) {
+ return NS_ERROR_ABORT;
+ }
+
+ nsCString sourceFile;
+ session->GetSourceFile (sourceFile);
+ if (!sourceFile.IsEmpty ()) {
+ rv = TranslateSettings (settings,
+ ephy_embed_shell_get_page_setup (shell),
+ sourceFile, PR_TRUE, aSettings);
+ } else {
+ rv = NS_ERROR_FAILURE;
+ }
+
+ return rv;
+ }
+#endif /* if 0 */
+}
+
/* Static methods */
/* static */ nsresult
@@ -329,8 +484,8 @@ GeckoPrintService::TranslateSettings (GtkPrintSettings *aGtkSettings,
#endif
/* Initialisation */
- aSettings->SetIsInitializedFromPrinter (PR_FALSE);
- aSettings->SetIsInitializedFromPrefs (PR_FALSE);
+ aSettings->SetIsInitializedFromPrinter (PR_FALSE); /* FIXME: PR_TRUE? */
+ aSettings->SetIsInitializedFromPrefs (PR_FALSE); /* FIXME: PR_TRUE? */
aSettings->SetPrintSilent (PR_FALSE);
aSettings->SetShowPrintProgress (PR_TRUE);
aSettings->SetNumCopies (1);
@@ -473,15 +628,12 @@ GeckoPrintService::TranslateSettings (GtkPrintSettings *aGtkSettings,
aSettings->SetMarginLeft (gtk_page_setup_get_left_margin (aPageSetup, GTK_UNIT_INCH));
aSettings->SetMarginRight (gtk_page_setup_get_right_margin (aPageSetup, GTK_UNIT_INCH));
-#if 0
- // FIXME !
- aSettings->SetHeaderStrLeft(const PRUnichar * aHeaderStrLeft);
- aSettings->SetHeaderStrCenter(const PRUnichar * aHeaderStrCenter);
- aSettings->SetHeaderStrRight(const PRUnichar * aHeaderStrRight);
- aSettings->SetFooterStrLeft(const PRUnichar * aFooterStrLeft);
- aSettings->SetFooterStrCenter(const PRUnichar * aFooterStrCenter);
- aSettings->SetFooterStrRight(const PRUnichar * aFooterStrRight);
-#endif
+ aSettings->SetHeaderStrLeft (eel_gconf_get_boolean (CONF_PRINT_PAGE_TITLE) ? LITERAL ("&T") : LITERAL (""));
+ aSettings->SetHeaderStrCenter (LITERAL (""));
+ aSettings->SetHeaderStrRight (eel_gconf_get_boolean (CONF_PRINT_PAGE_URL) ? LITERAL ("&U") : LITERAL (""));
+ aSettings->SetFooterStrLeft (eel_gconf_get_boolean (CONF_PRINT_PAGE_NUMBERS) ? LITERAL ("&PT") : LITERAL (""));
+ aSettings->SetFooterStrCenter (LITERAL (""));
+ aSettings->SetFooterStrRight (eel_gconf_get_boolean (CONF_PRINT_DATE) ? LITERAL ("&D") : LITERAL (""));
/* FIXME I think this is the right default, but this prevents the user
* from cancelling the print immediately, see the stupid comment in nsPrintEngine:
@@ -495,8 +647,8 @@ GeckoPrintService::TranslateSettings (GtkPrintSettings *aGtkSettings,
aSettings->SetScaling (gtk_print_settings_get_scale (aGtkSettings) / 100.0);
aSettings->SetShrinkToFit (PR_FALSE); /* FIXME setting */
- aSettings->SetPrintBGColors (PR_FALSE); /* FIXME setting */
- aSettings->SetPrintBGImages (PR_FALSE); /* FIXME setting */
+ aSettings->SetPrintBGColors (eel_gconf_get_boolean (CONF_PRINT_BG_COLORS) != FALSE);
+ aSettings->SetPrintBGImages (eel_gconf_get_boolean (CONF_PRINT_BG_IMAGES) != FALSE);
/* aSettings->SetPlexName (LITERAL ("default")); */
/* aSettings->SetColorspace (LITERAL ("default")); */
diff --git a/embed/mozilla/GeckoPrintService.h b/embed/mozilla/GeckoPrintService.h
index c9e0eb6ad..3a0579374 100644
--- a/embed/mozilla/GeckoPrintService.h
+++ b/embed/mozilla/GeckoPrintService.h
@@ -47,6 +47,7 @@ public:
static nsresult TranslateSettings (GtkPrintSettings*, GtkPageSetup *, const nsACString&, PRBool, nsIPrintSettings*);
private:
+ nsresult PrintUnattended (nsIDOMWindow *, nsIPrintSettings *);
};
#endif /* GECKO_PRINT_SERVICE_H */
diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c
index d69a9dca3..09d60d830 100644
--- a/lib/ephy-gui.c
+++ b/lib/ephy-gui.c
@@ -38,6 +38,7 @@
#include <gtk/gtkmain.h>
#include <gtk/gtktreeselection.h>
#include <gtk/gtktoolbar.h>
+#include <gtk/gtktogglebutton.h>
#include <unistd.h>
@@ -494,3 +495,45 @@ ephy_gui_message_dialog_get_content_box (GtkWidget *dialog)
return container;
}
+
+/* Until bug #345349 is fixed */
+void
+ephy_gui_message_dialog_set_wrap_mode (GtkMessageDialog *dialog,
+ PangoWrapMode wrap_mode)
+{
+ GtkContainer *container;
+ GList *children, *l;
+
+ container = GTK_CONTAINER (dialog->label->parent);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+
+ children = gtk_container_get_children (container);
+ for (l = children; l != NULL; l = l->next)
+ {
+ GtkWidget *child = l->data;
+
+ if (GTK_IS_LABEL (child))
+ {
+ g_print ("Setting wrap mode on label %p\n", child);
+ gtk_label_set_line_wrap_mode (GTK_LABEL (child),
+ wrap_mode);
+ }
+ }
+}
+
+static void
+checkbutton_toggled_cb (GtkToggleButton *button,
+ const char *pref)
+{
+ eel_gconf_set_boolean (pref, gtk_toggle_button_get_active (button));
+}
+
+void
+ephy_gui_connect_checkbutton_to_gconf (GtkWidget *widget,
+ const char *pref)
+{
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
+ eel_gconf_get_boolean (pref));
+ g_signal_connect (widget, "toggled",
+ G_CALLBACK (checkbutton_toggled_cb), (gpointer) pref);
+}
diff --git a/lib/ephy-gui.h b/lib/ephy-gui.h
index 10b681fbe..d989b06e6 100644
--- a/lib/ephy-gui.h
+++ b/lib/ephy-gui.h
@@ -21,12 +21,13 @@
#ifndef EPHY_GUI_H
#define EPHY_GUI_H
+#include <gdk/gdkkeysyms.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtkmenu.h>
-#include <gtk/gtktreeview.h>
+#include <gtk/gtkmessagedialog.h>
#include <gtk/gtktreeviewcolumn.h>
+#include <gtk/gtktreeview.h>
#include <gtk/gtkwindow.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gdk/gdkkeysyms.h>
G_BEGIN_DECLS
@@ -78,6 +79,12 @@ void ephy_gui_window_update_user_time (GtkWidget *window,
GtkWidget *ephy_gui_message_dialog_get_content_box (GtkWidget *dialog);
+void ephy_gui_message_dialog_set_wrap_mode (GtkMessageDialog *dialog,
+ PangoWrapMode wrap_mode);
+
+void ephy_gui_connect_checkbutton_to_gconf (GtkWidget *widget,
+ const char *pref);
+
G_END_DECLS
#endif