summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandeep V Honde <sandeep.honde@wipro.com>2002-02-28 16:41:00 +0000
committerMikael Hallendal <hallski@src.gnome.org>2002-02-28 16:41:00 +0000
commit6c092875e9f32d322887ea8bf052c21e6be62fdb (patch)
tree28ca53cc2ac8f991b45ea96e600865f1da628889
parent1f03605f8d5dbedea21c9e6e50a222dbab05571d (diff)
downloadyelp-6c092875e9f32d322887ea8bf052c21e6be62fdb.tar.gz
- Basic support for Session Management. (yelp_save_session): added/impl.
2002-02-28 Sandeep V Honde <sandeep.honde@wipro.com> * src/yelp-main.c : - Basic support for Session Management. (yelp_save_session): added/impl. (yelp_client_die) : added/impl.
-rw-r--r--ChangeLog7
-rw-r--r--src/yelp-main.c46
2 files changed, 53 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 8cc8187c..50bec7e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-02-28 Sandeep V Honde <sandeep.honde@wipro.com>
+
+ * src/yelp-main.c :
+ - Basic support for Session Management.
+ (yelp_save_session): added/impl.
+ (yelp_client_die) : added/impl.
+
2002-02-28 Mikael Hallendal <micke@codefactory.se>
* src/yelp-view-index.c:
diff --git a/src/yelp-main.c b/src/yelp-main.c
index 67adb5c8..2581a559 100644
--- a/src/yelp-main.c
+++ b/src/yelp-main.c
@@ -34,6 +34,8 @@
#include <libgnome/gnome-program.h>
#include <libgnomeui/gnome-ui-init.h>
#include <libgnomevfs/gnome-vfs.h>
+#include <libgnomeui/gnome-client.h>
+#include <stdlib.h>
#include "GNOME_Yelp.h"
#include "yelp-window.h"
@@ -46,6 +48,17 @@ static BonoboObject * yelp_base_factory (BonoboGenericFactory *factory,
gpointer closure);
static CORBA_Object yelp_main_activate_base (void);
static gboolean yelp_main_idle_start (gchar *url);
+static int yelp_save_session (GnomeClient *client,
+ gint phase,
+ GnomeRestartStyle rstyle,
+ gint shutdown,
+ GnomeInteractStyle istyle,
+ gint fast,
+ gpointer cdata);
+
+static gint yelp_client_die (GnomeClient *client,
+ gpointer cdata);
+
static BonoboObject *
yelp_base_factory (BonoboGenericFactory *factory,
@@ -140,12 +153,39 @@ yelp_main_idle_start (gchar *url)
return FALSE;
}
+
+static gint
+yelp_save_session (GnomeClient *client,
+ gint phase,
+ GnomeRestartStyle rstyle,
+ gint shutdown,
+ GnomeInteractStyle istyle,
+ gint fast,
+ gpointer cdata)
+{
+
+ gchar *argv[]= { NULL };
+
+ argv[0] = (gchar*) cdata;
+ gnome_client_set_clone_command (client, 1, argv);
+ gnome_client_set_restart_command (client, 1, argv);
+ return TRUE;
+}
+
+static gint
+yelp_client_die (GnomeClient *client,
+ gpointer cdata)
+{
+ exit (0);
+}
+
int
main (int argc, char **argv)
{
GnomeProgram *program;
CORBA_Object factory;
gchar *url = NULL;
+ GnomeClient *client;
bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -166,6 +206,12 @@ main (int argc, char **argv)
gnome_vfs_init ();
+ client = gnome_master_client ();
+ g_signal_connect (client, "save_yourself",
+ G_CALLBACK (yelp_save_session), (gpointer) argv[0]);
+ g_signal_connect (client, "die",
+ G_CALLBACK (yelp_client_die), NULL);
+
factory = bonobo_activation_activate_from_id (YELP_FACTORY_OAFIID,
Bonobo_ACTIVATION_FLAG_EXISTING_ONLY,
NULL, NULL);