aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjacob berkman <jacob@ximian.com>2001-08-23 06:12:12 +0800
committerJacob Berkman <jberkman@src.gnome.org>2001-08-23 06:12:12 +0800
commit1b92eea9f43d08e724c831ae6807b39b2ba73f4e (patch)
treecafac7e13ddfb43eec207a590c3470855e3eabca
parent4f1770b14e5b30ca1808e1fa1c1258afe35abee1 (diff)
downloadgsoc2013-evolution-1b92eea9f43d08e724c831ae6807b39b2ba73f4e.tar
gsoc2013-evolution-1b92eea9f43d08e724c831ae6807b39b2ba73f4e.tar.gz
gsoc2013-evolution-1b92eea9f43d08e724c831ae6807b39b2ba73f4e.tar.bz2
gsoc2013-evolution-1b92eea9f43d08e724c831ae6807b39b2ba73f4e.tar.lz
gsoc2013-evolution-1b92eea9f43d08e724c831ae6807b39b2ba73f4e.tar.xz
gsoc2013-evolution-1b92eea9f43d08e724c831ae6807b39b2ba73f4e.tar.zst
gsoc2013-evolution-1b92eea9f43d08e724c831ae6807b39b2ba73f4e.zip
emit an event from our event source (contact_editor_cb): emit a destroy
2001-08-22 jacob berkman <jacob@ximian.com> * gui/component/e-address-popup.c (emit_event): emit an event from our event source (contact_editor_cb): emit a destroy event so our control frame can be destroyed. (edit_contact_info_cb): emit a hide event so our control frame can be hidden (e_address_popup_cardify): (add_contacts_cb): emit the destroy event (e_address_popup_factory_new_control): don't unref our object at widget destroy time as that was really really broken (e_address_popup_factory_new_control): create an event source and aggregate ourself with it * gui/contact-editor/e-contact-editor.c (enable_writable_fields): display a nicer warning when we can't find a widget for a given field (e_contact_editor_raise): only raise if there is a window * gui/contact-editor/contact-editor.glade: name some widgets that got unnamed, and set the first entry as defaultable * gui/contact-editor/e-contact-editor.c: envelope printing is disabled in 1.0 2001-08-22 jacob berkman <jacob@ximian.com> * mail-display.c: rework how the e-card-popup thing has its life managed. we now hide the window on the Hide event and destroy it on the Destroy event emitted from its event source svn path=/trunk/; revision=12402
-rw-r--r--addressbook/ChangeLog26
-rw-r--r--addressbook/gui/component/e-address-popup.c40
-rw-r--r--addressbook/gui/component/e-address-popup.h3
-rw-r--r--addressbook/gui/contact-editor/contact-editor.glade5
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c32
-rw-r--r--mail/ChangeLog6
-rw-r--r--mail/mail-display.c98
7 files changed, 137 insertions, 73 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 76a4ca8b11..eaa2782ce0 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,29 @@
+2001-08-22 jacob berkman <jacob@ximian.com>
+
+ * gui/component/e-address-popup.c (emit_event): emit an event from
+ our event source
+ (contact_editor_cb): emit a destroy event so our control frame can
+ be destroyed.
+ (edit_contact_info_cb): emit a hide event so our control frame can
+ be hidden
+ (e_address_popup_cardify):
+ (add_contacts_cb): emit the destroy event
+ (e_address_popup_factory_new_control): don't unref our object at
+ widget destroy time as that was really really broken
+ (e_address_popup_factory_new_control): create an event source and
+ aggregate ourself with it
+
+ * gui/contact-editor/e-contact-editor.c (enable_writable_fields):
+ display a nicer warning when we can't find a widget for a given
+ field
+ (e_contact_editor_raise): only raise if there is a window
+
+ * gui/contact-editor/contact-editor.glade: name some widgets that
+ got unnamed, and set the first entry as defaultable
+
+ * gui/contact-editor/e-contact-editor.c: envelope printing is
+ disabled in 1.0
+
2001-08-22 Chris Toshok <toshok@ximian.com>
* backend/ebook/e-destination.c (e_destination_get_email): make
diff --git a/addressbook/gui/component/e-address-popup.c b/addressbook/gui/component/e-address-popup.c
index c291e95009..362eee4250 100644
--- a/addressbook/gui/component/e-address-popup.c
+++ b/addressbook/gui/component/e-address-popup.c
@@ -883,18 +883,36 @@ e_address_popup_new (void)
}
static void
+emit_event (EAddressPopup *pop, const char *event)
+{
+ if (pop->es) {
+ BonoboArg *arg;
+
+ arg = bonobo_arg_new (BONOBO_ARG_BOOLEAN);
+ BONOBO_ARG_SET_BOOLEAN (arg, TRUE);
+ bonobo_event_source_notify_listeners_full (pop->es,
+ "GNOME/Evolution/Addressbook/AddressPopup",
+ "Event",
+ event,
+ arg, NULL);
+ bonobo_arg_release (arg);
+ }
+}
+
+static void
contact_editor_cb (EBook *book, gpointer closure)
{
EAddressPopup *pop = E_ADDRESS_POPUP (closure);
EContactEditor *ce = e_addressbook_show_contact_editor (book, pop->card, FALSE, TRUE);
- e_contact_editor_raise (ce);
+ emit_event (pop, "Destroy");
+ e_contact_editor_raise (ce);
}
static void
edit_contact_info_cb (EAddressPopup *pop)
{
+ emit_event (pop, "Hide");
e_book_use_local_address_book (contact_editor_cb, pop);
- gtk_widget_destroy (GTK_WIDGET (pop));
}
static void
@@ -932,8 +950,7 @@ add_contacts_cb (EAddressPopup *pop)
e_contact_quick_add_free_form (pop->email, NULL, NULL);
}
-
- gtk_widget_destroy (GTK_WIDGET (pop));
+ emit_event (pop, "Destroy");
}
static void
@@ -997,7 +1014,8 @@ e_address_popup_ambiguous_email_add (EAddressPopup *pop, const GList *cards)
card_picker_init (wiz, cards, pop->name, pop->email);
- gtk_widget_destroy (GTK_WIDGET (pop));
+ emit_event (pop, "Destroy");
+
gtk_container_add (GTK_CONTAINER (win), wiz->body);
gtk_widget_show_all (win);
}
@@ -1144,17 +1162,15 @@ e_address_popup_factory_new_control (void)
{
BonoboControl *control;
BonoboPropertyBag *bag;
+ EAddressPopup *addy;
GtkWidget *w;
w = e_address_popup_new ();
+ addy = E_ADDRESS_POPUP (w);
+
control = bonobo_control_new (w);
gtk_widget_show (w);
- gtk_signal_connect_object (GTK_OBJECT (w),
- "destroy",
- GTK_SIGNAL_FUNC (bonobo_object_unref),
- GTK_OBJECT (control));
-
bag = bonobo_property_bag_new (get_prop, set_prop, w);
bonobo_property_bag_add (bag, "name", PROPERTY_NAME,
BONOBO_ARG_STRING, NULL, NULL,
@@ -1171,6 +1187,10 @@ e_address_popup_factory_new_control (void)
bonobo_control_set_properties (control, bag);
bonobo_object_unref (BONOBO_OBJECT (bag));
+ addy->es = bonobo_event_source_new ();
+ bonobo_object_add_interface (BONOBO_OBJECT (control),
+ BONOBO_OBJECT (addy->es));
+
return control;
}
diff --git a/addressbook/gui/component/e-address-popup.h b/addressbook/gui/component/e-address-popup.h
index 9cfde6cb28..ef51437551 100644
--- a/addressbook/gui/component/e-address-popup.h
+++ b/addressbook/gui/component/e-address-popup.h
@@ -31,6 +31,7 @@
#include <gtk/gtk.h>
#include <libgnome/gnome-defs.h>
#include <addressbook/backend/ebook/e-card.h>
+#include <bonobo/bonobo-event-source.h>
BEGIN_GNOME_DECLS
@@ -63,6 +64,8 @@ struct _EAddressPopup {
guint query_tag;
gboolean multiple_matches;
ECard *card;
+
+ BonoboEventSource *es;
};
struct _EAddressPopupClass {
diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade
index bb8bf2cd74..88d74a2a77 100644
--- a/addressbook/gui/contact-editor/contact-editor.glade
+++ b/addressbook/gui/contact-editor/contact-editor.glade
@@ -698,6 +698,7 @@
<widget>
<class>GtkEntry</class>
<name>entry-fullname</name>
+ <can_default>True</can_default>
<has_default>True</has_default>
<can_focus>True</can_focus>
<has_focus>True</has_focus>
@@ -1603,7 +1604,7 @@
<widget>
<class>GtkLabel</class>
- <name>label21</name>
+ <name>accellabel-fileas</name>
<label>File A_s:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
@@ -1630,7 +1631,7 @@
<widget>
<class>GtkLabel</class>
- <name>label22</name>
+ <name>accellabel-web</name>
<label>_Web page address:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 68ef1f6a6d..843f1ab355 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -1055,8 +1055,9 @@ EPixmap pixmaps[] = {
E_PIXMAP ("/commands/ContactEditorSaveAs", "save-as-16.png"),
E_PIXMAP ("/commands/ContactEditorDelete", "evolution-trash-mini.png"),
E_PIXMAP ("/commands/ContactEditorPrint", "print.xpm"),
+#if 0 /* Envelope printing is disabled for Evolution 1.0. */
E_PIXMAP ("/commands/ContactEditorPrintEnvelope", "print.xpm"),
-
+#endif
E_PIXMAP ("/Toolbar/ContactEditorSave", "buttons/save-24.png"),
E_PIXMAP ("/Toolbar/ContactEditorDelete", "buttons/delete-message.png"),
E_PIXMAP ("/Toolbar/ContactEditorPrint", "buttons/print.png"),
@@ -1341,6 +1342,9 @@ e_contact_editor_new (EBook *book,
{
EContactEditor *ce;
+ g_return_val_if_fail (E_IS_BOOK (book), NULL);
+ g_return_val_if_fail (E_IS_CARD (card), NULL);
+
ce = E_CONTACT_EDITOR (gtk_type_new (E_CONTACT_EDITOR_TYPE));
gtk_object_set (GTK_OBJECT (ce),
@@ -2185,11 +2189,23 @@ enable_writable_fields(EContactEditor *editor)
/* handle the label next to the dropdown widgets */
for (i = 0; i < num_widget_field_mappings; i ++) {
- gboolean enabled = g_hash_table_lookup (supported_hash,
- e_card_simple_get_ecard_field (simple,
- widget_field_mappings[i].field_id)) != NULL;
- gtk_widget_set_sensitive (glade_xml_get_widget(editor->gui,
- widget_field_mappings[i].widget_name), enabled);
+ gboolean enabled;
+ GtkWidget *w;
+ const char *field;
+
+ w = glade_xml_get_widget(editor->gui, widget_field_mappings[i].widget_name);
+ if (!w) {
+ g_warning (_("Could not find widget for a field: `%s'"),
+ widget_field_mappings[i].widget_name);
+ continue;
+ }
+
+ field = e_card_simple_get_ecard_field (simple,
+ widget_field_mappings[i].field_id);
+
+ enabled = (g_hash_table_lookup (supported_hash, field) != NULL);
+
+ gtk_widget_set_sensitive (w, enabled);
}
g_hash_table_destroy (dropdown_hash);
@@ -2464,7 +2480,9 @@ extract_info(EContactEditor *editor)
void
e_contact_editor_raise (EContactEditor *editor)
{
- gdk_window_raise (GTK_WIDGET (editor->app)->window);
+ /* FIXME: perhaps we should raise at realize time */
+ if (GTK_WIDGET (editor->app)->window)
+ gdk_window_raise (GTK_WIDGET (editor->app)->window);
}
/**
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 78cbb77ac6..8948af06b8 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,9 @@
+2001-08-22 jacob berkman <jacob@ximian.com>
+
+ * mail-display.c: rework how the e-card-popup thing has its life
+ managed. we now hide the window on the Hide event and destroy it
+ on the Destroy event emitted from its event source
+
2001-08-22 Peter Williams <peterw@ximian.com>
* mail-send-recv.c (set_send_status): We don't need to escape this
diff --git a/mail/mail-display.c b/mail/mail-display.c
index f352476bb4..912785ea71 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -1432,6 +1432,7 @@ struct _PopupInfo {
GtkWidget *win;
guint destroy_timeout;
guint widget_destroy_handle;
+ gboolean hidden;
};
/* Aiieee! Global Data! */
@@ -1449,23 +1450,10 @@ popup_info_free (PopupInfo *pop)
}
static void
-popup_widget_destroy_cb (GtkWidget *w, gpointer user_data)
-{
- PopupInfo *pop = (PopupInfo *) user_data;
-
- gtk_widget_destroy (pop->win);
-}
-
-static void
popup_window_destroy_cb (GtkWidget *w, gpointer user_data)
{
PopupInfo *pop = (PopupInfo *) user_data;
- if (pop->widget_destroy_handle) {
- gtk_signal_disconnect (GTK_OBJECT (pop->w), pop->widget_destroy_handle);
- pop->widget_destroy_handle = 0;
- }
-
the_popup = NULL;
popup_info_free (pop);
@@ -1489,6 +1477,7 @@ popup_enter_cb (GtkWidget *w, GdkEventCrossing *ev, gpointer user_data)
if (pop->destroy_timeout)
gtk_timeout_remove (pop->destroy_timeout);
+ pop->destroy_timeout = 0;
return 0;
}
@@ -1500,7 +1489,9 @@ popup_leave_cb (GtkWidget *w, GdkEventCrossing *ev, gpointer user_data)
if (pop->destroy_timeout)
gtk_timeout_remove (pop->destroy_timeout);
- pop->destroy_timeout = gtk_timeout_add (500, popup_timeout_cb, pop);
+
+ if (!pop->hidden)
+ pop->destroy_timeout = gtk_timeout_add (500, popup_timeout_cb, pop);
return 0;
}
@@ -1511,10 +1502,14 @@ popup_realize_cb (GtkWidget *widget, gpointer user_data)
PopupInfo *pop = (PopupInfo *) user_data;
gtk_widget_add_events (pop->win, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
- gtk_widget_add_events (pop->w, GDK_BUTTON_PRESS_MASK);
- if (pop->destroy_timeout == 0)
- pop->destroy_timeout = gtk_timeout_add (5000, popup_timeout_cb, pop);
+ if (pop->destroy_timeout == 0) {
+ if (!pop->hidden) {
+ pop->destroy_timeout = gtk_timeout_add (5000, popup_timeout_cb, pop);
+ } else {
+ pop->destroy_timeout = 0;
+ }
+ }
}
static void
@@ -1534,7 +1529,7 @@ popup_size_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer user_d
}
-static GtkWidget *
+static PopupInfo *
make_popup_window (GtkWidget *w)
{
PopupInfo *pop = g_new0 (PopupInfo, 1);
@@ -1553,11 +1548,6 @@ make_popup_window (GtkWidget *w)
gtk_window_set_policy (GTK_WINDOW (pop->win), FALSE, FALSE, FALSE);
-
- pop->widget_destroy_handle = gtk_signal_connect (GTK_OBJECT (w),
- "destroy",
- GTK_SIGNAL_FUNC (popup_widget_destroy_cb),
- pop);
gtk_signal_connect (GTK_OBJECT (pop->win),
"destroy",
GTK_SIGNAL_FUNC (popup_window_destroy_cb),
@@ -1583,29 +1573,35 @@ make_popup_window (GtkWidget *w)
gtk_widget_show (fr);
gtk_widget_show (pop->win);
- return pop->win;
+ return pop;
}
-/* Copied from e-shell-view.c */
-static GtkWidget *
-find_socket (GtkContainer *container)
+static void
+listener_cb (BonoboListener *listener,
+ char *event_name,
+ CORBA_any *any,
+ CORBA_Environment *ev,
+ gpointer user_data)
{
- GList *children, *tmp;
-
- children = gtk_container_children (container);
- while (children) {
- if (BONOBO_IS_SOCKET (children->data))
- return children->data;
- else if (GTK_IS_CONTAINER (children->data)) {
- GtkWidget *socket = find_socket (children->data);
- if (socket)
- return socket;
- }
- tmp = children->next;
- g_list_free_1 (children);
- children = tmp;
- }
- return NULL;
+ PopupInfo *pop;
+ char *type;
+
+ pop = user_data;
+
+ if (pop->destroy_timeout)
+ gtk_timeout_remove (pop->destroy_timeout);
+ pop->destroy_timeout = 0;
+
+ type = bonobo_event_subtype (event_name);
+
+ if (!strcmp (type, "Destroy")) {
+ gtk_widget_destroy (GTK_WIDGET (pop->win));
+ } else if (!strcmp (type, "Hide")) {
+ pop->hidden = TRUE;
+ gtk_widget_hide (GTK_WIDGET (pop->win));
+ }
+
+ g_free (type);
}
static int
@@ -1618,9 +1614,7 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay *
if (event->button == 3) {
HTMLEngine *e;
HTMLPoint *point;
- GtkWidget *socket;
GtkWidget *popup_thing;
- GtkWidget *win;
e = GTK_HTML (widget)->engine;
point = html_engine_get_point_at (e, event->x + e->x_offset, event->y + e->y_offset, FALSE);
@@ -1633,24 +1627,20 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay *
src = html_object_get_src (point->object);
if (url && !g_strncasecmp (url, "mailto:", 7)) {
+ PopupInfo *pop;
popup_thing = bonobo_widget_new_control ("OAFIID:GNOME_Evolution_Addressbook_AddressPopup",
CORBA_OBJECT_NIL);
- socket = find_socket (GTK_CONTAINER (popup_thing));
-
bonobo_widget_set_property (BONOBO_WIDGET (popup_thing),
"email", url+7,
NULL);
- win = make_popup_window (popup_thing);
- gtk_signal_connect_object (GTK_OBJECT (socket),
- "destroy",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (win));
-
+ pop = make_popup_window (popup_thing);
-
+ bonobo_event_source_client_add_listener (
+ bonobo_widget_get_objref (BONOBO_WIDGET (popup_thing)),
+ listener_cb, NULL, NULL, pop);
} else if (url || src) {
gint hide_mask = 0;