3
* Copyright (c) 1998-2004 Mike Oliphant <grip@nostatic.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
29
static gint KillSession(GnomeClient* client, gpointer client_data);
30
static gint SaveSession(GnomeClient *client, gint phase,
31
GnomeSaveStyle save_style,
32
gint is_shutdown, GnomeInteractStyle interact_style,
33
gint is_fast, gpointer client_data);
34
static gint TimeOut(gpointer data);
36
gboolean do_debug=TRUE;
40
static char *geometry=NULL;
41
static char *config_filename=NULL;
42
static char *device=NULL;
43
static char *scsi_device=NULL;
44
static int force_small=FALSE;
45
static int local_mode=FALSE;
46
static int no_redirect=FALSE;
47
static int verbose=FALSE;
49
struct poptOption options[] = {
56
N_("Specify the geometry of the main window"),
65
N_("Specify the config file to use (in your home dir)"),
74
N_("Specify the cdrom device to use"),
83
N_("Specify the generic scsi device to use"),
92
N_("Launch in \"small\" (cd-only) mode"),
101
N_("\"Local\" mode -- do not look up disc info on the net"),
110
N_("Do not do I/O redirection"),
119
N_("Run in verbose (debug) mode"),
133
void Debug(char *fmt,...)
141
msg=g_strdup_vprintf(fmt,args);
151
int Cmain(int argc, char* argv[])
155
/* Unbuffer stdout */
156
setvbuf(stdout, 0, _IONBF, 0);
158
/* setup locale, i18n */
160
bindtextdomain(GETTEXT_PACKAGE,GNOMELOCALEDIR);
161
textdomain(GETTEXT_PACKAGE);
163
gnome_program_init(PACKAGE,VERSION,LIBGNOMEUI_MODULE,argc,argv,
164
GNOME_PARAM_POPT_TABLE,options,
165
GNOME_PROGRAM_STANDARD_PROPERTIES,NULL);
167
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF8");
168
setenv("CHARSET","UTF-8",1);
170
/* Session Management */
172
client=gnome_master_client();
173
gtk_signal_connect(GTK_OBJECT(client),"save_yourself",
174
GTK_SIGNAL_FUNC(SaveSession),argv[0]);
175
gtk_signal_connect(GTK_OBJECT(client),"die",
176
GTK_SIGNAL_FUNC(KillSession),NULL);
181
if(scsi_device) printf("scsi=[%s]\n",scsi_device);
183
/* Start a new Grip app */
184
grip_app=GripNew(geometry,device,scsi_device,config_filename,
185
force_small,local_mode,
188
gtk_widget_show(grip_app);
190
gtk_timeout_add(1000,TimeOut,0);
197
/* Save the session */
198
static gint SaveSession(GnomeClient *client, gint phase,
199
GnomeSaveStyle save_style,
200
gint is_shutdown, GnomeInteractStyle interact_style,
201
gint is_fast, gpointer client_data)
206
/* allocate 0-filled, so it will be NULL-terminated */
207
argv = g_malloc0(sizeof(gchar*)*4);
210
argv[0] = client_data;
212
gnome_client_set_clone_command(client, argc, argv);
213
gnome_client_set_restart_command(client, argc, argv);
219
static gint KillSession(GnomeClient* client, gpointer client_data)
226
static gint TimeOut(gpointer data)
228
GripUpdate(grip_app);