* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
}
else if (type == CAIRO_SURFACE_TYPE_PDF)
{
+ if (!op->priv->manual_orientation)
+ {
+ w = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS);
+ h = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS);
+ }
cairo_pdf_surface_set_size (op_unix->surface, w, h);
}
}
GtkWindow *parent,
const gchar *filename)
{
- gint argc;
- gchar **argv;
+ GAppInfo *appinfo;
+ GdkAppLaunchContext *context;
gchar *cmd;
gchar *preview_cmd;
GtkSettings *settings;
quoted_filename = g_shell_quote (filename);
quoted_settings_filename = g_shell_quote (settings_filename);
cmd = shell_command_substitute_file (preview_cmd, quoted_filename, quoted_settings_filename, &filename_used, &settings_used);
- g_shell_parse_argv (cmd, &argc, &argv, &error);
+
+ appinfo = g_app_info_create_from_commandline (cmd,
+ "Print Preview",
+ G_APP_INFO_CREATE_NONE,
+ &error);
g_free (preview_cmd);
g_free (quoted_filename);
if (error != NULL)
goto out;
- gdk_spawn_on_screen (screen, NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error);
+ context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
+ gdk_app_launch_context_set_screen (context, screen);
+ g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (context), &error);
- g_strfreev (argv);
+ g_object_unref (context);
+ g_object_unref (appinfo);
if (error != NULL)
{
else
g_error_free (error);
- filename_used = FALSE;
+ filename_used = FALSE;
settings_used = FALSE;
- }
+ }
if (!filename_used)
g_unlink (filename);
if (fd > 0)
close (fd);
-
+
if (key_file)
g_key_file_free (key_file);
g_free (data);
g_object_ref (op);
if (!op_unix->data_sent)
{
- GDK_THREADS_LEAVE ();
+ gdk_threads_leave ();
g_main_loop_run (op_unix->loop);
- GDK_THREADS_ENTER ();
+ gdk_threads_enter ();
}
g_main_loop_unref (op_unix->loop);
op_unix->loop = NULL;
settings = gtk_print_unix_dialog_get_settings (GTK_PRINT_UNIX_DIALOG (pd));
page_setup = gtk_print_unix_dialog_get_page_setup (GTK_PRINT_UNIX_DIALOG (pd));
page_setup_set = gtk_print_unix_dialog_get_page_setup_set (GTK_PRINT_UNIX_DIALOG (pd));
-
+
+ /* Set new print settings now so that custom-widget options
+ * can be added to the settings in the callback
+ */
+ gtk_print_operation_set_print_settings (rdata->op, settings);
g_signal_emit_by_name (rdata->op, "custom-widget-apply", rdata->op->priv->custom_widget);
}
GtkPageSetup *page_setup,
cairo_surface_t *surface)
{
- GtkPaperSize *paper_size;
gdouble w, h;
- paper_size = gtk_page_setup_get_paper_size (page_setup);
- w = gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS);
- h = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS);
+ w = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS);
+ h = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS);
cairo_pdf_surface_set_size (surface, w, h);
}
find_printer (printer_name,
(GFunc) found_printer, &rdata);
- GDK_THREADS_LEAVE ();
+ gdk_threads_leave ();
g_main_loop_run (rdata.loop);
- GDK_THREADS_ENTER ();
+ gdk_threads_enter ();
g_main_loop_unref (rdata.loop);
rdata.loop = NULL;
* setup dialog. See gtk_print_run_page_setup_dialog_async() if this is
* a problem.
*
- * Return value: a new #GtkPageSetup
+ * Return value: (transfer full): a new #GtkPageSetup
*
* Since: 2.10
*/
* @parent: (allow-none): transient parent, or %NULL
* @page_setup: (allow-none): an existing #GtkPageSetup, or %NULL
* @settings: a #GtkPrintSettings
- * @done_cb: a function to call when the user saves the modified page setup
+ * @done_cb: (scope async): a function to call when the user saves
+ * the modified page setup
* @data: user data to pass to @done_cb
*
* Runs a page setup dialog, letting the user modify the values from @page_setup.
printer_finder_free (finder);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void