gedit r6089 - branches/printing/gedit



Author: pborelli
Date: Tue Jan 15 09:37:21 2008
New Revision: 6089
URL: http://svn.gnome.org/viewvc/gedit?rev=6089&view=rev

Log:
run the page setup dialog async


Modified:
   branches/printing/gedit/gedit-commands-file-print.c

Modified: branches/printing/gedit/gedit-commands-file-print.c
==============================================================================
--- branches/printing/gedit/gedit-commands-file-print.c	(original)
+++ branches/printing/gedit/gedit-commands-file-print.c	Tue Jan 15 09:37:21 2008
@@ -41,81 +41,41 @@
 #include "gedit-window.h"
 #include "gedit-debug.h"
 
+// FIXME: should these be per window? per tab? global?
 static GtkPageSetup *page_setup = NULL;
 static GtkPrintSettings *settings = NULL;
 
 static void
-do_page_setup (GtkWindow *window)
+page_setup_done_cb (GtkPageSetup *setup,
+		    GeditTab     *tab)
 {
-	GtkPageSetup *new_page_setup;
-
-	new_page_setup = gtk_print_run_page_setup_dialog (window,
-							  page_setup,
-							  settings);
-
-	if (page_setup)
-		g_object_unref (page_setup);
-  
-	page_setup = new_page_setup;
+	if (setup != NULL)
+	{
+		g_print ("Page setup done\n");
+	}
+	else
+	{
+		g_print ("Page setup dismissed\n");
+	}
 }
 
-//static void
-//status_changed_cb (GtkPrintOperation *op,
-//		   gpointer user_data)
-//{
-//  if (gtk_print_operation_is_finished (op))
-//    {
-//      active_prints = g_list_remove (active_prints, op);
-//      g_object_unref (op);
-//    }
-
-//  update_statusbar ();
-//}
-
-//static GtkWidget *
-//create_custom_widget (GtkPrintOperation *operation,
-//		      gpointer          *data)
-//{
-//  GtkWidget *vbox, *hbox, *font, *label;
-
-//  gtk_print_operation_set_custom_tab_label (operation, "Other");
-//  vbox = gtk_vbox_new (FALSE, 0);
-//  gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
-
-//  hbox = gtk_hbox_new (FALSE, 8);
-//  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-//  gtk_widget_show (hbox);
-
-//  label = gtk_label_new ("Font:");
-//  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-//  gtk_widget_show (label);
-//  
-//  font = gtk_font_button_new_with_font  (data->font);
-//  gtk_box_pack_start (GTK_BOX (hbox), font, FALSE, FALSE, 0);
-//  gtk_widget_show (font);
-//  data->font_button = font;
-
-//  return vbox;
-//}
-
-//static void
-//custom_widget_apply (GtkPrintOperation *operation,
-//		     GtkWidget *widget,
-//		     PrintData *data)
-//{
-//  const char *selected_font;
-//  selected_font = gtk_font_button_get_font_name  (GTK_FONT_BUTTON (data->font_button));
-//  g_free (data->font);
-//  data->font = g_strdup (selected_font);
-//}
-
 void
 _gedit_cmd_file_page_setup (GtkAction   *action,
 			    GeditWindow *window)
 {
+	GeditTab *tab;
+
 	gedit_debug (DEBUG_COMMANDS);
 
-	do_page_setup (GTK_WINDOW (window));
+	tab = gedit_window_get_active_tab (window);
+	if (tab == NULL)
+		return;
+
+	gtk_print_run_page_setup_dialog_async (GTK_WINDOW (window),
+		 			       page_setup,
+		 			       settings,
+					       (GtkPageSetupDoneFunc) page_setup_done_cb,
+					       tab);
 }
 
 void



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