aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-06-15 20:01:53 +0800
committerChristian Persch <chpe@src.gnome.org>2003-06-15 20:01:53 +0800
commit5a927d2793acbd7ca212812048e41891cda8a6e9 (patch)
treec1d9fe682c7af65fda89ab591e7e9b729ac0596a
parentfa31654eac12411d58ab603924953410c53e1426 (diff)
downloadgsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.tar
gsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.tar.gz
gsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.tar.bz2
gsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.tar.lz
gsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.tar.xz
gsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.tar.zst
gsoc2013-epiphany-5a927d2793acbd7ca212812048e41891cda8a6e9.zip
Convert dialog to metric units and default paper to A4. Fixes #112619
2003-06-15 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/MozillaPrivate.cpp: (MozillaCollatePrintSettings): * embed/ephy-embed.h: * embed/print-dialog.c: (print_dialog_init), (print_free_info), (print_get_info): * data/epiphany.schemas.in: * data/glade/print.glade: Convert dialog to metric units and default paper to A4. Fixes #112619
-rw-r--r--ChangeLog11
-rw-r--r--data/epiphany.schemas.in31
-rw-r--r--data/glade/print.glade52
-rw-r--r--embed/ephy-embed.h10
-rw-r--r--embed/mozilla/MozillaPrivate.cpp17
-rwxr-xr-xembed/print-dialog.c15
6 files changed, 77 insertions, 59 deletions
diff --git a/ChangeLog b/ChangeLog
index 49504d757..296d50697 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2003-06-15 Christian Persch <chpe@cvs.gnome.org>
+ * embed/mozilla/MozillaPrivate.cpp: (MozillaCollatePrintSettings):
+ * embed/ephy-embed.h:
+ * embed/print-dialog.c: (print_dialog_init), (print_free_info),
+ (print_get_info):
+ * data/epiphany.schemas.in:
+ * data/glade/print.glade:
+
+ Convert dialog to metric units and default paper to A4. Fixes #112619
+
+2003-06-15 Christian Persch <chpe@cvs.gnome.org>
+
* src/session.c: (do_session_resume):
* embed/ephy-favicon-cache.c: (ephy_favicon_cache_download),
(ephy_favicon_cache_get):
diff --git a/data/epiphany.schemas.in b/data/epiphany.schemas.in
index 196ebff7a..5af667ed2 100644
--- a/data/epiphany.schemas.in
+++ b/data/epiphany.schemas.in
@@ -230,44 +230,44 @@
<key>/schemas/apps/epiphany/dialogs/print_top_margin</key>
<applyto>/apps/epiphany/dialogs/print_top_margin</applyto>
<owner>epiphany</owner>
- <type>float</type>
- <default>0.5</default>
+ <type>int</type>
+ <default>10</default>
<locale name="C">
<short>Printing top margin</short>
- <long>Printing top margin (in inches).</long>
+ <long>Printing top margin (in mm).</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/epiphany/dialogs/print_bottom_margin</key>
<applyto>/apps/epiphany/dialogs/print_bottom_margin</applyto>
<owner>epiphany</owner>
- <type>float</type>
- <default>0.5</default>
+ <type>int</type>
+ <default>10</default>
<locale name="C">
<short>Printing bottom margin</short>
- <long>Printing bottom margin (in inches).</long>
+ <long>Printing bottom margin (in mm).</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/epiphany/dialogs/print_left_margin</key>
<applyto>/apps/epiphany/dialogs/print_left_margin</applyto>
<owner>epiphany</owner>
- <type>float</type>
- <default>0.5</default>
+ <type>int</type>
+ <default>10</default>
<locale name="C">
<short>Printing left margin</short>
- <long>Printing left margin (in inches).</long>
+ <long>Printing left margin (in mm).</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/epiphany/dialogs/print_right_margin</key>
<applyto>/apps/epiphany/dialogs/print_right_margin</applyto>
<owner>epiphany</owner>
- <type>float</type>
- <default>0.5</default>
+ <type>int</type>
+ <default>10</default>
<locale name="C">
<short>Printing right margin</short>
- <long>Printing right margin (in inches).</long>
+ <long>Printing right margin (in mm).</long>
</locale>
</schema>
<schema>
@@ -339,11 +339,12 @@
<key>/schemas/apps/epiphany/dialogs/print_paper</key>
<applyto>/apps/epiphany/dialogs/print_paper</applyto>
<owner>epiphany</owner>
- <type>int</type>
- <default>0</default>
+ <type>string</type>
+ <default>A4</default>
<locale name="C">
<short>Paper type</short>
- <long>Paper type: letter, legal, executive, A4.</long>
+ <long>Paper type. Supported values are "A4", "Letter", "Legal"
+ and "Executive".</long>
</locale>
</schema>
<schema>
diff --git a/data/glade/print.glade b/data/glade/print.glade
index ff2f24a7f..d1ed75ad7 100644
--- a/data/glade/print.glade
+++ b/data/glade/print.glade
@@ -609,13 +609,13 @@
<property name="spacing">6</property>
<child>
- <widget class="GtkRadioButton" id="letter_radiobutton">
+ <widget class="GtkRadioButton" id="A4_radiobutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">_Letter (8.5&quot; x 11&quot;)</property>
+ <property name="label" translatable="yes">A_4</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
+ <property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
@@ -627,16 +627,16 @@
</child>
<child>
- <widget class="GtkRadioButton" id="legal_radiobutton">
+ <widget class="GtkRadioButton" id="letter_radiobutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">L_egal (8.5&quot; x 14&quot;)</property>
+ <property name="label" translatable="yes">_Letter</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
- <property name="group">letter_radiobutton</property>
+ <property name="group">A4_radiobutton</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -646,16 +646,16 @@
</child>
<child>
- <widget class="GtkRadioButton" id="executive_radiobutton">
+ <widget class="GtkRadioButton" id="legal_radiobutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">E_xecutive (7.25&quot; x 10.5&quot;)</property>
+ <property name="label" translatable="yes">L_egal</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
- <property name="group">letter_radiobutton</property>
+ <property name="group">A4_radiobutton</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -665,16 +665,16 @@
</child>
<child>
- <widget class="GtkRadioButton" id="A4_radiobutton">
+ <widget class="GtkRadioButton" id="executive_radiobutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">A_4 (8.27&quot; x 11.69&quot;)</property>
+ <property name="label" translatable="yes">E_xecutive</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">True</property>
+ <property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
- <property name="group">letter_radiobutton</property>
+ <property name="group">A4_radiobutton</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -1056,7 +1056,7 @@
<child>
<widget class="GtkLabel" id="label261">
<property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Margins (Inches)&lt;/b&gt;</property>
+ <property name="label" translatable="yes">&lt;b&gt;Margins (in mm)&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -1214,13 +1214,13 @@
<widget class="GtkSpinButton" id="bottom_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="climb_rate">0.1</property>
- <property name="digits">1</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0.6 0 100 0.1 10 10</property>
+ <property name="adjustment">10 0 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -1235,13 +1235,13 @@
<widget class="GtkSpinButton" id="left_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="climb_rate">0.1</property>
- <property name="digits">1</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0.5 0 100 0.1 10 10</property>
+ <property name="adjustment">10 0 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -1256,13 +1256,13 @@
<widget class="GtkSpinButton" id="top_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="climb_rate">0.1</property>
- <property name="digits">1</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0.3 0 100 0.1 10 10</property>
+ <property name="adjustment">10 0 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -1277,13 +1277,13 @@
<widget class="GtkSpinButton" id="right_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="climb_rate">0.1</property>
- <property name="digits">1</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0.5 0 100 0.1 10 10</property>
+ <property name="adjustment">10 0 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index c4cac0aef..a80d11d80 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -108,11 +108,11 @@ typedef struct
gboolean print_to_file;
gchar *printer;
gchar *file;
- gint paper;
- gdouble top_margin;
- gdouble bottom_margin;
- gdouble left_margin;
- gdouble right_margin;
+ gchar *paper;
+ gint top_margin;
+ gint bottom_margin;
+ gint left_margin;
+ gint right_margin;
gint pages;
gint from_page;
gint to_page;
diff --git a/embed/mozilla/MozillaPrivate.cpp b/embed/mozilla/MozillaPrivate.cpp
index 0847f3473..46ece8418 100644
--- a/embed/mozilla/MozillaPrivate.cpp
+++ b/embed/mozilla/MozillaPrivate.cpp
@@ -37,6 +37,7 @@ GtkWidget *MozillaFindGtkParent (nsIDOMWindow *aDOMWindow)
return gtk_widget_get_toplevel (GTK_WIDGET(mozembed));
}
+#define MM_TO_INCH(x) (((double) x) / 25.4)
NS_METHOD MozillaCollatePrintSettings (const EmbedPrintInfo *info,
nsIPrintSettings *options)
@@ -46,11 +47,6 @@ NS_METHOD MozillaCollatePrintSettings (const EmbedPrintInfo *info,
nsIPrintSettings::kSelectedFrame,
nsIPrintSettings::kEachFrameSep
};
- /* these should match the order of the radiobuttons in the dialog
- * and the paper names in the default print provider PS*/
- const static char *PaperSizeNames[] = {
- "Letter","Legal","Executive","A4"
- };
switch (info->pages)
@@ -68,10 +64,10 @@ NS_METHOD MozillaCollatePrintSettings (const EmbedPrintInfo *info,
break;
}
- options->SetMarginTop (info->top_margin);
- options->SetMarginBottom (info->bottom_margin);
- options->SetMarginLeft (info->left_margin);
- options->SetMarginRight (info->right_margin);
+ options->SetMarginTop (MM_TO_INCH (info->top_margin));
+ options->SetMarginBottom (MM_TO_INCH (info->bottom_margin));
+ options->SetMarginLeft (MM_TO_INCH (info->left_margin));
+ options->SetMarginRight (MM_TO_INCH (info->right_margin));
options->SetPrinterName(NS_LITERAL_STRING("PostScript/default").get());
@@ -95,8 +91,7 @@ NS_METHOD MozillaCollatePrintSettings (const EmbedPrintInfo *info,
/* native paper size formats. Our dialog does not support custom yet */
options->SetPaperSize (nsIPrintSettings::kPaperSizeNativeData);
- int tps = (info->paper >= 0 || info->paper < 4) ? info->paper : 0;
- options->SetPaperName (NS_ConvertUTF8toUCS2(PaperSizeNames[tps]).get());
+ options->SetPaperName (NS_ConvertUTF8toUCS2(info->paper).get());
options->SetPrintInColor (info->print_color);
options->SetOrientation (info->orientation);
diff --git a/embed/print-dialog.c b/embed/print-dialog.c
index baf636cd0..f69ee8811 100755
--- a/embed/print-dialog.c
+++ b/embed/print-dialog.c
@@ -95,7 +95,7 @@ EphyDialogProperty properties [] =
{ PRINTON_PROP, "printer_radiobutton", CONF_PRINT_PRINTON, PT_NORMAL, NULL },
{ PRINTER_PROP, "printer_entry", CONF_PRINT_PRINTER, PT_NORMAL, NULL },
{ FILE_PROP, "file_entry", CONF_PRINT_FILE, PT_NORMAL, NULL },
- { PAPER_PROP,"letter_radiobutton", CONF_PRINT_PAPER, PT_NORMAL, NULL },
+ { PAPER_PROP,"A4_radiobutton", CONF_PRINT_PAPER, PT_NORMAL, NULL },
{ TOP_PROP, "top_spinbutton", CONF_PRINT_TOP_MARGIN, PT_NORMAL, NULL },
{ BOTTOM_PROP, "bottom_spinbutton", CONF_PRINT_BOTTOM_MARGIN, PT_NORMAL, NULL },
{ LEFT_PROP,"left_spinbutton", CONF_PRINT_LEFT_MARGIN, PT_NORMAL, NULL },
@@ -113,6 +113,13 @@ EphyDialogProperty properties [] =
{ -1, NULL, NULL }
};
+static const
+char *paper_format_enum [] =
+{
+ "A4", "Letter", "Legal", "Executive"
+};
+static guint n_paper_format_enum = G_N_ELEMENTS (paper_format_enum);
+
static guint print_dialog_signals[LAST_SIGNAL] = { 0 };
GType
@@ -179,6 +186,9 @@ print_dialog_init (PrintDialog *dialog)
"print.glade", "print_dialog");
dialog->priv->window = ephy_dialog_get_control (EPHY_DIALOG(dialog), WINDOW_PROP);
+
+ ephy_dialog_add_enum (EPHY_DIALOG (dialog), PAPER_PROP,
+ n_paper_format_enum, paper_format_enum);
icon = gtk_widget_render_icon (dialog->priv->window,
GTK_STOCK_PRINT,
@@ -244,6 +254,7 @@ print_free_info (EmbedPrintInfo *info)
{
g_free (info->printer);
g_free (info->file);
+ g_free (info->paper);
g_free (info->header_left_string);
g_free (info->header_right_string);
g_free (info->footer_left_string);
@@ -303,7 +314,7 @@ print_get_info (EphyDialog *dialog)
info->to_page = g_value_get_float (&to_page);
ephy_dialog_get_value (dialog, PAPER_PROP, &paper);
- info->paper = g_value_get_int (&paper);
+ info->paper = g_strdup (paper_format_enum[g_value_get_int (&paper)]);
ephy_dialog_get_value (dialog, ALL_PAGES_PROP, &pages);
info->pages = g_value_get_int (&pages);