[Planner Dev] patch for 308688, 311691, 314480
- From: Kurt Maute <kurt maute us>
- To: Planner-Dev <planner-dev lists imendio com>
- Subject: [Planner Dev] patch for 308688, 311691, 314480
- Date: Mon, 13 Mar 2006 20:56:56 -0500
All,
Here's a patch to correct the confusing little issue where someone tries
to print with no views selected.
For the 'Print' option, I simply pop up a message box: "Please select
one or more views to print."
'Print Preview' was a little more involved. Since it wouldn't do well
to use the same print dialog for print preview, I created a small dialog
just to select the views. I only have it showing up if there are no
views selected already, so question for the team is: should we give the
user the opportunity to change the views each time print preview is
selected, or no?
For anyone who would like to test this patch, you can zero out the view
selections in the normal print dialog by unchecking each of them, then
choosing either print or print preview, then cancel after clearing the
message box.
--
Kurt Maute <kurt maute us>
? planner/output.pdf
? planner/docs/user-guide/eu/Makefile
? planner/docs/user-guide/eu/Makefile.in
? planner/docs/user-guide/eu/omf_timestamp
? planner/docs/user-guide/eu/planner-eu.omf.out
? planner/src/.planner-print-dialog.c.swp
? planner/src/.planner-print-dialog.h.swp
? planner/src/.planner-window.c.swp
Index: planner/src/planner-print-dialog.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-print-dialog.c,v
retrieving revision 1.14
diff -u -r1.14 planner-print-dialog.c
--- planner/src/planner-print-dialog.c 20 Apr 2005 21:41:12 -0000 1.14
+++ planner/src/planner-print-dialog.c 14 Mar 2006 01:29:05 -0000
@@ -154,6 +154,29 @@
}
GtkWidget *
+planner_print_views_dialog_new (PlannerWindow *window,
+ GList *views)
+{
+ GtkWidget *dialog;
+ GtkWidget *page;
+
+ dialog = gtk_dialog_new_with_buttons ("Select Views",
+ NULL,
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_OK,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ NULL);
+ page = print_dialog_create_page (window, dialog, views);
+
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), page);
+
+ gtk_widget_show_all (dialog);
+
+ return dialog;
+}
+GtkWidget *
planner_print_dialog_new (PlannerWindow *window,
GnomePrintJob *job,
GList *views)
Index: planner/src/planner-print-dialog.h
===================================================================
RCS file: /cvs/gnome/planner/src/planner-print-dialog.h,v
retrieving revision 1.3
diff -u -r1.3 planner-print-dialog.h
--- planner/src/planner-print-dialog.h 14 Dec 2003 11:57:10 -0000 1.3
+++ planner/src/planner-print-dialog.h 14 Mar 2006 01:29:05 -0000
@@ -27,6 +27,8 @@
GtkWidget * planner_print_dialog_new (PlannerWindow *window,
GnomePrintJob *job,
GList *views);
+GtkWidget * planner_print_views_dialog_new (PlannerWindow *window,
+ GList *views);
GList * planner_print_dialog_get_print_selection (GtkDialog *dialog,
gboolean *summary);
void planner_print_dialog_save_config (GnomePrintConfig *config);
Index: planner/src/planner-window.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-window.c,v
retrieving revision 1.52
diff -u -r1.52 planner-window.c
--- planner/src/planner-window.c 23 Apr 2005 10:33:10 -0000 1.52
+++ planner/src/planner-window.c 14 Mar 2006 01:29:06 -0000
@@ -943,11 +943,14 @@
PlannerWindowPriv *priv;
GnomePrintConfig *config;
GnomePrintJob *gpj;
+ GtkWidget *dialog;
GtkWidget *preview;
GList *views, *l;
PlannerView *view;
PlannerPrintJob *job;
- gint n_pages;
+ gboolean summary;
+ gint n_pages, n_views;
+ gint response;
window = PLANNER_WINDOW (data);
priv = window->priv;
@@ -961,6 +964,35 @@
views = window_get_print_selection (window);
+ /* Check to be sure there are some views selected */
+ n_views = g_list_length(views);
+ if (n_views == 0) {
+ dialog = planner_print_views_dialog_new (window, priv->views);
+
+ while (n_views == 0) {
+
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ if (response == GTK_RESPONSE_CANCEL) {
+ gtk_widget_destroy (dialog);
+ g_object_unref (gpj);
+ return;
+ }
+ else if (response == GTK_RESPONSE_DELETE_EVENT) {
+ gtk_widget_destroy (dialog);
+ g_object_unref (gpj);
+ return;
+ }
+
+ /* Save printer settings. */
+ planner_print_dialog_save_config (config);
+
+ views = planner_print_dialog_get_print_selection (GTK_DIALOG (dialog), &summary);
+ n_views = g_list_length(views);
+ }
+ gtk_widget_destroy (dialog);
+ }
+
n_pages = 0;
for (l = views; l; l = l->next) {
view = l->data;
@@ -998,13 +1030,14 @@
PlannerWindowPriv *priv;
GnomePrintJob *gpj;
GnomePrintConfig *config;
- GtkWidget *dialog;
+ GtkWidget *dialog, *message;
gint response;
gboolean summary;
GList *views, *l;
PlannerView *view;
PlannerPrintJob *job;
- gint n_pages;
+ gint n_pages, n_views;
+ gchar *tmp;
window = PLANNER_WINDOW (data);
priv = window->priv;
@@ -1016,22 +1049,43 @@
dialog = planner_print_dialog_new (data, gpj, priv->views);
- response = gtk_dialog_run (GTK_DIALOG (dialog));
+ /* n_views is the number of views selected. */
+ n_views = 0;
+ while (n_views == 0) {
+
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ if (response == GTK_RESPONSE_CANCEL) {
+ gtk_widget_destroy (dialog);
+ g_object_unref (gpj);
+ return;
+ }
+ else if (response == GTK_RESPONSE_DELETE_EVENT) {
+ g_object_unref (gpj);
+ return;
+ }
+
+ /* Save printer settings. */
+ planner_print_dialog_save_config (config);
- if (response == GTK_RESPONSE_CANCEL) {
- gtk_widget_destroy (dialog);
- g_object_unref (gpj);
- return;
- }
- else if (response == GTK_RESPONSE_DELETE_EVENT) {
- g_object_unref (gpj);
- return;
- }
+ views = planner_print_dialog_get_print_selection (GTK_DIALOG (dialog), &summary);
+ n_views = g_list_length(views);
+
+ if (n_views == 0) {
+ tmp = g_strdup_printf (_("Please choose one or more views to print."));
- /* Save printer settings. */
- planner_print_dialog_save_config (config);
+ message = gtk_message_dialog_new (GTK_WINDOW (window),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ "%s", tmp);
+
+ gtk_dialog_run (GTK_DIALOG (message));
+ gtk_widget_destroy (message);
+ }
+ }
- views = planner_print_dialog_get_print_selection (GTK_DIALOG (dialog), &summary);
if (summary) {
/*g_print ("Print summary\n");*/
}
@@ -1041,7 +1095,6 @@
n_pages = 0;
for (l = views; l; l = l->next) {
view = l->data;
-
planner_view_print_init (view, job);
n_pages += planner_view_print_get_n_pages (view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]