3
* Copyright (c) 1998-2002 Mike Oliphant <oliphant@gtk.org>
5
* http://www.nostatic.org/grip
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License as
9
* published by the Free Software Foundation; either version 2 of the
10
* License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
28
static gint KillSession(GnomeClient* client, gpointer client_data);
29
static gint SaveSession(GnomeClient *client, gint phase,
30
GnomeSaveStyle save_style,
31
gint is_shutdown, GnomeInteractStyle interact_style,
32
gint is_fast, gpointer client_data);
33
static gint TimeOut(gpointer data);
35
gboolean do_debug=TRUE;
39
static char *geometry=NULL;
40
static char *device=NULL;
41
static char *scsi_device=NULL;
42
static int force_small=FALSE;
43
static int local_mode=FALSE;
44
static int no_redirect=FALSE;
45
static int verbose=FALSE;
47
struct poptOption options[] = {
54
N_("Specify the geometry of the main window"),
63
N_("Specify the cdrom device to use"),
72
N_("Specify the generic scsi device to use"),
81
N_("Launch in \"small\" (cd-only) mode"),
90
N_("\"Local\" mode -- do not look up disc info on the net"),
99
N_("Do not do I/O redirection"),
108
N_("Run in verbose (debug) mode"),
122
void Debug(char *fmt,...)
129
vfprintf(stderr,fmt,args);
135
int Cmain(int argc, char* argv[])
141
/* Unbuffer stdout */
142
setvbuf(stdout, 0, _IONBF, 0);
144
/* setup locale, i18n */
146
bindtextdomain(PACKAGE,GNOMELOCALEDIR);
149
gnome_init_with_popt_table(PACKAGE,VERSION,argc,argv,
154
args=(char **)poptGetArgs(pctx);
156
poptFreeContext(pctx);
158
/* Session Management */
160
client=gnome_master_client();
161
gtk_signal_connect(GTK_OBJECT(client),"save_yourself",
162
GTK_SIGNAL_FUNC(SaveSession),argv[0]);
163
gtk_signal_connect(GTK_OBJECT(client),"die",
164
GTK_SIGNAL_FUNC(KillSession),NULL);
169
if(scsi_device) printf("scsi=[%s]\n",scsi_device);
171
/* Start a new Grip app */
172
grip_app=GripNew(geometry,device,scsi_device,force_small,local_mode,
175
gtk_widget_show(grip_app);
177
gtk_timeout_add(1000,TimeOut,0);
184
/* Save the session */
185
static gint SaveSession(GnomeClient *client, gint phase,
186
GnomeSaveStyle save_style,
187
gint is_shutdown, GnomeInteractStyle interact_style,
188
gint is_fast, gpointer client_data)
193
/* allocate 0-filled, so it will be NULL-terminated */
194
argv = g_malloc0(sizeof(gchar*)*4);
197
argv[0] = client_data;
199
gnome_client_set_clone_command(client, argc, argv);
200
gnome_client_set_restart_command(client, argc, argv);
206
static gint KillSession(GnomeClient* client, gpointer client_data)
213
static gint TimeOut(gpointer data)
215
GripUpdate(grip_app);