From 431cf62eb65a6b7e470bde0034b61fa018fe2049 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Mon, 17 Sep 2001 22:53:40 +0000 Subject: New. (quit_box_destroyed_callback): New. (no_views_left_cb): Use these two * main.c (quit_box_new): New. (quit_box_destroyed_callback): New. (no_views_left_cb): Use these two functions to display a warning message when Evolution is quitting. svn path=/trunk/; revision=12917 --- shell/ChangeLog | 7 +++++++ shell/main.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) (limited to 'shell') diff --git a/shell/ChangeLog b/shell/ChangeLog index 97d964b872..c8e0ee5130 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,10 @@ +2001-09-17 Ettore Perazzoli + + * main.c (quit_box_new): New. + (quit_box_destroyed_callback): New. + (no_views_left_cb): Use these two functions to display a warning + message when Evolution is quitting. + 2001-09-17 Ettore Perazzoli * e-shell.c (impl_Shell_getLocalStorage): Only raise NotReady if diff --git a/shell/main.c b/shell/main.c index 95f0cb3454..b39ae83cba 100644 --- a/shell/main.c +++ b/shell/main.c @@ -24,9 +24,13 @@ #include #include #include -#include + +#include #include +#include #include +#include + #include #include #include @@ -54,9 +58,55 @@ static gboolean no_splash = FALSE; extern char *evolution_debug_log; +static GtkWidget * +quit_box_new (void) +{ + GtkWidget *window; + GtkWidget *label; + GtkWidget *frame; + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); + + gtk_window_set_title (GTK_WINDOW (window), _("Evolution")); + + frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); + gtk_container_add (GTK_CONTAINER (window), frame); + + label = gtk_label_new (_("Evolution is now exiting ...")); + gtk_misc_set_padding (GTK_MISC (label), 30, 25); + + gtk_container_add (GTK_CONTAINER (frame), label); + + gtk_widget_show (frame); + gtk_widget_show (label); + gtk_widget_show (window); + + while (gtk_events_pending ()) + gtk_main_iteration (); + + return window; +} + +static void +quit_box_destroyed_callback (GtkObject *object, + void *data) +{ + GtkWidget **p; + + p = (GtkWidget **) data; + *p = NULL; +} + static void no_views_left_cb (EShell *shell, gpointer data) { + GtkWidget *quit_box; + + quit_box = quit_box_new (); + gtk_signal_connect (GTK_OBJECT (quit_box), "destroy", quit_box_destroyed_callback, &quit_box); + /* FIXME: This is wrong. We should exit only when the shell is destroyed. But refcounting is broken at present, so this is a reasonable workaround for now. */ @@ -65,6 +115,9 @@ no_views_left_cb (EShell *shell, gpointer data) bonobo_object_unref (BONOBO_OBJECT (shell)); + if (quit_box != NULL) + gtk_widget_destroy (quit_box); + gtk_main_quit (); } -- cgit