SF.net SVN: geany: [2167] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sat Jan 12 11:03:52 UTC 2008
Revision: 2167
http://geany.svn.sourceforge.net/geany/?rev=2167&view=rev
Author: eht16
Date: 2008-01-12 03:03:52 -0800 (Sat, 12 Jan 2008)
Log Message:
-----------
Avoid double status message if print dialog was cancelled.
Print status messages in status-changed handler.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/printing.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-01-12 10:14:58 UTC (rev 2166)
+++ trunk/ChangeLog 2008-01-12 11:03:52 UTC (rev 2167)
@@ -2,6 +2,9 @@
* src/keyfile.c: Try to fix changing message window height when using
full screen (closes #1869415).
+ * src/printing.c:
+ Avoid double status message if print dialog was cancelled.
+ Print status messages in status-changed handler.
2008-01-11 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/printing.c
===================================================================
--- trunk/src/printing.c 2008-01-12 10:14:58 UTC (rev 2166)
+++ trunk/src/printing.c 2008-01-12 11:03:52 UTC (rev 2167)
@@ -83,7 +83,6 @@
gint styles[STYLE_MAX + 1][MAX_TYPES];
gdouble line_height;
gboolean long_line; // whether we have a wrapped line on page end to take care of on next page
- gboolean cancelled;
// set in begin_print() to hold the time when printing was started to ensure all printed
// pages have the same date and time (in case of slow machines and many pages where rendering
// takes more than a second)
@@ -423,7 +422,6 @@
dinfo->cur_line = 0;
dinfo->cur_pos = 0;
dinfo->long_line = FALSE;
- dinfo->cancelled = FALSE;
dinfo->print_time = time(NULL);
dinfo->max_line_number_margin = get_line_numbers_arity(dinfo->lines) + 1;
// increase font width by 1 (looks better)
@@ -459,11 +457,6 @@
if (dinfo->n_pages >= 0)
gtk_print_operation_set_n_pages(operation, dinfo->n_pages);
- // if we have many pages we show GTK's progress dialog which also allows cancelling of the
- // print operation
- if (dinfo->n_pages > 3)
- gtk_print_operation_set_show_progress(operation, TRUE);
-
pango_font_description_free(desc);
}
@@ -719,9 +712,9 @@
static void status_changed(GtkPrintOperation *op, gpointer data)
{
if (gtk_print_operation_get_status(op) == GTK_PRINT_STATUS_FINISHED_ABORTED)
- {
- ((DocInfo*)data)->cancelled = TRUE;
- }
+ msgwin_status_add(_("Printing of file %s was cancelled."), (gchar *) data);
+ else if (gtk_print_operation_get_status(op) == GTK_PRINT_STATUS_FINISHED)
+ msgwin_status_add(_("File %s printed."), (gchar *) data);
}
@@ -743,11 +736,12 @@
op = gtk_print_operation_new();
gtk_print_operation_set_unit(op, GTK_UNIT_POINTS);
+ gtk_print_operation_set_show_progress(op, TRUE);
g_signal_connect(op, "begin-print", G_CALLBACK(begin_print), dinfo);
g_signal_connect(op, "end-print", G_CALLBACK(end_print), dinfo);
g_signal_connect(op, "draw-page", G_CALLBACK(draw_page), dinfo);
- g_signal_connect(op, "status-changed", G_CALLBACK(status_changed), dinfo);
+ g_signal_connect(op, "status-changed", G_CALLBACK(status_changed), doc_list[idx].file_name);
g_signal_connect(op, "create-custom-widget", G_CALLBACK(create_custom_widget), widgets);
g_signal_connect(op, "custom-widget-apply", G_CALLBACK(custom_widget_apply), widgets);
@@ -764,10 +758,7 @@
if (settings != NULL)
g_object_unref(settings);
settings = g_object_ref(gtk_print_operation_get_print_settings(op));
- if (dinfo->cancelled)
- msgwin_status_add(_("Printing of file %s was cancelled."), doc_list[idx].file_name);
- else
- msgwin_status_add(_("File %s printed."), doc_list[idx].file_name);
+ // status message is printed in the status-changed handler
}
else if (res == GTK_PRINT_OPERATION_RESULT_ERROR)
{
@@ -775,10 +766,6 @@
doc_list[idx].file_name, error->message);
g_error_free(error);
}
- else if (res == GTK_PRINT_OPERATION_RESULT_CANCEL)
- { // not sure when this actually happens but just in case we print a message
- msgwin_status_add(_("Printing of file %s was cancelled."), doc_list[idx].file_name);
- }
g_object_unref(op);
g_free(dinfo);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list