aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-07-03 01:06:08 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-07-03 01:06:08 +0800
commit7657ec4a52ccbe53d039a70f74ec687d9fa662a7 (patch)
treeb5a759a9af265756eab9a762c718a2e6d60014b6 /shell
parentb37c291e33769b6019e512c212fdea50d4a2529f (diff)
downloadgsoc2013-evolution-7657ec4a52ccbe53d039a70f74ec687d9fa662a7.tar
gsoc2013-evolution-7657ec4a52ccbe53d039a70f74ec687d9fa662a7.tar.gz
gsoc2013-evolution-7657ec4a52ccbe53d039a70f74ec687d9fa662a7.tar.bz2
gsoc2013-evolution-7657ec4a52ccbe53d039a70f74ec687d9fa662a7.tar.lz
gsoc2013-evolution-7657ec4a52ccbe53d039a70f74ec687d9fa662a7.tar.xz
gsoc2013-evolution-7657ec4a52ccbe53d039a70f74ec687d9fa662a7.tar.zst
gsoc2013-evolution-7657ec4a52ccbe53d039a70f74ec687d9fa662a7.zip
Don't assert that there is a handler, so we don't crash if user clicks on
* e-storage-set-view.c (popup_folder_menu): Don't assert that there is a handler, so we don't crash if user clicks on a folder whose type we cannot handle for some reason [such as an uninstalled component]. * evolution-test-component.c (activity_client_cancel_callback): New callback for the "cancel" signal on the EvolutionActivityClient object. (activity_client_show_details_callback): New callback for the "show_details" signal. (timeout_callback_1): Connect these two signal handlers. * e-activity-handler.c (task_widget_button_press_event_callback): Ahem, right-click is button 3, not button 2. (show_cancellation_popup): Actually pop up the menu. (get_corba_null_value): New helper function to create a CORBA_any null value. (report_task_event): New helper function to report events to the listener. (task_widget_cancel_callback): Use it. Report "Cancel" instead of "Cancelled". (task_widget_show_details_callback): New, callback for the "Show Details" right-click menu item. * evolution-activity-client.c: Updated to dispatch the "Cancel" and "ShowDetails" events as "cancel" and "show_details" signals. (class_init): Install the signals. (listener_callback): Updated to update the signals corresponding to the "ShowDetails" and "Cancel" events. * Evolution-Activity.idl: Changed the docs about the events sent to the Bonobo::Listener. We now only have "ShowDetails" and "Cancelled". * evolution-test-component.c (timeout_callback_1): Make the activity cancellable so we can test the right-click cancel menu too. * main.c (idle_cb): Actually exit if we cannot reach to the shell. svn path=/trunk/; revision=10684
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog42
-rw-r--r--shell/Evolution-Activity.idl13
-rw-r--r--shell/e-activity-handler.c60
-rw-r--r--shell/e-storage-set-view.c3
-rw-r--r--shell/evolution-activity-client.c30
-rw-r--r--shell/evolution-activity-client.h6
-rw-r--r--shell/evolution-test-component.c21
-rw-r--r--shell/main.c1
8 files changed, 132 insertions, 44 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 59f9096f9d..aa2e14080f 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,45 @@
+2001-07-02 Ettore Perazzoli <ettore@ximian.com>
+
+ * e-storage-set-view.c (popup_folder_menu): Don't assert that
+ there is a handler, so we don't crash if user clicks on a folder
+ whose type we cannot handle for some reason [such as an
+ uninstalled component].
+
+ * evolution-test-component.c (activity_client_cancel_callback):
+ New callback for the "cancel" signal on the
+ EvolutionActivityClient object.
+ (activity_client_show_details_callback): New callback for the
+ "show_details" signal.
+ (timeout_callback_1): Connect these two signal handlers.
+
+ * e-activity-handler.c (task_widget_button_press_event_callback):
+ Ahem, right-click is button 3, not button 2.
+ (show_cancellation_popup): Actually pop up the menu.
+ (get_corba_null_value): New helper function to create a CORBA_any
+ null value.
+ (report_task_event): New helper function to report events to the
+ listener.
+ (task_widget_cancel_callback): Use it. Report "Cancel" instead of
+ "Cancelled".
+ (task_widget_show_details_callback): New, callback for the "Show
+ Details" right-click menu item.
+
+ * evolution-activity-client.c: Updated to dispatch the "Cancel"
+ and "ShowDetails" events as "cancel" and "show_details" signals.
+ (class_init): Install the signals.
+ (listener_callback): Updated to update the signals corresponding
+ to the "ShowDetails" and "Cancel" events.
+
+ * Evolution-Activity.idl: Changed the docs about the events sent
+ to the Bonobo::Listener. We now only have "ShowDetails" and
+ "Cancelled".
+
+ * evolution-test-component.c (timeout_callback_1): Make the
+ activity cancellable so we can test the right-click cancel menu
+ too.
+
+ * main.c (idle_cb): Actually exit if we cannot reach to the shell.
+
2001-07-01 Ettore Perazzoli <ettore@ximian.com>
* e-uri-schema-registry.c (init): Unset the FLOATING flag on the
diff --git a/shell/Evolution-Activity.idl b/shell/Evolution-Activity.idl
index 780cb04f1f..de23d2c53b 100644
--- a/shell/Evolution-Activity.idl
+++ b/shell/Evolution-Activity.idl
@@ -33,15 +33,12 @@ interface Activity : Bonobo::Unknown {
/* Events propagated through the listener:
- - "Clicked": The status widget has been clicked on.
+ - "ShowDetails": The user wants to know details about the
+ progressing operation. The component should display additional
+ information about the operation in progress, or raise a pending
+ alert dialog.
- - "DisplayProgress": Display a nice progress dialog for this
- operation.
-
- - "DisplayDialog": The dialog that the component has requested
- through ::requestDialog() can now be safely displayed.
-
- - "Cancelled": The user wants the operation to be cancelled.
+ - "Cancel": The user wants the operation to be cancelled.
*/
/**
diff --git a/shell/e-activity-handler.c b/shell/e-activity-handler.c
index a7d42a361b..89ff551f4f 100644
--- a/shell/e-activity-handler.c
+++ b/shell/e-activity-handler.c
@@ -31,6 +31,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libgnome/gnome-i18n.h>
+#include <libgnomeui/gnome-popup-menu.h>
#include <gal/util/e-util.h>
#include <gal/widgets/e-popup-menu.h>
@@ -136,6 +137,34 @@ lookup_activity (GList *list,
return NULL;
}
+static const CORBA_any *
+get_corba_null_value (void)
+{
+ static CORBA_any *null_value = NULL;
+
+ if (null_value == NULL) {
+ null_value = CORBA_any__alloc ();
+ null_value->_type = TC_null;
+ }
+
+ return null_value;
+}
+
+static void
+report_task_event (ActivityInfo *activity_info,
+ const char *event_name)
+{
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+
+ Bonobo_Listener_event (activity_info->event_listener, event_name, get_corba_null_value (), &ev);
+ if (ev._major != CORBA_NO_EXCEPTION)
+ g_warning ("EActivityHandler: Cannot event `%s' -- %s", event_name, ev._repo_id);
+
+ CORBA_exception_free (&ev);
+}
+
/* ETaskWidget actions. */
@@ -144,24 +173,19 @@ task_widget_cancel_callback (GtkWidget *widget,
void *data)
{
ActivityInfo *activity_info;
- CORBA_Environment ev;
- CORBA_any *null_value;
-
- CORBA_exception_init (&ev);
activity_info = (ActivityInfo *) data;
+ report_task_event (activity_info, "Cancel");
+}
- null_value = CORBA_any__alloc ();
- null_value->_type = TC_null;
-
- Bonobo_Listener_event (activity_info->event_listener, "Cancelled", null_value, &ev);
- if (ev._major != CORBA_NO_EXCEPTION)
- g_warning ("EActivityHandler: Cannot report `Cancelled' event -- %s",
- ev._repo_id);
-
- CORBA_free (null_value);
+static void
+task_widget_show_details_callback (GtkWidget *widget,
+ void *data)
+{
+ ActivityInfo *activity_info;
- CORBA_exception_free (&ev);
+ activity_info = (ActivityInfo *) data;
+ report_task_event (activity_info, "ShowDetails");
}
static void
@@ -171,11 +195,15 @@ show_cancellation_popup (ActivityInfo *activity_info,
{
GtkMenu *popup;
EPopupMenu items[] = {
- { N_("Cancel"), NULL, task_widget_cancel_callback, NULL, 0 },
+ { N_("Show Details"), NULL, task_widget_show_details_callback, NULL, 0 },
+ { "", NULL, NULL, NULL, 0 },
+ { N_("Cancel Operation"), NULL, task_widget_cancel_callback, NULL, 0 },
{ NULL }
};
+ /* FIXME: We should gray out things properly here. */
popup = e_popup_menu_create (items, 0, 0, activity_info);
+ gnome_popup_menu_do_popup (GTK_WIDGET (popup), NULL, NULL, button_event, activity_info);
}
static int
@@ -189,7 +217,7 @@ task_widget_button_press_event_callback (GtkWidget *widget,
activity_info = (ActivityInfo *) data;
- if (button_event->button == 2) {
+ if (button_event->button == 3) {
if (! activity_info->cancellable) {
return FALSE;
} else {
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index fc4872f9b1..c0f4aee7f7 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -716,7 +716,8 @@ popup_folder_menu (EStorageSetView *storage_set_view,
handler = e_folder_type_registry_get_handler_for_type (folder_type_registry,
e_folder_get_type_string (folder));
- g_assert (handler != NULL);
+ if (handler == NULL)
+ return;
menu = gtk_menu_new ();
bonobo_window_add_popup (bonobo_ui_container_get_win (priv->container),
diff --git a/shell/evolution-activity-client.c b/shell/evolution-activity-client.c
index 9e95eedcac..1bb74f6dda 100644
--- a/shell/evolution-activity-client.c
+++ b/shell/evolution-activity-client.c
@@ -47,7 +47,8 @@ static GtkObjectClass *parent_class = NULL;
#define UPDATE_DELAY 1000
enum {
- CLICKED,
+ SHOW_DETAILS,
+ CANCEL,
LAST_SIGNAL
};
@@ -209,8 +210,10 @@ listener_callback (BonoboListener *listener,
activity_client = EVOLUTION_ACTIVITY_CLIENT (data);
- if (strcmp (event_name, "Clicked") == 0)
- gtk_signal_emit (GTK_OBJECT (activity_client), signals[CLICKED]);
+ if (strcmp (event_name, "ShowDetails") == 0)
+ gtk_signal_emit (GTK_OBJECT (activity_client), signals[SHOW_DETAILS]);
+ else if (strcmp (event_name, "Cancel") == 0)
+ gtk_signal_emit (GTK_OBJECT (activity_client), signals[CANCEL]);
else
g_warning ("EvolutionActivityClient: Unknown event from listener -- %s", event_name);
}
@@ -264,12 +267,21 @@ class_init (EvolutionActivityClientClass *klass)
object_class = GTK_OBJECT_CLASS (klass);
object_class->destroy = impl_destroy;
- signals[CLICKED] = gtk_signal_new ("clicked",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EvolutionActivityClientClass, clicked),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ signals[SHOW_DETAILS]
+ = gtk_signal_new ("show_details",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EvolutionActivityClientClass, show_details),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
+ signals[CANCEL]
+ = gtk_signal_new ("cancel",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EvolutionActivityClientClass, cancel),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
diff --git a/shell/evolution-activity-client.h b/shell/evolution-activity-client.h
index cc59cc1331..e21fbec52d 100644
--- a/shell/evolution-activity-client.h
+++ b/shell/evolution-activity-client.h
@@ -57,10 +57,8 @@ struct _EvolutionActivityClientClass {
GtkObjectClass parent_class;
/* Signals. */
- void (* clicked) (EvolutionActivityClient *activity_client);
- void (* display_progress) (EvolutionActivityClient *activity_client);
- void (* display_dialog) (EvolutionActivityClient *activity_client);
- void (* cancelled) (EvolutionActivityClient *activity_client);
+ void (* show_details) (EvolutionActivityClient *activity_client);
+ void (* cancel) (EvolutionActivityClient *activity_client);
};
diff --git a/shell/evolution-test-component.c b/shell/evolution-test-component.c
index 16286d11f0..e1d2354a7b 100644
--- a/shell/evolution-test-component.c
+++ b/shell/evolution-test-component.c
@@ -55,10 +55,17 @@ static int progress = -1;
/* Callbacks. */
static void
-activity_client_clicked_callback (EvolutionActivityClient *client,
- void *data)
+activity_client_cancel_callback (EvolutionActivityClient *client,
+ void *data)
{
- g_warning ("Task bar button clicked!");
+ g_print ("User requested that the operation be cancelled.\n");
+}
+
+static void
+activity_client_show_details_callback (EvolutionActivityClient *client,
+ void *data)
+{
+ g_print ("User wants to see details.\n");
}
@@ -112,15 +119,17 @@ timeout_callback_1 (void *data)
activity_client = evolution_activity_client_new (parent_shell, COMPONENT_ID,
animated_icon,
"Operation Foo started!",
- FALSE,
+ TRUE,
&suggest_display);
if (activity_client == CORBA_OBJECT_NIL) {
g_warning ("Cannot create EvolutionActivityClient object");
return FALSE;
}
- gtk_signal_connect (GTK_OBJECT (activity_client), "clicked",
- GTK_SIGNAL_FUNC (activity_client_clicked_callback), NULL);
+ gtk_signal_connect (GTK_OBJECT (activity_client), "cancel",
+ GTK_SIGNAL_FUNC (activity_client_cancel_callback), NULL);
+ gtk_signal_connect (GTK_OBJECT (activity_client), "show_details",
+ GTK_SIGNAL_FUNC (activity_client_show_details_callback), NULL);
g_print ("Component becoming busy -- %s\n", COMPONENT_ID);
if (suggest_display)
diff --git a/shell/main.c b/shell/main.c
index c8e802b985..b4b1870a1f 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -151,6 +151,7 @@ idle_cb (void *data)
e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Cannot access the Evolution shell."));
CORBA_exception_free (&ev);
+ gtk_main_quit ();
return FALSE;
}