aboutsummaryrefslogtreecommitdiffstats
path: root/shell/main.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-09-18 06:53:40 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-09-18 06:53:40 +0800
commit431cf62eb65a6b7e470bde0034b61fa018fe2049 (patch)
treefb323d848bc721528284a57a21cec61289e0cbfb /shell/main.c
parented0347eacebd893fc25221d55fa3040b4248ce2e (diff)
downloadgsoc2013-evolution-431cf62eb65a6b7e470bde0034b61fa018fe2049.tar.gz
gsoc2013-evolution-431cf62eb65a6b7e470bde0034b61fa018fe2049.tar.zst
gsoc2013-evolution-431cf62eb65a6b7e470bde0034b61fa018fe2049.zip
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
Diffstat (limited to 'shell/main.c')
-rw-r--r--shell/main.c55
1 files changed, 54 insertions, 1 deletions
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 <config.h>
#include <fcntl.h>
#include <glib.h>
-#include <gtk/gtkmain.h>
+
+#include <gtk/gtkframe.h>
#include <gtk/gtklabel.h>
+#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
+#include <gtk/gtkwindow.h>
+
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
@@ -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 ();
}