aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Loper <mloper@src.gnome.org>2000-04-27 03:28:22 +0800
committerMatthew Loper <mloper@src.gnome.org>2000-04-27 03:28:22 +0800
commit0ad8dad44a2c002f2da596ae886dea2a544ff061 (patch)
treea97a7e30d4c1ceffd5cfbd32eb269b01b1d3e3d8
parent04195ce9da66c08ae991f29de8a0f797ad246ace (diff)
downloadgsoc2013-evolution-0ad8dad44a2c002f2da596ae886dea2a544ff061.tar.gz
gsoc2013-evolution-0ad8dad44a2c002f2da596ae886dea2a544ff061.tar.zst
gsoc2013-evolution-0ad8dad44a2c002f2da596ae886dea2a544ff061.zip
+ * widgets/e-text/e-text.c (e_text_destroy): Kill text->timer and
+ text->timeout on destroy. + + * e-shell-view.c (bonobo_widget_is_dead): Helper function to see + whether a bonobo widget is a zombie (ie the remote bonobo control + died). + (e_shell_view_set_view): Try to respawn dead bonobo widgets. svn path=/trunk/; revision=2638
-rw-r--r--ChangeLog5
-rw-r--r--shell/ChangeLog7
-rw-r--r--shell/e-shell-view.c92
-rw-r--r--widgets/e-text/e-text.c11
-rw-r--r--widgets/text/e-text.c11
5 files changed, 108 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 143b92bed3..d4a2c7a76b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-04-26 Matt Loper <matt@helixcode.com>
+
+ * widgets/e-text/e-text.c (e_text_destroy): Kill text->timer and
+ text->timeout on destroy.
+
2000-04-26 Dan Winship <danw@helixcode.com>
* tests: Update for the camel changes.
diff --git a/shell/ChangeLog b/shell/ChangeLog
index bf2b4193b0..8f4a622cc5 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,10 @@
+2000-04-26 Matt Loper <matt@helixcode.com>
+
+ * e-shell-view.c (bonobo_widget_is_dead): Helper function to see
+ whether a bonobo widget is a zombie (ie the remote bonobo control
+ died).
+ (e_shell_view_set_view): Try to respawn dead widgets.
+
2000-04-25 Dan Winship <danw@helixcode.com>
* Makefile.am: include -I$(datadir)/idl in orbit-idl arguments so
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index d6f4eeed2b..838bc6ccb8 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -19,6 +19,7 @@
#include <bonobo.h>
#include <libgnorba/gnorba.h>
+#include <gtk/gtkprivate.h>
#define PARENT_TYPE gnome_app_get_type ()
@@ -32,8 +33,9 @@ struct _EShellViewPrivate
};
static void
-destroy_folder_view (EFolder *unused, GtkWidget *folder_view, gpointer unused2)
+destroy_folder_view (gpointer unused, gpointer pfolder_view, gpointer unused2)
{
+ GtkWidget *folder_view = GTK_WIDGET (pfolder_view);
BonoboWidget *bonobo_widget;
BonoboObject *bonobo_object;
CORBA_Object corba_control;
@@ -107,7 +109,7 @@ e_shell_view_setup_shortcut_display (EShellView *eshell_view)
eshell_view->hpaned = e_paned_new (TRUE);
- e_paned_insert (eshell_view->hpaned, 0,
+ e_paned_insert (E_PANED (eshell_view->hpaned), 0,
eshell_view->shortcut_bar,
100);
@@ -161,17 +163,21 @@ get_view (EShellView *eshell_view, EFolder *efolder, Bonobo_UIHandler uih)
BonoboControlFrame *cf;
w = bonobo_widget_new_control ("control:calendar", uih);
- cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (w));
- pbc = bonobo_control_frame_get_control_property_bag (cf);
- /*pbc = bonobo_control_get_property_bag (w);*/
- user_cal_file =
- g_concat_dir_and_file (gnome_util_user_home (),
- ".gnome/user-cal.vcf");
-
- bonobo_property_bag_client_set_value_string (pbc,
- "calendar_uri",
- user_cal_file);
+ if (w) {
+ cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (w));
+ pbc = bonobo_control_frame_get_control_property_bag (cf);
+ /*pbc = bonobo_control_get_property_bag (w);*/
+
+ user_cal_file =
+ g_concat_dir_and_file (gnome_util_user_home (),
+ ".gnome/user-cal.vcf");
+
+ bonobo_property_bag_client_set_value_string (pbc,
+ "calendar_uri",
+ user_cal_file);
+ }
+
break;
}
@@ -233,10 +239,10 @@ void e_shell_view_toggle_shortcut_bar (EShellView *eshell_view)
if (shortcut_bar->parent) {
gtk_widget_ref (shortcut_bar);
- e_paned_remove (hpaned, shortcut_bar);
+ e_paned_remove (E_PANED (hpaned), shortcut_bar);
}
else
- e_paned_insert (hpaned, 0, shortcut_bar,
+ e_paned_insert (E_PANED (hpaned), 0, shortcut_bar,
100);
gtk_widget_show_all (GTK_WIDGET (hpaned));
}
@@ -246,6 +252,24 @@ void e_shell_view_toggle_treeview (EShellView *eshell_view)
}
+static gboolean
+bonobo_widget_is_dead (BonoboWidget *bw)
+{
+ BonoboObject *boc = BONOBO_OBJECT (bonobo_widget_get_server (bw));
+ CORBA_Object obj = bonobo_object_corba_objref (boc);
+
+ CORBA_Environment ev;
+
+ gboolean is_dead = FALSE;
+
+ CORBA_exception_init (&ev);
+ if (CORBA_Object_non_existent(obj, &ev))
+ is_dead = TRUE;
+ CORBA_exception_free (&ev);
+
+ return is_dead;
+}
+
void
e_shell_view_set_view (EShellView *eshell_view, EFolder *efolder)
@@ -276,11 +300,43 @@ e_shell_view_set_view (EShellView *eshell_view, EFolder *efolder)
folder_view = g_hash_table_lookup (eshell_view->priv->folder_views,
efolder);
if (folder_view) {
- int notebook_page = gtk_notebook_page_num (notebook,
- folder_view);
- g_assert (notebook_page != -1);
+ int notebook_page;
+ g_assert (GTK_IS_NOTEBOOK (notebook));
+ g_assert (GTK_IS_WIDGET (folder_view));
+
+ notebook_page = gtk_notebook_page_num (notebook,
+ folder_view);
+ g_assert (notebook_page != -1);
+
+ /* a BonoboWidget can be a "zombie" in the sense that its
+ actual control is dead; if it's zombie, let's recreate it*/
+ if (bonobo_widget_is_dead (BONOBO_WIDGET (folder_view))) {
+
+ GtkWidget *parent = folder_view->parent;
+ Bonobo_UIHandler uih =
+ bonobo_object_corba_objref (
+ BONOBO_OBJECT (eshell_view->uih));
+
+ /* out with the old */
+ gtk_container_remove (GTK_CONTAINER (parent), folder_view);
+
+ /* in with the new */
+ folder_view = get_view (eshell_view, efolder, uih);
+ gtk_container_add (GTK_CONTAINER (parent), folder_view);
+
+ /* make sure it's in our hashtable, so we can get to
+ it from the shortcut bar */
+ g_hash_table_insert (eshell_view->priv->folder_views,
+ efolder, folder_view);
+ gtk_widget_show_all (folder_view);
+ }
+
+
gtk_notebook_set_page (notebook, notebook_page);
+
+ return;
+
} else {
/* Get a new control that represents this efolder,
* append it to our notebook, and put it in our hash.
@@ -345,7 +401,7 @@ e_shell_view_new (EShell *eshell, EFolder *efolder, gboolean show_shortcut_bar)
FALSE);
gtk_widget_show (eshell_view->priv->notebook);
-
+
e_paned_insert (E_PANED (eshell_view->hpaned),
1,
eshell_view->priv->notebook,
diff --git a/widgets/e-text/e-text.c b/widgets/e-text/e-text.c
index cc68ec9bc5..fbff51d728 100644
--- a/widgets/e-text/e-text.c
+++ b/widgets/e-text/e-text.c
@@ -398,6 +398,17 @@ e_text_destroy (GtkObject *object)
if (text->stipple)
gdk_bitmap_unref (text->stipple);
+ if (text->timeout_id) {
+ g_source_remove(text->timeout_id);
+ text->timeout_id = 0;
+ }
+
+ if (text->timer) {
+ g_timer_stop(text->timer);
+ g_timer_destroy(text->timer);
+ text->timer = NULL;
+ }
+
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index cc68ec9bc5..fbff51d728 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -398,6 +398,17 @@ e_text_destroy (GtkObject *object)
if (text->stipple)
gdk_bitmap_unref (text->stipple);
+ if (text->timeout_id) {
+ g_source_remove(text->timeout_id);
+ text->timeout_id = 0;
+ }
+
+ if (text->timer) {
+ g_timer_stop(text->timer);
+ g_timer_destroy(text->timer);
+ text->timer = NULL;
+ }
+
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}