File: main.c

package info (click to toggle)
ripperx 2.7.2-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,256 kB
  • ctags: 609
  • sloc: sh: 10,579; ansic: 6,939; makefile: 145
file content (75 lines) | stat: -rw-r--r-- 1,591 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifdef HAVE_CONFIG_H
#  include "config.h"
#endif

#ifdef ENABLE_NLS
#include <glib/gi18n.h>
#else
#define _(a) (a)
#define N_(a) (a)
#endif

#include "interface_common.h"
#include "main_window_handler.h"
#include "err_dialog_handler.h"
#include "job_control.h"
#include "config_rw.h"

#include "main.h"
#include "version.h"

void ripperX_init( _main_data *main_data );

/* Global variable */
_config config;
int where_now;


void ripperX_init( _main_data *main_data )
{
	memset( main_data, 0, sizeof( _main_data ) );
	read_config();
	main_window_handler( WIDGET_CREATE, 0, main_data );
	return;
}


void ripperX_exit( GtkWidget *widget, gpointer callback_data )
{
	if ( where_now == STATUS_FRAME ) {
		job_controller( JC_PAUSE, NULL );

		/* Confirm */
		if ( dialog_handler( WIDGET_CREATE, FALSE, DL_ABORT_CONFIRM,
			                     FALSE, NULL, NULL, 0 ) == FALSE ) {
			job_controller( JC_CONT, NULL );
			return;
		}

		/* Terminate current job */
		if ( dialog_handler( WIDGET_CREATE, FALSE, DL_DELETE_ON_ABORT,
			                     FALSE, NULL, NULL, 0 ) == TRUE )
			job_controller( JC_ABORT_ALL_DELETE, NULL );
		else
			job_controller( JC_ABORT_ALL, NULL );
	}

	main_window_handler( WIDGET_DESTROY, NULL, NULL );
	gtk_main_quit();
}

int main( int argc, char *argv[] )
{
	_main_data main_data;
	gtk_set_locale();
	gtk_init( &argc, &argv );
	setlocale(LC_NUMERIC, "POSIX");
#ifdef ENABLE_NLS
	bindtextdomain(PACKAGE, LOCALEDIR);
	bind_textdomain_codeset(PACKAGE, "UTF-8");
	textdomain(PACKAGE);
#endif /*ENABLE_NLS*/
	ripperX_init( &main_data );
	gtk_main();
	return 0;
}