diff options
author | Mikael Hallendal <micke@codefactory.se> | 2002-01-19 22:00:17 +0000 |
---|---|---|
committer | Mikael Hallendal <hallski@src.gnome.org> | 2002-01-19 22:00:17 +0000 |
commit | 96fc5bbeb5900f2d8cc2a44f473b588f7c607363 (patch) | |
tree | 63208abdd06a042777483c959f5f9454030b89c2 | |
parent | 0567edbe405d5472ce256f266a8b32f97851cb9a (diff) | |
download | yelp-96fc5bbeb5900f2d8cc2a44f473b588f7c607363.tar.gz |
added/impl. quit the bonobo-main when last window is destroyed.
2002-01-19 Mikael Hallendal <micke@codefactory.se>
* src/yelp-base.c (yelp_base_window_finalized_cb): added/impl.
quit the bonobo-main when last window is destroyed.
(yelp_base_new_window): add a weak ref to the new window. used to
be able to quit bonobo-main when last window is destroyed.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | src/yelp-base.c | 55 |
2 files changed, 50 insertions, 17 deletions
@@ -1,19 +1,21 @@ 2002-01-19 Mikael Hallendal <micke@codefactory.se> + * src/yelp-base.c + (yelp_base_window_finalized_cb): added/impl. + quit the bonobo-main when last window is destroyed. + (yelp_base_new_window): add a weak ref to the new window. used to + be able to quit bonobo-main when last window is destroyed. + * src/yelp-info.c (yelp_info_init): - check if /usr/share/info and /usr/info is the same before adding both. -2002-01-19 Mikael Hallendal <micke@codefactory.se> - * src/yelp-man.c (yelp_man_init): - Use g_spawn_command_line_sync instead of popen. - if 'manpath' command is not found, look for MANPATH env. before using /usr/man and /usr/share/man - cleaned up a little to better fit into Yelp code. -2002-01-19 Mikael Hallendal <micke@codefactory.se> - * src/yelp-html.c (yelp_html_new): remove the temp printout. just print Yelp for now. @@ -21,8 +23,6 @@ check that /usr/man and /usr/share/man doesn't point to the same place. -2002-01-19 Mikael Hallendal <micke@codefactory.se> - * src/yelp-scrollkeeper.c: (ys_strip_scheme): rewrote to - accept NULL instead of scheme diff --git a/src/yelp-base.c b/src/yelp-base.c index ab1db488..0a344b30 100644 --- a/src/yelp-base.c +++ b/src/yelp-base.c @@ -22,6 +22,7 @@ #include <config.h> +#include <bonobo/bonobo-main.h> #include "yelp-window.h" #include "yelp-section.h" #include "yelp-scrollkeeper.h" @@ -34,18 +35,24 @@ typedef struct { GtkTreeIter *parent; } ForeachData; -static void yelp_base_init (YelpBase *base); -static void yelp_base_class_init (YelpBaseClass *klass); -static void yelp_base_new_window_cb (YelpWindow *window, - YelpBase *base); - -#define PARENT_TYPE BONOBO_OBJECT_TYPE -static BonoboObjectClass *parent_class; - struct _YelpBasePriv { GtkTreeStore *content_store; + + GSList *windows; }; + +static void yelp_base_init (YelpBase *base); +static void yelp_base_class_init (YelpBaseClass *klass); +static void yelp_base_new_window_cb (YelpWindow *window, + YelpBase *base); +static void yelp_base_window_finalized_cb (YelpBase *base, + YelpWindow *window); + + +#define PARENT_TYPE BONOBO_OBJECT_TYPE +static BonoboObjectClass *parent_class; + static void impl_Yelp_newWindow (PortableServer_Servant servant, CORBA_Environment *ev) @@ -71,7 +78,8 @@ yelp_base_init (YelpBase *base) G_TYPE_POINTER, G_TYPE_BOOLEAN); - base->priv = priv; + priv->windows = NULL; + base->priv = priv; } static void @@ -97,6 +105,22 @@ yelp_base_new_window_cb (YelpWindow *window, YelpBase *base) gtk_widget_show_all (new_window); } +static void +yelp_base_window_finalized_cb (YelpBase *base, YelpWindow *window) +{ + YelpBasePriv *priv; + + g_return_if_fail (YELP_IS_BASE (base)); + + priv = base->priv; + + priv->windows = g_slist_remove (priv->windows, window); + + if (g_slist_length (priv->windows) == 0) { + bonobo_main_quit (); + } +} + YelpBase * yelp_base_new (void) { @@ -115,13 +139,22 @@ yelp_base_new (void) GtkWidget * yelp_base_new_window (YelpBase *base) { - GtkWidget *window; + YelpBasePriv *priv; + GtkWidget *window; g_return_val_if_fail (YELP_IS_BASE (base), NULL); + + priv = base->priv; - /* FIXME: Have the windows in a list */ window = yelp_window_new (GTK_TREE_MODEL (base->priv->content_store)); + priv->windows = g_slist_prepend (priv->windows, window); + + g_object_weak_ref (G_OBJECT (window), + (GWeakNotify) yelp_base_window_finalized_cb, + base); + + g_signal_connect (window, "new_window_requested", G_CALLBACK (yelp_base_new_window_cb), base); |