[gnumeric] enable pagesetup combos in sheet object print dialog



commit 721ad788b2a3b41dafa84fa95af4520cf969366f
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Thu Sep 29 13:20:46 2011 -0600

    enable pagesetup combos in sheet object print dialog
    
    2011-09-29 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/print.c (gnm_print_so): enable pagesetup combos

 ChangeLog                  |    4 ++++
 src/print.c                |   11 ++++++-----
 src/widgets/gnm-notebook.c |   40 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ec22096..6788b78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2011-09-29 Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* src/print.c (gnm_print_so): enable pagesetup combos
+
+2011-09-29 Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* src/print.c (gnm_draw_so_page_cb): new
 	(gnm_print_so): implement
 	* src/sheet-object.c (sheet_object_populate_menu_real): enable print item
diff --git a/src/print.c b/src/print.c
index 6de85db..3b84c61 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1818,10 +1818,10 @@ gnm_print_sheet (WorkbookControl *wbc, Sheet *sheet,
 }
 
 static void
-gnm_draw_so_page_cb (GtkPrintOperation *operation,
-                  GtkPrintContext   *context,
-		  gint               page_nr,
-		  gpointer           user_data)
+gnm_draw_so_page_cb (G_GNUC_UNUSED GtkPrintOperation *operation,
+		     GtkPrintContext                 *context,
+		     G_GNUC_UNUSED gint               page_nr,
+		     gpointer                         user_data)
 {
 
 	SheetObject *so = (SheetObject *) user_data;
@@ -1863,7 +1863,8 @@ gnm_print_so (WorkbookControl *wbc, SheetObject *so)
 		g_object_unref (page_setup);
 	}
 
-	gtk_print_operation_set_n_pages(print, 1);
+	gtk_print_operation_set_n_pages (print, 1);
+	gtk_print_operation_set_embed_page_setup (print, TRUE);
 	
 	g_signal_connect (print, "draw-page", G_CALLBACK (gnm_draw_so_page_cb), so);
 
diff --git a/src/widgets/gnm-notebook.c b/src/widgets/gnm-notebook.c
index b4f1e36..3ad366c 100644
--- a/src/widgets/gnm-notebook.c
+++ b/src/widgets/gnm-notebook.c
@@ -1,3 +1,4 @@
+/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /**
  * gnm-notebook.c: Implements a button-only notebook.
  *
@@ -70,6 +71,40 @@ gnm_notebook_size_allocate (GtkWidget     *widget,
 }
 
 static void
+gnm_notebook_adjust_this_tab_appearance (GnmNotebook *nb, GtkWidget *page, gboolean active)
+{
+	GtkWidget *tab;
+
+	if (page == NULL)
+		return;
+	
+	tab = gtk_notebook_get_tab_label 
+		(GTK_NOTEBOOK (nb), page);
+	gtk_entry_set_has_frame (GTK_ENTRY (tab), active);
+}
+
+static void
+gnm_notebook_adjust_tab_appearance (GnmNotebook *nb, GtkWidget *old, GtkWidget *new)
+{
+	gnm_notebook_adjust_this_tab_appearance (nb, old, FALSE);
+	gnm_notebook_adjust_this_tab_appearance (nb, new, TRUE);
+}
+
+static void
+gnm_notebook_switch_page_cb (GtkNotebook *notebook,
+			     GtkWidget   *page,
+			     G_GNUC_UNUSED guint page_num,
+			     GnmNotebook *nb)
+{
+	GtkWidget *current_page = NULL;
+	gint current = gtk_notebook_get_current_page (notebook);
+
+	if (current != -1)
+		current_page = gtk_notebook_get_nth_page (notebook, current);
+	gnm_notebook_adjust_tab_appearance (nb, current_page, page);
+}
+
+static void
 gnm_notebook_class_init (GtkWidgetClass *klass)
 {
 	gnm_notebook_parent_class = g_type_class_peek (GTK_TYPE_NOTEBOOK);
@@ -97,6 +132,11 @@ gnm_notebook_init (GnmNotebook *notebook)
 	gtk_style_context_add_provider (context,
 					GTK_STYLE_PROVIDER (css),
 					GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+	g_signal_connect (G_OBJECT (notebook), "switch-page", 
+			  (GCallback) gnm_notebook_switch_page_cb, 
+			  notebook);
+
 	g_object_unref (css);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]