X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Fmain.c;h=74ff8f72c1f9232b76165f470e7cd2839fa13725;hb=361792d9aa11f7affdabd844998390d16ed5b354;hp=3629b07221c0332ecba50742c33953fc6155e8a6;hpb=45c0e948e8b98c5034d1e76e32c549063d185811;p=hvgrip.git diff --git a/src/main.c b/src/main.c index 3629b07..74ff8f7 100644 --- a/src/main.c +++ b/src/main.c @@ -21,16 +21,13 @@ */ #include -#include +#include +#include +#include #include #include "grip.h" -static gint KillSession(GnomeClient* client, gpointer client_data); -static gint SaveSession(GnomeClient *client, gint phase, - GnomeSaveStyle save_style, - gint is_shutdown, GnomeInteractStyle interact_style, - gint is_fast, gpointer client_data); static gint TimeOut(gpointer data); gboolean do_debug=TRUE; @@ -119,6 +116,7 @@ struct poptOption options[] = { N_("Run in verbose (debug) mode"), NULL }, + POPT_AUTOHELP { NULL, '\0', @@ -150,31 +148,33 @@ void Debug(char *fmt,...) int Cmain(int argc, char* argv[]) { - GnomeClient *client; + poptContext context; + int status; /* Unbuffer stdout */ setvbuf(stdout, 0, _IONBF, 0); /* setup locale, i18n */ gtk_set_locale(); - bindtextdomain(GETTEXT_PACKAGE,GNOMELOCALEDIR); - textdomain(GETTEXT_PACKAGE); + bindtextdomain(PACKAGE_TARNAME, LOCALEDIR); + textdomain(PACKAGE_TARNAME); - gnome_program_init(PACKAGE,VERSION,LIBGNOMEUI_MODULE,argc,argv, - GNOME_PARAM_POPT_TABLE,options, - GNOME_PROGRAM_STANDARD_PROPERTIES,NULL); + gtk_init(&argc, &argv); + context = poptGetContext(NULL, argc, (const char **) argv, options, 0); + status = poptGetNextOpt(context); + if (status != -1) { + fprintf(stderr, "Error with option [%s]:\n %s\n", + poptBadOption(context, POPT_BADOPTION_NOALIAS), + poptStrerror(status)); - bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF8"); - setenv("CHARSET","UTF-8",1); + /* Print a short usage message. */ + poptPrintUsage(context, stderr, 0); - /* Session Management */ - - client=gnome_master_client(); - gtk_signal_connect(GTK_OBJECT(client),"save_yourself", - GTK_SIGNAL_FUNC(SaveSession),argv[0]); - gtk_signal_connect(GTK_OBJECT(client),"die", - GTK_SIGNAL_FUNC(KillSession),NULL); - + exit(1); + } + + bind_textdomain_codeset(PACKAGE_TARNAME, "UTF8"); + setenv("CHARSET","UTF-8",1); do_debug=verbose; @@ -194,35 +194,6 @@ int Cmain(int argc, char* argv[]) return 0; } -/* Save the session */ -static gint SaveSession(GnomeClient *client, gint phase, - GnomeSaveStyle save_style, - gint is_shutdown, GnomeInteractStyle interact_style, - gint is_fast, gpointer client_data) -{ - gchar** argv; - guint argc; - - /* allocate 0-filled, so it will be NULL-terminated */ - argv = g_malloc0(sizeof(gchar*)*4); - argc = 1; - - argv[0] = client_data; - - gnome_client_set_clone_command(client, argc, argv); - gnome_client_set_restart_command(client, argc, argv); - - return TRUE; -} - -/* Kill Session */ -static gint KillSession(GnomeClient* client, gpointer client_data) -{ - gtk_main_quit(); - - return TRUE; -} - static gint TimeOut(gpointer data) { GripUpdate(grip_app);