File: balsa-initdruid.c

package info (click to toggle)
balsa 2.3.13-3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 16,032 kB
  • ctags: 7,261
  • sloc: ansic: 79,348; sh: 8,731; xml: 4,721; makefile: 485; awk: 60
file content (91 lines) | stat: -rw-r--r-- 3,061 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
/* Balsa E-Mail Client
 * Copyright (C) 1997-2002 Stuart Parmenter and others,
 *                         See the file AUTHORS for a list.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option) 
 * any later version.
 *  
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
 * GNU General Public License for more details.
 *  
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
 * 02111-1307, USA.
 */

#include "balsa-initdruid.h"

#include "i18n.h"
#include "libbalsa-conf.h"
#include "save-restore.h"

#include "balsa-druid-page-welcome.h"
#include "balsa-druid-page-user.h"
#include "balsa-druid-page-directory.h"
#include "balsa-druid-page-defclient.h"
#include "balsa-druid-page-finish.h"

/* here are local prototypes */
static void balsa_initdruid_init(GnomeDruid * druid);
static void balsa_initdruid_cancel(GnomeDruid * druid);

static void
balsa_initdruid_init(GnomeDruid * druid)
{
    GdkPixbuf *default_logo = balsa_init_get_png("balsa-logo.png");

    balsa_druid_page_welcome(druid, default_logo);
    balsa_druid_page_user(druid, default_logo);
#if !defined(ENABLE_TOUCH_UI)
    balsa_druid_page_directory(druid, default_logo);
    balsa_druid_page_defclient(druid, default_logo);
#endif
    balsa_druid_page_finish(druid, default_logo);
}

void
balsa_initdruid(GtkWindow * window)
{
    GnomeDruid *druid;

    g_return_if_fail(window != NULL);
    g_return_if_fail(GTK_IS_WINDOW(window));

    druid = GNOME_DRUID(gnome_druid_new());
    gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(druid));
    g_signal_connect(G_OBJECT(druid), "cancel",
                     G_CALLBACK(balsa_initdruid_cancel), NULL);
    g_signal_connect(G_OBJECT(druid), "destroy",
                     G_CALLBACK(exit), NULL);
    g_object_ref(G_OBJECT(window));

    balsa_initdruid_init(druid);
}

static void
balsa_initdruid_cancel(GnomeDruid * druid)
{
    GtkWidget *dialog =
        gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_ancestor
                                          (GTK_WIDGET(druid), 
                                           GTK_TYPE_WINDOW)),
                               GTK_DIALOG_MODAL,
                               GTK_MESSAGE_QUESTION,
                               GTK_BUTTONS_YES_NO,
                               _("This will exit Balsa.\n"
                                 "Do you really want to do this?"));
    GtkResponseType reply = 
        gtk_dialog_run(GTK_DIALOG(dialog));
    gtk_widget_destroy(dialog);

    if (reply == GTK_RESPONSE_YES) {
        libbalsa_conf_drop_all();
        exit(0);
    }
}