From 2b9f864daf03aa8e130385f082a9b9072fdd4349 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Wed, 22 May 2002 20:49:13 +0000 Subject: New callback for when the first created view in the shell gets mapped. * main.c (view_map_callback): New callback for when the first created view in the shell gets mapped. (new_view_created_callback): New callback for when the first view of the shell gets created. (show_development_warning): New function to display a warning about the fact that Evolution is unstable. (idle_cb): Call show_development_warning() here unless the EVOLVE_ME_HARDER environment variable is set. * e-shell.c (class_init): Add the "new_view_created" signal here. (create_view): Emit the signal here. * e-shell.h: New signal "new_view_created". svn path=/trunk/; revision=16977 --- shell/ChangeLog | 16 ++++++++++ shell/e-shell.c | 12 ++++++++ shell/e-shell.h | 2 ++ shell/main.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+) diff --git a/shell/ChangeLog b/shell/ChangeLog index f1770d76a5..755c523d0e 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,19 @@ +2002-05-22 Ettore Perazzoli + + * main.c (view_map_callback): New callback for when the first + created view in the shell gets mapped. + (new_view_created_callback): New callback for when the first view + of the shell gets created. + (show_development_warning): New function to display a warning + about the fact that Evolution is unstable. + (idle_cb): Call show_development_warning() here unless the + EVOLVE_ME_HARDER environment variable is set. + + * e-shell.c (class_init): Add the "new_view_created" signal here. + (create_view): Emit the signal here. + + * e-shell.h: New signal "new_view_created". + 2002-05-22 Ettore Perazzoli * e-shell-user-creatable-items-handler.c: New member diff --git a/shell/e-shell.c b/shell/e-shell.c index f2f41baa32..d16b449647 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -150,6 +150,7 @@ struct _EShellPrivate { enum { NO_VIEWS_LEFT, LINE_STATUS_CHANGED, + NEW_VIEW_CREATED, LAST_SIGNAL }; @@ -1027,6 +1028,8 @@ create_view (EShell *shell, e_shell_view_show_shortcut_bar (view, e_shell_view_shortcut_bar_shown (template_view)); } + gtk_signal_emit (GTK_OBJECT (shell), signals[NEW_VIEW_CREATED], view); + return view; } @@ -1142,6 +1145,15 @@ class_init (EShellClass *klass) GTK_TYPE_NONE, 1, GTK_TYPE_ENUM); + signals[NEW_VIEW_CREATED] = + gtk_signal_new ("new_view_created", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (EShellClass, new_view_created), + gtk_marshal_NONE__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_POINTER); + gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); epv = & klass->epv; diff --git a/shell/e-shell.h b/shell/e-shell.h index 119cb87b14..84ce5da551 100644 --- a/shell/e-shell.h +++ b/shell/e-shell.h @@ -80,6 +80,8 @@ struct _EShellClass { void (* no_views_left) (EShell *shell); void (* line_status_changed) (EShell *shell, EShellLineStatus status); + void (* new_view_created) (EShell *shell, EShellView *view); + }; diff --git a/shell/main.c b/shell/main.c index efb0294b6f..3c9802c4e5 100644 --- a/shell/main.c +++ b/shell/main.c @@ -178,6 +178,92 @@ destroy_cb (GtkObject *object, gpointer data) gtk_main_quit (); } + +/* Warning dialog to scare people off a little bit. */ + +static void +warning_dialog_clicked_callback (GnomeDialog *dialog, + int button_number, + void *data) +{ + gtk_widget_destroy (GTK_WIDGET (dialog)); +} + +static void +show_development_warning (GtkWindow *parent) +{ + GtkWidget *label, *warning_dialog; + + warning_dialog = gnome_dialog_new ("Ximian Evolution " VERSION, GNOME_STOCK_BUTTON_OK, NULL); + gtk_window_set_transient_for (GTK_WINDOW (warning_dialog), parent); + + label = gtk_label_new ( + /* xgettext:no-c-format */ + _("Hi. Thanks for taking the time to download this preview release\n" + "of the Ximian Evolution groupware suite.\n" + "\n" + "This version of Ximian Evolution is not yet complete. It's getting close,\n" + "but some features are either unfinished or don't work properly.\n" + "\n" + "If you want a stable version of Evolution, we urge you to uninstall,\n" + "this version, and install a 1.0.x version instead (1.0.5 recommended).\n" + "\n" + "If you find bugs, please report them to us at bugzilla.ximian.com.\n" + "This product comes with no warranty and is not intended for\n" + "individuals prone to violent fits of anger.\n" + "\n" + "We hope that you enjoy the results of our hard work, and we\n" + "eagerly await your contributions!\n" + )); + gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); + gtk_widget_show (label); + + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox), + label, TRUE, TRUE, 4); + + label = gtk_label_new ( + _( + "Thanks\n" + "The Ximian Evolution Team\n" + )); + gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment(GTK_MISC(label), 1, .5); + gtk_widget_show (label); + + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox), + label, TRUE, TRUE, 0); + + gtk_widget_show (warning_dialog); + gtk_signal_connect (GTK_OBJECT (warning_dialog), "clicked", + GTK_SIGNAL_FUNC (warning_dialog_clicked_callback), NULL); +} + +/* The following signal handlers are used to display the development warning as + soon as the first view is created. */ + +static void +view_map_callback (GtkWidget *widget, + void *data) +{ + gtk_signal_disconnect_by_func (GTK_OBJECT (widget), + GTK_SIGNAL_FUNC (view_map_callback), + data); + + show_development_warning (GTK_WINDOW (widget)); +} + +static void +new_view_created_callback (EShell *shell, + EShellView *view, + void *data) +{ + gtk_signal_disconnect_by_func (GTK_OBJECT (shell), + GTK_SIGNAL_FUNC (new_view_created_callback), + data); + + gtk_signal_connect (GTK_OBJECT (view), "map", view_map_callback, NULL); +} + /* This is for doing stuff that requires the GTK+ loop to be running already. */ @@ -216,6 +302,11 @@ idle_cb (void *data) GTK_SIGNAL_FUNC (no_views_left_cb), NULL); gtk_signal_connect (GTK_OBJECT (shell), "destroy", GTK_SIGNAL_FUNC (destroy_cb), NULL); + + if (!getenv ("EVOLVE_ME_HARDER")) + gtk_signal_connect (GTK_OBJECT (shell), "new_view_created", + GTK_SIGNAL_FUNC (new_view_created_callback), NULL); + corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell)); corba_shell = CORBA_Object_duplicate (corba_shell, &ev); break; -- cgit v1.2.3