gimp r24793 - in trunk: . plug-ins/print
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r24793 - in trunk: . plug-ins/print
- Date: Mon, 4 Feb 2008 21:49:08 +0000 (GMT)
Author: neo
Date: Mon Feb 4 21:49:08 2008
New Revision: 24793
URL: http://svn.gnome.org/viewvc/gimp?rev=24793&view=rev
Log:
2008-02-04 Sven Neumann <sven gimp org>
* plug-ins/print/print-page-layout.c: only connect to page
layout
changes for the lifetime of the dialog.
* plug-ins/print/print-page-setup.[ch]
* plug-ins/print/print.c: use a temporary procedure to notify
the
Print procedure about changes to the page setup.
Modified:
trunk/ChangeLog
trunk/plug-ins/print/print-page-layout.c
trunk/plug-ins/print/print-page-setup.c
trunk/plug-ins/print/print-page-setup.h
trunk/plug-ins/print/print.c
Modified: trunk/plug-ins/print/print-page-layout.c
==============================================================================
--- trunk/plug-ins/print/print-page-layout.c (original)
+++ trunk/plug-ins/print/print-page-layout.c Mon Feb 4 21:49:08 2008
@@ -198,9 +198,9 @@
print_size_info_set_page_setup (&info);
- g_signal_connect (data->operation, "notify::default-page-setup",
- G_CALLBACK (print_page_setup_notify),
- &info);
+ g_signal_connect_object (data->operation, "notify::default-page-setup",
+ G_CALLBACK (print_page_setup_notify),
+ layout, 0);
return layout;
}
Modified: trunk/plug-ins/print/print-page-setup.c
==============================================================================
--- trunk/plug-ins/print/print-page-setup.c (original)
+++ trunk/plug-ins/print/print-page-setup.c Mon Feb 4 21:49:08 2008
@@ -24,28 +24,26 @@
#include "print-page-setup.h"
-static void print_page_setup_save (GtkPrintOperation *operation);
-
-
void
print_page_setup_dialog (GtkPrintOperation *operation)
{
- GtkPrintSettings *settings = gtk_print_settings_new ();
+ GtkPrintSettings *settings;
GtkPageSetup *setup;
- print_page_setup_load (operation);
+ g_return_if_fail (GTK_IS_PRINT_OPERATION (operation));
setup = gtk_print_operation_get_default_page_setup (operation);
+ settings = gtk_print_settings_new ();
setup = gtk_print_run_page_setup_dialog (NULL, setup, settings);
+ g_object_unref (settings);
gtk_print_operation_set_default_page_setup (operation, setup);
-
- print_page_setup_save (operation);
}
gboolean
-print_page_setup_load (GtkPrintOperation *operation)
+print_page_setup_load (GtkPrintOperation *operation,
+ gint32 image_ID)
{
GtkPageSetup *setup;
gchar *filename;
@@ -67,7 +65,7 @@
return FALSE;
}
-static void
+void
print_page_setup_save (GtkPrintOperation *operation)
{
GtkPageSetup *setup;
Modified: trunk/plug-ins/print/print-page-setup.h
==============================================================================
--- trunk/plug-ins/print/print-page-setup.h (original)
+++ trunk/plug-ins/print/print-page-setup.h Mon Feb 4 21:49:08 2008
@@ -18,5 +18,8 @@
void print_page_setup_dialog (GtkPrintOperation *operation);
-gboolean print_page_setup_load (GtkPrintOperation *operation);
+gboolean print_page_setup_load (GtkPrintOperation *operation,
+ gint32 image_ID);
+void print_page_setup_save (GtkPrintOperation *operation);
+
Modified: trunk/plug-ins/print/print.c
==============================================================================
--- trunk/plug-ins/print/print.c (original)
+++ trunk/plug-ins/print/print.c Mon Feb 4 21:49:08 2008
@@ -68,6 +68,14 @@
static GtkWidget * create_custom_widget (GtkPrintOperation *operation,
PrintData *data);
+static gchar * print_temp_proc_name (gint32 image_ID);
+static gchar * print_temp_proc_install (gint32 image_ID);
+
+
+/* Keep a reference to the current GtkPrintOperation
+ * for access by the temporary procedure.
+ */
+static GtkPrintOperation *print_operation = NULL;
const GimpPlugInInfo PLUG_IN_INFO =
@@ -178,6 +186,7 @@
GError *error = NULL;
gint32 orig_image_ID = image_ID;
gint32 drawable_ID = gimp_image_get_active_drawable (image_ID);
+ gchar *temp_proc;
PrintData data;
GimpExportReturn export;
@@ -193,7 +202,7 @@
print_operation_set_name (operation, orig_image_ID);
- print_page_setup_load (operation);
+ print_page_setup_load (operation, orig_image_ID);
/* fill in the PrintData struct */
data.num_pages = 1;
@@ -224,6 +233,10 @@
G_CALLBACK (end_print),
&image_ID);
+ print_operation = operation;
+ temp_proc = print_temp_proc_install (orig_image_ID);
+ gimp_extension_enable ();
+
if (interactive)
{
gimp_ui_init (PLUG_IN_BINARY, FALSE);
@@ -249,6 +262,10 @@
NULL, &error);
}
+ gimp_uninstall_temp_proc (temp_proc);
+ g_free (temp_proc);
+ print_operation = NULL;
+
g_object_unref (operation);
if (gimp_image_is_valid (image_ID))
@@ -267,14 +284,34 @@
page_setup (gint32 image_ID)
{
GtkPrintOperation *operation;
+ gchar *name;
gimp_ui_init (PLUG_IN_BINARY, FALSE);
operation = gtk_print_operation_new ();
+
+ print_page_setup_load (operation, image_ID);
print_page_setup_dialog (operation);
+ print_page_setup_save (operation);
+
g_object_unref (operation);
- /* FIXME: notify the print procedure about the changed page setup */
+ /* now notify a running print procedure about this change */
+ name = print_temp_proc_name (image_ID);
+
+ if (name)
+ {
+ GimpParam *return_vals;
+ gint n_return_vals;
+
+ return_vals = gimp_run_procedure (name,
+ &n_return_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+ gimp_destroy_params (return_vals, n_return_vals);
+
+ g_free (name);
+ }
return GIMP_PDB_SUCCESS;
}
@@ -362,3 +399,54 @@
{
return print_page_layout_gui (data);
}
+
+static void
+print_temp_proc_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals)
+{
+ static GimpParam values[1];
+
+ values[0].type = GIMP_PDB_STATUS;
+ values[0].data.d_status = GIMP_PDB_SUCCESS;
+
+ *nreturn_vals = 1;
+ *return_vals = values;
+
+ if (print_operation && nparams == 1)
+ print_page_setup_load (print_operation, param[0].data.d_int32);
+}
+
+static gchar *
+print_temp_proc_name (gint32 image_ID)
+{
+ return g_strdup_printf (PRINT_PROC_NAME "-temp-%d", image_ID);
+}
+
+static gchar *
+print_temp_proc_install (gint32 image_ID)
+{
+ static const GimpParamDef args[] =
+ {
+ { GIMP_PDB_IMAGE, "image", "Image to print" }
+ };
+
+ gchar *name = print_temp_proc_name (image_ID);
+
+ gimp_install_temp_proc (name,
+ "DON'T USE THIS ONE",
+ "Temporary procedure to notify the Print plug-in "
+ "about changes to the Page Setup.",
+ "Sven Neumann",
+ "Sven Neumann",
+ "2008",
+ NULL,
+ "",
+ GIMP_TEMPORARY,
+ G_N_ELEMENTS (args), 0, args, NULL,
+ print_temp_proc_run);
+
+ return name;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]