Re: [Planner Dev] patch for 308688, 311691, 314480
- From: Kurt Maute <kurt maute us>
- To: Planner Project Manager - Development List <planner-dev lists imendio com>
- Subject: Re: [Planner Dev] patch for 308688, 311691, 314480
- Date: Thu, 16 Mar 2006 17:48:14 -0500
On Tue, 2006-03-14 at 07:40 +0100, Richard Hult wrote:
> I think it's better to just show the dialog when there are no views
> selected since preview is meant to just show the preview with the
> current settings. For the print dialog, we could also make the view tab
> active before showing the dialog.
ok, set the focus to the view tab.
Yeah, looks better that way.
> Two tiny comments:
> Missing space before (
> There's no need to copy the string, just use it directly below instead.
Both corrected.
Also set parent windows for the new dialogs properly.
This one should be ready for commit.
--
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
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 16 Mar 2006 14:57:49 -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",
+ GTK_WINDOW (window),
+ 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)
@@ -169,6 +192,7 @@
gtk_notebook_prepend_page (print_dialog_get_notebook (dialog),
page,
gtk_label_new (_("Select views")));
+ gtk_notebook_set_current_page (print_dialog_get_notebook (dialog), 0);
g_object_set_data (G_OBJECT (dialog), "window", window);
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 16 Mar 2006 14:57:49 -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 16 Mar 2006 14:57:49 -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,13 @@
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;
window = PLANNER_WINDOW (data);
priv = window->priv;
@@ -1016,22 +1048,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);
+
+ views = planner_print_dialog_get_print_selection (GTK_DIALOG (dialog), &summary);
+ n_views = g_list_length (views);
- 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;
- }
+ if (n_views == 0) {
- /* Save printer settings. */
- planner_print_dialog_save_config (config);
+ message = gtk_message_dialog_new (GTK_WINDOW (dialog),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ "%s", "Please choose one or more views to print.");
+
+ 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 +1094,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]