[gedit/wip/improve-printing: 3/3] tab: simplify code
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/improve-printing: 3/3] tab: simplify code
- Date: Thu, 19 Feb 2015 19:20:01 +0000 (UTC)
commit 32c3519ff7e29483e68e01ee49d2abfda2741005
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Feb 19 20:16:28 2015 +0100
tab: simplify code
Merge gedit_tab_print_or_print_preview() into _gedit_tab_print().
gedit/gedit-tab.c | 47 ++++++++++++++++-------------------------------
1 files changed, 16 insertions(+), 31 deletions(-)
---
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 2e84725..c1830e0 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -2884,9 +2884,8 @@ show_printing_info_bar (GeditTab *tab)
set_info_bar (tab, bar, GTK_RESPONSE_NONE);
}
-static void
-gedit_tab_print_or_print_preview (GeditTab *tab,
- GtkPrintOperationAction print_action)
+void
+_gedit_tab_print (GeditTab *tab)
{
GeditView *view;
GtkPageSetup *setup;
@@ -2894,6 +2893,16 @@ gedit_tab_print_or_print_preview (GeditTab *tab,
GtkPrintOperationResult res;
GError *error = NULL;
+ g_return_if_fail (GEDIT_IS_TAB (tab));
+
+ /* FIXME: currently we can have just one printoperation going on
+ * at a given time, so before starting the print we close the preview.
+ * Would be nice to handle it properly though */
+ if (tab->priv->state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)
+ {
+ gtk_widget_destroy (tab->priv->print_preview);
+ }
+
g_return_if_fail (tab->priv->print_job == NULL);
g_return_if_fail (tab->priv->state == GEDIT_TAB_STATE_NORMAL);
@@ -2923,22 +2932,15 @@ gedit_tab_print_or_print_preview (GeditTab *tab,
tab,
0);
- if (print_action == GTK_PRINT_OPERATION_ACTION_PREVIEW)
- {
- gedit_tab_set_state (tab, GEDIT_TAB_STATE_PRINT_PREVIEWING);
- }
- else
- {
- /* hide until we start printing */
- gtk_widget_hide (tab->priv->info_bar);
- gedit_tab_set_state (tab, GEDIT_TAB_STATE_PRINTING);
- }
+ /* hide until we start printing */
+ gtk_widget_hide (tab->priv->info_bar);
+ gedit_tab_set_state (tab, GEDIT_TAB_STATE_PRINTING);
setup = get_page_setup (tab);
settings = get_print_settings (tab);
res = gedit_print_job_print (tab->priv->print_job,
- print_action,
+ GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
setup,
settings,
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab))),
@@ -2958,23 +2960,6 @@ gedit_tab_print_or_print_preview (GeditTab *tab,
}
void
-_gedit_tab_print (GeditTab *tab)
-{
- g_return_if_fail (GEDIT_IS_TAB (tab));
-
- /* FIXME: currently we can have just one printoperation going on
- * at a given time, so before starting the print we close the preview.
- * Would be nice to handle it properly though */
- if (tab->priv->state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)
- {
- gtk_widget_destroy (tab->priv->print_preview);
- }
-
- gedit_tab_print_or_print_preview (tab,
- GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-}
-
-void
_gedit_tab_mark_for_closing (GeditTab *tab)
{
g_return_if_fail (GEDIT_IS_TAB (tab));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]