anjuta r3472 - in trunk: . libanjuta libanjuta/interfaces plugins/file-manager plugins/sourceview



Author: jhs
Date: Tue Jan 15 20:13:48 2008
New Revision: 3472
URL: http://svn.gnome.org/viewvc/anjuta?rev=3472&view=rev

Log:
2008-01-15  Johannes Schmid <jhs gnome org>

	* libanjuta/anjuta-profile.c: (anjuta_profile_class_init),
	(anjuta_profile_add_plugins_from_xml):
	* plugins/file-manager/file-manager.glade:
	Some string fixes
	
	* libanjuta/interfaces/libanjuta.idl:
	Fixed docs
		
	* plugins/sourceview/Makefile.am:
	* plugins/sourceview/anjuta-editor-sourceview.glade:
	* plugins/sourceview/sourceview-print.c: (paginate), (draw_page),
	(end_print), (print_setup), (sourceview_print),
	(sourceview_print_preview):
	* plugins/sourceview/sourceview.c: (iprint_print),
	(iprint_print_preview):
	
	Added printing support to GtkSourceView editor

Modified:
   trunk/ChangeLog
   trunk/libanjuta/anjuta-profile.c
   trunk/libanjuta/interfaces/libanjuta.idl
   trunk/plugins/file-manager/file-manager.glade
   trunk/plugins/sourceview/Makefile.am
   trunk/plugins/sourceview/anjuta-editor-sourceview.glade
   trunk/plugins/sourceview/sourceview-print.c
   trunk/plugins/sourceview/sourceview.c

Modified: trunk/libanjuta/anjuta-profile.c
==============================================================================
--- trunk/libanjuta/anjuta-profile.c	(original)
+++ trunk/libanjuta/anjuta-profile.c	Tue Jan 15 20:13:48 2008
@@ -238,7 +238,7 @@
 	                                 PROP_SYNC_URI,
 	                                 g_param_spec_string ("sync-uri",
 											  _("Synchronization URI"),
-											  _("URI to sync the proflie xml"),
+											  _("URI to sync the profile xml"),
 											  NULL,
 											  G_PARAM_READABLE |
 											  G_PARAM_WRITABLE));
@@ -578,7 +578,7 @@
 	{
 		g_set_error (error, ANJUTA_PROFILE_ERROR,
 					 ANJUTA_PROFILE_ERROR_URI_READ_FAILED,
-					 _("Failed to read '%s': XML parse error."
+					 _("Failed to read '%s': XML parse error. "
 					   "Invalid or corrupted anjuta plugins profile."),
 					 profile_xml_uri);
 		xmlFreeDoc(xml_doc);
@@ -729,7 +729,7 @@
 		
 		g_set_error (error, ANJUTA_PROFILE_ERROR,
 					 ANJUTA_PROFILE_ERROR_URI_READ_FAILED,
-					 _("Failed to read '%s': XML parse error."
+					 _("Failed to read '%s': XML parse error. "
 					   "Invalid or corrupted anjuta plugins profile."),
 					 profile_xml_uri);
 		xmlFreeDoc(xml_doc);
@@ -751,6 +751,7 @@
 		node_url = not_found_urls;
 		while (node_name)
 		{
+			/* <Pluginname>: Install it from <some location on the web> */
 			g_string_append_printf (mesg, _("%s: Install it from '%s'\n"),
 											(char *)node_name->data,
 											(char*)node_url->data);

Modified: trunk/libanjuta/interfaces/libanjuta.idl
==============================================================================
--- trunk/libanjuta/interfaces/libanjuta.idl	(original)
+++ trunk/libanjuta/interfaces/libanjuta.idl	Tue Jan 15 20:13:48 2008
@@ -1294,7 +1294,7 @@
 		gchar* get ();
 		
 		/**
-		 * ianjuta_editor_selection_set_iter:
+		 * ianjuta_editor_selection_set:
 		 * @obj: Self
 		 * @start: Begin of selection
 		 * @end: End of selection

Modified: trunk/plugins/file-manager/file-manager.glade
==============================================================================
--- trunk/plugins/file-manager/file-manager.glade	(original)
+++ trunk/plugins/file-manager/file-manager.glade	Tue Jan 15 20:13:48 2008
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.0 on Sun Nov 25 18:04:55 2007 -->
+<!--Generated with glade3 3.4.0 on Sat Jan 12 19:46:18 2008 -->
 <glade-interface>
   <widget class="GtkWindow" id="filemanager_pref_window">
     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -27,7 +27,7 @@
                       <widget class="GtkLabel" id="label2">
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="label" translatable="yes">Root directory if no project is open: </property>
+                        <property name="label" translatable="yes">Root directory if no project is open:</property>
                       </widget>
                       <packing>
                         <property name="expand">False</property>
@@ -39,9 +39,9 @@
                       <widget class="GtkFileChooserButton" id="preferences_file:text:/:0:filemanager.root">
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="use_preview_label">False</property>
                         <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
                         <property name="preview_widget_active">False</property>
-                        <property name="use_preview_label">False</property>
                         <property name="title" translatable="yes">Choose Directory to show if no project is open</property>
                       </widget>
                       <packing>

Modified: trunk/plugins/sourceview/Makefile.am
==============================================================================
--- trunk/plugins/sourceview/Makefile.am	(original)
+++ trunk/plugins/sourceview/Makefile.am	Tue Jan 15 20:13:48 2008
@@ -77,6 +77,8 @@
 	sourceview-private.h \
 	sourceview-cell.c \
 	sourceview-cell.h \
+	sourceview-print.h \
+	sourceview-print.c \
 	assist-tip.h \
 	assist-tip.c
 

Modified: trunk/plugins/sourceview/anjuta-editor-sourceview.glade
==============================================================================
--- trunk/plugins/sourceview/anjuta-editor-sourceview.glade	(original)
+++ trunk/plugins/sourceview/anjuta-editor-sourceview.glade	Tue Jan 15 20:13:48 2008
@@ -711,82 +711,55 @@
               <widget class="GtkTable" id="table17">
                 <property name="visible">True</property>
                 <property name="border_width">10</property>
-                <property name="n_rows">4</property>
-                <property name="n_columns">3</property>
+                <property name="n_rows">6</property>
+                <property name="n_columns">1</property>
                 <property name="column_spacing">5</property>
                 <property name="row_spacing">5</property>
                 <child>
-                  <widget class="GtkLabel" id="label131">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="yalign">0</property>
-                    <property name="label" translatable="yes">Mode:</property>
-                  </widget>
-                  <packing>
-                    <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkRadioButton" id="preferences_toggle:bool:1:0:print.color">
+                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.linewrap">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="label" translatable="yes">Colour</property>
+                    <property name="label" translatable="yes">Wrap long lines to fit on paper</property>
                     <property name="use_underline">True</property>
                     <property name="response_id">0</property>
                     <property name="draw_indicator">True</property>
                   </widget>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="x_options"></property>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                    <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkRadioButton" id="radiobutton4">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="label" translatable="yes">Monochrome</property>
-                    <property name="use_underline">True</property>
-                    <property name="response_id">0</property>
-                    <property name="draw_indicator">True</property>
-                  </widget>
-                  <packing>
-                    <property name="left_attach">2</property>
-                    <property name="right_attach">3</property>
-                    <property name="x_options"></property>
-                    <property name="y_options"></property>
-                  </packing>
+                  <placeholder/>
                 </child>
                 <child>
-                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.header">
+                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.highlight">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="label" translatable="yes">Add page header</property>
+                    <property name="label" translatable="yes">Highlight syntax</property>
                     <property name="use_underline">True</property>
                     <property name="response_id">0</property>
                     <property name="draw_indicator">True</property>
                   </widget>
                   <packing>
-                    <property name="right_attach">3</property>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.linewrap">
+                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.linenumbers">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="label" translatable="yes">Enable line wrap</property>
+                    <property name="label" translatable="yes">Print Linenumbers</property>
                     <property name="use_underline">True</property>
                     <property name="response_id">0</property>
                     <property name="draw_indicator">True</property>
                   </widget>
                   <packing>
-                    <property name="right_attach">3</property>
                     <property name="top_attach">2</property>
                     <property name="bottom_attach">3</property>
                     <property name="x_options">GTK_FILL</property>
@@ -794,49 +767,32 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label132">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="yalign">0</property>
-                    <property name="label" translatable="yes">Add line number every:</property>
-                  </widget>
-                  <packing>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
-                    <property name="x_options"></property>
-                    <property name="y_options"></property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkSpinButton" id="preferences_spin:int:1:0:print.linenumber.count">
+                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.footer">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="adjustment">1 0 1000 1 10 10</property>
-                    <property name="climb_rate">1</property>
-                    <property name="numeric">True</property>
+                    <property name="label" translatable="yes">Print page footer</property>
+                    <property name="use_underline">True</property>
+                    <property name="response_id">0</property>
+                    <property name="draw_indicator">True</property>
                   </widget>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
-                    <property name="x_options"></property>
+                    <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label133">
+                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.header">
                     <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="yalign">0</property>
-                    <property name="label" translatable="yes">Lines</property>
+                    <property name="can_focus">True</property>
+                    <property name="label" translatable="yes">Print page header</property>
+                    <property name="use_underline">True</property>
+                    <property name="response_id">0</property>
+                    <property name="draw_indicator">True</property>
                   </widget>
                   <packing>
-                    <property name="left_attach">2</property>
-                    <property name="right_attach">3</property>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
-                    <property name="x_options"></property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>

Modified: trunk/plugins/sourceview/sourceview-print.c
==============================================================================
--- trunk/plugins/sourceview/sourceview-print.c	(original)
+++ trunk/plugins/sourceview/sourceview-print.c	Tue Jan 15 20:13:48 2008
@@ -1,152 +1,172 @@
 /*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Library General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
- 
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Library General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
 #include "sourceview-print.h"
 #include "sourceview-private.h"
+#include <gtksourceview/gtksourceprintcompositor.h>
+#include <libanjuta/interfaces/ianjuta-document.h>
 
-#include <libanjuta/anjuta-debug.h>
+#define PRINT_LINEWRAP "print.linewrap"
+#define PRINT_HEADER "print.header"
+#define PRINT_FOOTER "print.footer"
+#define PRINT_HIGHLIGHT "print.highlight"
+#define PRINT_LINENUMBERS "print.linenumbers"
 
-#include <libgnomeprintui/gnome-print-job-preview.h>
-#include <libgnomeprintui/gnome-print-dialog.h>
+typedef struct _SourceviewPrinting SourceviewPrinting;
 
-#include <gtksourceview/gtksourceview.h>
-#include <gtksourceview/gtksourcelanguage.h>
-#include <gtksourceview/gtksourcelanguagesmanager.h>
-#include <gtksourceview/gtksourceprintjob.h>
+struct _SourceviewPrinting
+{
+	Sourceview* sv;
+	GtkSourcePrintCompositor *compositor;
+	AnjutaStatus* status;
+};
 
-#include <libanjuta/interfaces/ianjuta-editor.h>
-#include <libanjuta/interfaces/ianjuta-document.h>
 
-static GtkSourcePrintJob*
-create_print_job(Sourceview* sv)
+static gboolean
+paginate (GtkPrintOperation        *operation, 
+					GtkPrintContext          *context,
+					SourceviewPrinting* printing)
 {
-	GtkSourcePrintJob *job;
-	GtkSourceView *view;
-	GtkSourceBuffer *buffer;
-	const gchar *filename;
-
-	g_return_val_if_fail (sv != NULL, NULL);
-	
-	view = GTK_SOURCE_VIEW(sv->priv->view);
-	buffer = GTK_SOURCE_BUFFER (sv->priv->document);
-	
-	job = gtk_source_print_job_new (NULL);
-	gtk_source_print_job_setup_from_view (job, view);
-	gtk_source_print_job_set_wrap_mode (job, GTK_WRAP_CHAR);
-	gtk_source_print_job_set_highlight (job, TRUE);
-	gtk_source_print_job_set_print_numbers (job, 1);
+	if (gtk_source_print_compositor_paginate (printing->compositor, context))
+	{
+		gint n_pages;	
+		anjuta_status_progress_tick (printing->status, NULL,
+																 _("Preparing pages for printing"));
+		n_pages = gtk_source_print_compositor_get_n_pages (printing->compositor);
+		gtk_print_operation_set_n_pages (operation, n_pages);
 
-	gtk_source_print_job_set_header_format (job,
-						"Printed on %A",
-						NULL,
-						"%F",
-						TRUE);
+		return TRUE;
+	}
+     
+	return FALSE;
+}
 
-	filename = ianjuta_document_get_filename(IANJUTA_DOCUMENT(sv), NULL);
-	
-	gtk_source_print_job_set_footer_format (job,
-						"%T",
-						filename,
-						"Page %N/%Q",
-						TRUE);
 
-	gtk_source_print_job_set_print_header (job, TRUE);
-	gtk_source_print_job_set_print_footer (job, TRUE);
-	
-	return job;
+static void
+draw_page (GtkPrintOperation        *operation,
+					 GtkPrintContext          *context,
+					 gint                      page_nr,
+					 SourceviewPrinting* printing)
+{
+	gtk_source_print_compositor_draw_page (printing->compositor, context, page_nr);
 }
 
-static GtkWidget *
-sourceview_print_dialog_new (GtkSourcePrintJob *job, GtkSourceBuffer* buffer)
+static void
+end_print (GtkPrintOperation        *operation, 
+					 GtkPrintContext          *context,
+					 SourceviewPrinting* printing)
 {
-	GtkWidget *dialog;
-	gint selection_flag;
-	gint lines;
-	GnomePrintConfig *config;
+	g_object_unref (printing->compositor);
+	g_slice_free (SourceviewPrinting, printing);
+}
 
-	if (!gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (buffer), NULL, NULL))
-		selection_flag = GNOME_PRINT_RANGE_SELECTION_UNSENSITIVE;
+static GtkPrintOperation*
+print_setup (Sourceview* sv)
+{
+	GtkSourceView *view = GTK_SOURCE_VIEW (sv->priv->view);
+	GtkSourcePrintCompositor *compositor;
+	GtkPrintOperation *operation;
+	SourceviewPrinting* printing = g_slice_new0(SourceviewPrinting);
+	const gchar *filename;
+	gchar *basename;
+	
+	filename = ianjuta_document_get_filename (IANJUTA_DOCUMENT (sv), NULL);
+	basename = g_filename_display_basename (filename);
+	
+	compositor = gtk_source_print_compositor_new_from_view (view);
+	
+	if (anjuta_preferences_get_int (sv->priv->prefs, PRINT_LINEWRAP))
+	{
+		gtk_source_print_compositor_set_wrap_mode (compositor,
+																							 GTK_WRAP_WORD_CHAR);
+	}
 	else
-		selection_flag = GNOME_PRINT_RANGE_SELECTION;
-
-	config = gtk_source_print_job_get_config (GTK_SOURCE_PRINT_JOB (job));
-
-	dialog = g_object_new (GNOME_TYPE_PRINT_DIALOG, "print_config", config, NULL);
-
-	gnome_print_dialog_construct (GNOME_PRINT_DIALOG (dialog), 
-				      (const unsigned char *)_("Print"),
-			              GNOME_PRINT_DIALOG_RANGE | GNOME_PRINT_DIALOG_COPIES);
-
-	lines = gtk_text_buffer_get_line_count (GTK_TEXT_BUFFER (buffer));
-
-	gnome_print_dialog_construct_range_page (GNOME_PRINT_DIALOG (dialog),
-						 GNOME_PRINT_RANGE_ALL |
-						 GNOME_PRINT_RANGE_RANGE |
-						 selection_flag,
-						 1, lines, (const unsigned char *)"A",
-						 (const unsigned char *)_("Lines"));
-
-	return dialog;
+		gtk_source_print_compositor_set_wrap_mode (compositor,
+																						 GTK_WRAP_NONE);
+	
+	gtk_source_print_compositor_set_print_line_numbers (compositor,
+																											anjuta_preferences_get_int (sv->priv->prefs,
+																																									PRINT_LINENUMBERS));
+	
+	gtk_source_print_compositor_set_header_format (compositor,
+																								 TRUE,
+																								 "%x",
+																								 basename,
+																								 "Page %N/%Q");
+	
+	gtk_source_print_compositor_set_footer_format (compositor,
+																								 TRUE,
+																								 "%T",
+																								 basename,
+																								 "Page %N/%Q");
+	
+	gtk_source_print_compositor_set_print_header (compositor,
+																								anjuta_preferences_get_int (sv->priv->prefs,
+																																						PRINT_HEADER));
+	gtk_source_print_compositor_set_print_footer (compositor,
+																								anjuta_preferences_get_int (sv->priv->prefs,
+																																						PRINT_HEADER));
+	
+	
+	gtk_source_print_compositor_set_highlight_syntax (compositor,
+																										anjuta_preferences_get_int (sv->priv->prefs,
+																																								PRINT_HIGHLIGHT)),
+	
+	operation = gtk_print_operation_new ();
+	
+	gtk_print_operation_set_job_name (operation, basename);
+	
+	gtk_print_operation_set_show_progress (operation, TRUE);
+	
+	printing->compositor = compositor;
+	printing->sv = sv;
+	printing->status = anjuta_shell_get_status (sv->priv->plugin->shell, NULL);
+	
+	g_signal_connect (G_OBJECT (operation), "paginate", 
+			  G_CALLBACK (paginate), printing);
+	g_signal_connect (G_OBJECT (operation), "draw-page", 
+										G_CALLBACK (draw_page), printing);
+	g_signal_connect (G_OBJECT (operation), "end-print", 
+										G_CALLBACK (end_print), printing);
+	
+	anjuta_status_progress_reset (printing->status);
+	anjuta_status_progress_add_ticks (printing->status, 100);
+	g_free (basename);
+	
+	return operation;
 }
 
 void 
 sourceview_print(Sourceview* sv)
 {
-	GtkSourcePrintJob* job = create_print_job(sv);
-	GtkWidget* print= sourceview_print_dialog_new(job, 
-		GTK_SOURCE_BUFFER(sv->priv->document));
-	GnomePrintButtons result = gtk_dialog_run(GTK_DIALOG(print));
-	
-	switch (result)
-	{
-		case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
-			sourceview_print_preview(sv);
-			break;
-		case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
-		{
-			GnomePrintJob* gjob = gtk_source_print_job_print (job);
-			gnome_print_job_print(gjob);
-			g_object_unref(gjob);
-			break;
-		}
-		case GNOME_PRINT_DIALOG_RESPONSE_CANCEL:
-			break;
-		default:
-			DEBUG_PRINT("Unknown print response");
-	}
-	gtk_widget_destroy(print);
-	g_object_unref(job);
+	GtkPrintOperation* operation = print_setup (sv);
+	gtk_print_operation_run (operation, 
+													 GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
+													 NULL, NULL);
+	g_object_unref (operation);	
 }
 
+
 void
 sourceview_print_preview(Sourceview* sv)
 {
-	GtkSourcePrintJob* job;
-	GnomePrintJob* gjob;
-	GtkWidget *preview;
-	
-	job = create_print_job(sv);
-
-	gjob = gtk_source_print_job_print (job);
-	preview = gnome_print_job_preview_new (gjob,
-		(const guchar *)_("Print preview"));
- 	
- 	gtk_widget_show(preview);
-	
-	g_object_unref(job);
-	g_object_unref(gjob);
+	GtkPrintOperation* operation = print_setup (sv);
+	gtk_print_operation_run (operation, 
+													 GTK_PRINT_OPERATION_ACTION_PREVIEW,
+													 NULL, NULL);
+	g_object_unref (operation);	
 }
 

Modified: trunk/plugins/sourceview/sourceview.c
==============================================================================
--- trunk/plugins/sourceview/sourceview.c	(original)
+++ trunk/plugins/sourceview/sourceview.c	Tue Jan 15 20:13:48 2008
@@ -60,7 +60,7 @@
 #include "sourceview.h"
 #include "sourceview-private.h"
 #include "sourceview-prefs.h"
-/* #include "sourceview-print.h" */
+#include "sourceview-print.h"
 #include "sourceview-cell.h"
 #include "plugin.h"
 
@@ -1759,19 +1759,18 @@
 	iface->clear_all = ibookmark_clear_all;
 }
 
-#if 0 /* FIXME: add printing support */
 static void
 iprint_print(IAnjutaPrint* print, GError** e)
 {
 	Sourceview* sv = ANJUTA_SOURCEVIEW(print);
-	//sourceview_print(sv);
+	sourceview_print(sv);
 }
 
 static void
 iprint_print_preview(IAnjutaPrint* print, GError** e)
 {
 	Sourceview* sv = ANJUTA_SOURCEVIEW(print);
-	//sourceview_print_preview(sv);
+	sourceview_print_preview(sv);
 }
 
 static void
@@ -1780,7 +1779,7 @@
 	iface->print = iprint_print;
 	iface->print_preview = iprint_print_preview;
 }
-#endif
+
 
 static const GList*
 ilanguage_get_supported_languages (IAnjutaEditorLanguage *ilanguage,
@@ -2198,7 +2197,7 @@
 ANJUTA_TYPE_ADD_INTERFACE(iassist, IANJUTA_TYPE_EDITOR_ASSIST);
 ANJUTA_TYPE_ADD_INTERFACE(iconvert, IANJUTA_TYPE_EDITOR_CONVERT);
 ANJUTA_TYPE_ADD_INTERFACE(ibookmark, IANJUTA_TYPE_BOOKMARK);
-//ANJUTA_TYPE_ADD_INTERFACE(iprint, IANJUTA_TYPE_PRINT);
+ANJUTA_TYPE_ADD_INTERFACE(iprint, IANJUTA_TYPE_PRINT);
 ANJUTA_TYPE_ADD_INTERFACE(ilanguage, IANJUTA_TYPE_EDITOR_LANGUAGE);
 ANJUTA_TYPE_ADD_INTERFACE(isearch, IANJUTA_TYPE_EDITOR_SEARCH);
 #if HAVE_TOOLTIP_API



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