~ubuntu-branches/ubuntu/oneiric/mdbtools/oneiric

« back to all changes in this revision

Viewing changes to .pc/045-aboutdialog.patch/src/gmdb2/main2.c

  • Committer: Bazaar Package Importer
  • Author(s): Tim Retout
  • Date: 2010-04-18 03:33:23 UTC
  • Revision ID: james.westby@ubuntu.com-20100418033323-j8u1j2b1swymal9j
Tags: 0.5.99.0.6pre1.0.20051109-7
* debian/control:
  + Update maintainer address.
  + Bump Standards-Version to 3.8.4. (No changes needed.)
  + Remove quilt from Build-Depends.
* debian/rules: Remove '--with quilt' dh option.
* debian/source/format: Switch to 3.0 (quilt).
* debian/patches/035-filelocals.patch: Refresh patch.
* debian/patches/070-unixodbc-api.patch: Update for changes to unixodbc
  API. (Closes: #577353)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* MDB Tools - A library for reading MS Access database file
 
2
 * Copyright (C) 2000-2004 Brian Bruns
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
 */
 
18
#include <gnome.h>
 
19
#include <libgnome/gnome-help.h>
 
20
#include <glade/glade.h>
 
21
#include <mdbtools.h>
 
22
#include <mdbver.h>
 
23
#include <mdbsql.h>
 
24
#include "gmdb.h"
 
25
 
 
26
GtkWidget *app;
 
27
GladeXML *mainwin_xml;
 
28
MdbSQL *sql;
 
29
 
 
30
/* called when the user closes the window */
 
31
static gint
 
32
delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
 
33
{
 
34
        /* signal the main loop to quit */
 
35
        gtk_main_quit();
 
36
        /* return FALSE to continue closing the window */
 
37
        return FALSE;
 
38
}
 
39
 
 
40
 
 
41
void
 
42
gmdb_about_cb(GtkWidget *button, gpointer data)
 
43
{
 
44
const gchar *authors[] = {
 
45
        "Brian Bruns",
 
46
        NULL
 
47
};
 
48
const gchar *documenters[] = {
 
49
        "Brian Bruns",
 
50
        NULL
 
51
};
 
52
GdkPixbuf *pixbuf;
 
53
 
 
54
pixbuf = gdk_pixbuf_new_from_file (GMDB_ICONDIR "logo.xpm", NULL);
 
55
 
 
56
gtk_widget_show (gnome_about_new ("Gnome MDB Viewer", MDB_VERSION_NO,
 
57
                 "Copyright 2002-2004 Brian Bruns",
 
58
                 _("The Gnome-MDB Viewer is the grapical interface to "
 
59
                   "MDB Tools.  It lets you view and export data and schema"
 
60
                   "from MDB files produced by MS Access 97/2000/XP."),
 
61
                  (const gchar **) authors,
 
62
                  (const gchar **) documenters,
 
63
                   NULL,
 
64
                   pixbuf));
 
65
}
 
66
void
 
67
gmdb_prefs_cb(GtkWidget *button, gpointer data)
 
68
{
 
69
        gmdb_prefs_new();
 
70
}
 
71
void
 
72
gmdb_info_cb(GtkWidget *button, gpointer data)
 
73
{
 
74
        gmdb_info_new();
 
75
}
 
76
 
 
77
 
 
78
/* a callback for the buttons */
 
79
static void
 
80
a_callback(GtkWidget *button, gpointer data)
 
81
{
 
82
 
 
83
                /*just print a string so that we know we got there*/
 
84
                g_print("Inside Callback\n");
 
85
}
 
86
void
 
87
gmdb_help_cb(GtkWidget *button, gpointer data)
 
88
{
 
89
        GError *error = NULL;
 
90
 
 
91
        gnome_help_display("gmdb.xml", NULL, &error);
 
92
        if (error != NULL) {
 
93
                g_warning (error->message);
 
94
                g_error_free (error);
 
95
        }
 
96
 
 
97
}
 
98
 
 
99
void gmdb_load_recent_files()
 
100
{
 
101
GtkWidget *menuitem;
 
102
GtkWidget *menulabel;
 
103
char menuname[100];
 
104
char cfgname[100];
 
105
int i;
 
106
gchar *text, *text2;
 
107
 
 
108
        for (i=4;i>=1;i--) {    
 
109
                sprintf(menuname, "menu_recent%d",i);
 
110
                sprintf(cfgname, "/gmdb/RecentFiles/menu_recent%d.basename",i);
 
111
                menuitem = glade_xml_get_widget (mainwin_xml, menuname);
 
112
                menulabel = gtk_bin_get_child(GTK_BIN(menuitem));
 
113
                text = gnome_config_get_string(cfgname);
 
114
                if (!text) {
 
115
                        gtk_widget_hide(menuitem);
 
116
                } else {
 
117
                        text2 = g_malloc(strlen(text)+4);
 
118
                        sprintf(text2,"%d. %s",i,text);
 
119
                        gtk_label_set_text(GTK_LABEL(menulabel),text2);
 
120
                        gtk_widget_show(menuitem);
 
121
                        g_free(text2);
 
122
                }
 
123
                g_free(text);
 
124
        }
 
125
}
 
126
 
 
127
static void
 
128
gmdb_load_icons(GladeXML *xml)
 
129
{
 
130
        GtkWidget *icon;
 
131
        char file[256];
 
132
        GValue value = { 0, };
 
133
        int i = 0;
 
134
 
 
135
        char *icons[] = {
 
136
                "table_icon",
 
137
                "query_icon",
 
138
                "form_icon",
 
139
                "report_icon",
 
140
                "macro_icon",
 
141
                "module_icon",
 
142
                "debug_icon",
 
143
                NULL
 
144
        };
 
145
        char *files[] = {
 
146
                "table.xpm",
 
147
                "query.xpm",
 
148
                "forms.xpm",
 
149
                "reports.xpm",
 
150
                "macros.xpm",
 
151
                "code.xpm",
 
152
                "debug.xpm",
 
153
                NULL
 
154
        };
 
155
 
 
156
        while (icons[i]) {
 
157
                icon =  glade_xml_get_widget (xml, icons[i]); 
 
158
 
 
159
                g_value_init (&value, G_TYPE_STRING);
 
160
                g_snprintf(file,256,"%s%s", GMDB_ICONDIR, files[i]); 
 
161
                g_value_set_static_string (&value, file);
 
162
                g_object_set_property (G_OBJECT (icon), "file" , &value);
 
163
                g_value_unset (&value);
 
164
                i++;
 
165
        }
 
166
}
 
167
int main(int argc, char *argv[]) 
 
168
{
 
169
GtkWidget *gmdb;
 
170
GnomeProgram *program;
 
171
 
 
172
#ifdef SQL
 
173
        /* initialize the SQL engine */
 
174
        sql = mdb_sql_init();
 
175
#endif
 
176
        /* initialize MDB Tools library */
 
177
        mdb_init();
 
178
 
 
179
        /* Initialize GNOME */
 
180
               /* Initialize gnome program */
 
181
        program = gnome_program_init ("gmdb", "0.2",
 
182
                LIBGNOMEUI_MODULE, argc, argv,
 
183
                GNOME_PARAM_POPT_TABLE, NULL,
 
184
                GNOME_PARAM_HUMAN_READABLE_NAME,
 
185
                _("Gnome-MDB File Viewer"),
 
186
                GNOME_PARAM_APP_DATADIR, DATADIR,
 
187
                NULL);
 
188
        //gnome_init ("gmdb", "0.2", argc, argv);
 
189
        //app = gnome_app_new ("gmdb", "Gnome-MDB File Viewer");
 
190
        glade_init();
 
191
 
 
192
        /* load the interface */
 
193
        mainwin_xml = glade_xml_new(GMDB_GLADEDIR "gmdb.glade", NULL, NULL);
 
194
        /* connect the signals in the interface */
 
195
        glade_xml_signal_autoconnect(mainwin_xml);
 
196
 
 
197
        gmdb = glade_xml_get_widget (mainwin_xml, "gmdb");
 
198
        gtk_signal_connect (GTK_OBJECT (gmdb), "delete_event",
 
199
                GTK_SIGNAL_FUNC (delete_event), NULL);
 
200
 
 
201
        //gmdb_load_icons(mainwin_xml);
 
202
 
 
203
        if (argc>1) {
 
204
                gmdb_file_open(argv[1]);
 
205
        }
 
206
 
 
207
        gmdb_load_recent_files();
 
208
 
 
209
        /* start the event loop */
 
210
        gtk_main();
 
211
 
 
212
#ifdef SQL
 
213
        /* free MDB Tools library */
 
214
        mdb_sql_exit(sql);
 
215
#endif
 
216
        mdb_exit();
 
217
 
 
218
        return 0;
 
219
}