1
/* MDB Tools - A library for reading MS Access database file
2
* Copyright (C) 2000-2004 Brian Bruns
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.
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.
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
19
#include <libgnome/gnome-help.h>
20
#include <glade/glade.h>
27
GladeXML *mainwin_xml;
30
/* called when the user closes the window */
32
delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
34
/* signal the main loop to quit */
36
/* return FALSE to continue closing the window */
42
gmdb_about_cb(GtkWidget *button, gpointer data)
44
const gchar *authors[] = {
48
const gchar *documenters[] = {
54
pixbuf = gdk_pixbuf_new_from_file (GMDB_ICONDIR "logo.xpm", NULL);
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,
67
gmdb_prefs_cb(GtkWidget *button, gpointer data)
72
gmdb_info_cb(GtkWidget *button, gpointer data)
78
/* a callback for the buttons */
80
a_callback(GtkWidget *button, gpointer data)
83
/*just print a string so that we know we got there*/
84
g_print("Inside Callback\n");
87
gmdb_help_cb(GtkWidget *button, gpointer data)
91
gnome_help_display("gmdb.xml", NULL, &error);
93
g_warning (error->message);
99
void gmdb_load_recent_files()
102
GtkWidget *menulabel;
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);
115
gtk_widget_hide(menuitem);
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);
128
gmdb_load_icons(GladeXML *xml)
132
GValue value = { 0, };
157
icon = glade_xml_get_widget (xml, icons[i]);
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);
167
int main(int argc, char *argv[])
170
GnomeProgram *program;
173
/* initialize the SQL engine */
174
sql = mdb_sql_init();
176
/* initialize MDB Tools library */
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,
188
//gnome_init ("gmdb", "0.2", argc, argv);
189
//app = gnome_app_new ("gmdb", "Gnome-MDB File Viewer");
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);
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);
201
//gmdb_load_icons(mainwin_xml);
204
gmdb_file_open(argv[1]);
207
gmdb_load_recent_files();
209
/* start the event loop */
213
/* free MDB Tools library */