lots more gmdb2 stuff, converted table export to glade, added schema export, toolbars, properties window to glade, et al.

This commit is contained in:
brianb
2002-12-30 16:38:47 +00:00
parent feddbece22
commit 3c0d61076d
18 changed files with 1969 additions and 919 deletions

View File

@@ -1,9 +1,9 @@
bin_PROGRAMS = gmdb2
include_HEADERS = gmdb.h debug.xpm forms.xpm macros.xpm pk.xpm \
table.xpm query.xpm code.xpm reports.xpm
gmdb2_SOURCES = main2.c file.c util.c table.c query.c module.c macro.c report.c form.c info.c table_def.c table_data.c table_export.c debug.c
LIBS = -rdynamic $(GNOME_LIBS) $(GLADE_LIBS) @LEXLIB@
INCLUDES = -I$(top_srcdir)/include $(GNOME_CFLAGS) $(GLADE_CFLAGS)
gmdb2_SOURCES = main2.c file.c util.c table.c query.c module.c macro.c report.c form.c info.c table_def.c table_data.c table_export.c debug.c sql.c schema.c
LIBS = -rdynamic $(GNOME_LIBS) @LEXLIB@
INCLUDES = -I$(top_srcdir)/include $(GNOME_CFLAGS)
#LDADD = ../libmdb/libmdb.la
LDADD = ../libmdb/libmdb.la ../sql/libmdbsql.la
#if SQL

View File

@@ -7,31 +7,12 @@ GladeXML *debugwin_xml;
#define LINESZ 77
typedef struct GMdbDebugTab {
GtkWidget *ctree;
GtkWidget *textbox;
GtkWidget *entry;
GtkWidget *pglabel;
int page_num;
int max_page;
int linesz;
GdkFont *font;
GdkColor black;
GdkColor white;
} GMdbDebugTab;
typedef struct GMdbDebugRange {
gint start_byte;
gint end_byte;
} GMdbDebugRange;
GMdbDebugTab *dbug;
/* prototypes */
void gmdb_debug_text_on(GtkWidget *textbox, int start_byte, int end_byte);
void gmdb_debug_text_off(GtkWidget *textbox, int start_byte, int end_byte);
static void gmdb_debug_init(MdbHandle *mdb, GladeXML *xml);
static void gmdb_debug_text_on(GtkWidget *textbox, int start_byte, int end_byte);
static void gmdb_debug_text_off(GtkWidget *textbox);
GtkTreeIter *gmdb_debug_add_item(GtkTreeStore *store, GtkTreeIter *iter, gchar *text, int start, int end);
void gmdb_debug_clear(GMdbDebugTab *dbug);
static void gmdb_debug_clear(GladeXML *xml);
void gmdb_debug_dissect(GtkTreeStore *store, char *fbuf, int offset, int len);
static guint16 get_uint16(unsigned char *c);
static guint32 get_uint24(unsigned char *c);
@@ -45,8 +26,8 @@ typedef struct GMdbValStr {
} GMdbValStr;
GMdbValStr table_types[] = {
{ 0x4e, "System Table" },
{ 0x53, "User Table" },
{ 0x4e, "User Table" },
{ 0x53, "System Table" },
{ 0, NULL }
};
GMdbValStr column_types[] = {
@@ -76,105 +57,67 @@ GMdbValStr object_types[] = {
};
/* callbacks */
void
gmdb_debug_select_cb(GtkCTree *tree, GList *node, gint column, GMdbDebugTab *dbug)
gmdb_debug_select_cb(GtkTreeSelection *select, GladeXML *xml)
{
GMdbDebugRange *range;
int start_row, end_row;
int start_col, end_col;
int i;
GtkTreeIter iter;
GtkTreeModel *model;
gchar *fieldname;
gint32 start, end;
GtkWidget *textview;
range = gtk_ctree_node_get_row_data(tree, GTK_CTREE_NODE(node));
/* container node or otherwise non-represented in the data */
if (range->start_byte == -1 || range->end_byte == -1) return;
if (!select) return;
start_row = range->start_byte / 16;
end_row = range->end_byte / 16;
start_col = 8 + (range->start_byte % 16) * 3;
end_col = 8 + (range->end_byte % 16) * 3;
/* freeze/thaw needed because of redrawing glitch...only part of text had
** correct colors, rest would come back on resize. */
/*
gtk_text_freeze(GTK_TEXT(dbug->textbox));
*/
if (start_row == end_row) {
gmdb_debug_text_on(dbug->textbox,
dbug->linesz * start_row + start_col,
dbug->linesz * start_row + end_col + 2);
gmdb_debug_text_on(dbug->textbox,
dbug->linesz * start_row + 59 + (range->start_byte % 16),
dbug->linesz * start_row + 59 + (range->end_byte % 16) + 1);
} else {
gmdb_debug_text_on(dbug->textbox,
dbug->linesz * start_row + start_col,
/* 55 = 8 (addr) + 15 (bytes) * 3 (%02x " ") + 2 (last byte) */
dbug->linesz * start_row + 55);
gmdb_debug_text_on(dbug->textbox,
dbug->linesz * start_row + 59 + (range->start_byte % 16),
dbug->linesz * start_row + 75);
for (i=start_row + 1; i < end_row; i++) {
gmdb_debug_text_on(dbug->textbox,
dbug->linesz * i + 8, dbug->linesz * i + 55);
gmdb_debug_text_on(dbug->textbox,
dbug->linesz * i + 59, dbug->linesz * i + 75);
}
gmdb_debug_text_on(dbug->textbox,
dbug->linesz * end_row + 8,
dbug->linesz * end_row + end_col + 2);
gmdb_debug_text_on(dbug->textbox,
dbug->linesz * end_row + 59,
dbug->linesz * end_row + 59 + (range->end_byte % 16) + 1);
if (gtk_tree_selection_get_selected (select, &model, &iter)) {
gtk_tree_model_get (model, &iter, 0, &fieldname,
1, &start,
2, &end, -1);
g_free (fieldname);
}
/* gtk_text_thaw(GTK_TEXT(dbug->textbox)); */
}
void
gmdb_debug_unselect_cb(GtkCTree *tree, GList *node, gint column, GMdbDebugTab *dbug)
{
GMdbDebugRange *range;
int start_row, end_row;
int start_col, end_col;
int i;
range = gtk_ctree_node_get_row_data(tree, GTK_CTREE_NODE(node));
/* container node or otherwise non-represented in the data */
if (range->start_byte == -1 || range->end_byte == -1) return;
if (start == -1 || end == -1) return;
start_row = range->start_byte / 16;
end_row = range->end_byte / 16;
start_col = 8 + (range->start_byte % 16) * 3;
end_col = 8 + (range->end_byte % 16) * 3;
start_row = start / 16;
end_row = end / 16;
start_col = 8 + (start % 16) * 3;
end_col = 8 + (end % 16) * 3;
textview = glade_xml_get_widget (xml, "debug_textview");
gmdb_debug_text_off(textview);
if (start_row == end_row) {
gmdb_debug_text_off(dbug->textbox,
dbug->linesz * start_row + start_col,
dbug->linesz * start_row + end_col + 2);
gmdb_debug_text_off(dbug->textbox,
dbug->linesz * start_row + 59 + (range->start_byte % 16),
dbug->linesz * start_row + 59 + (range->end_byte % 16) + 1);
gmdb_debug_text_on(textview,
LINESZ * start_row + start_col,
LINESZ * start_row + end_col + 2);
gmdb_debug_text_on(textview,
LINESZ * start_row + 59 + (start % 16),
LINESZ * start_row + 59 + (end % 16) + 1);
} else {
gmdb_debug_text_off(dbug->textbox,
dbug->linesz * start_row + start_col,
gmdb_debug_text_on(textview,
LINESZ * start_row + start_col,
/* 55 = 8 (addr) + 15 (bytes) * 3 (%02x " ") + 2 (last byte) */
dbug->linesz * start_row + 55);
gmdb_debug_text_off(dbug->textbox,
dbug->linesz * start_row + 59 + (range->start_byte % 16),
dbug->linesz * start_row + 75);
LINESZ * start_row + 55);
gmdb_debug_text_on(textview,
LINESZ * start_row + 59 + (start % 16),
LINESZ * start_row + 75);
for (i=start_row + 1; i < end_row; i++) {
gmdb_debug_text_off(dbug->textbox,
dbug->linesz * i + 8, dbug->linesz * i + 55);
gmdb_debug_text_off(dbug->textbox,
dbug->linesz * i + 59, dbug->linesz * i + 75);
gmdb_debug_text_on(textview,
LINESZ * i + 8, LINESZ * i + 55);
gmdb_debug_text_on(textview,
LINESZ * i + 59, LINESZ * i + 75);
}
gmdb_debug_text_off(dbug->textbox,
dbug->linesz * end_row + 8,
dbug->linesz * end_row + end_col + 2);
gmdb_debug_text_off(dbug->textbox,
dbug->linesz * end_row + 59,
dbug->linesz * end_row + 59 + (range->end_byte % 16) + 1);
gmdb_debug_text_on(textview,
LINESZ * end_row + 8,
LINESZ * end_row + end_col + 2);
gmdb_debug_text_on(textview,
LINESZ * end_row + 59,
LINESZ * end_row + 59 + (end % 16) + 1);
}
}
void
gmdb_debug_display_cb(GtkWidget *w, gpointer *dbug)
gmdb_debug_display_cb(GtkWidget *w, GladeXML *xml)
{
int page;
off_t pos;
@@ -189,17 +132,18 @@ GtkTextIter iter;
GtkWidget *entry;
GtkTextView *textview;
if (!mdb) return;
entry = glade_xml_get_widget (debugwin_xml, "debug_entry");
textview = glade_xml_get_widget (debugwin_xml, "debug_textview");
entry = glade_xml_get_widget (xml, "debug_entry");
textview = glade_xml_get_widget (xml, "debug_textview");
page = atol(gtk_entry_get_text(GTK_ENTRY(entry)));
if (page>gmdb_get_max_page(mdb) || page<0) {
gmdb_info_msg("Page entered is outside valid page range.");
}
// gmdb_debug_clear(dbug);
gmdb_debug_clear(xml);
pos = lseek(mdb->fd, 0, SEEK_CUR);
lseek(mdb->fd, page * mdb->pg_size, SEEK_SET);
@@ -228,24 +172,16 @@ GtkTextView *textview;
strcat(line, "|\n");
i += 16;
strcat(tbuf, line);
//if (!dbug->linesz) dbug->linesz = strlen(line);
}
buffer = gtk_text_view_get_buffer(textview);
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
gtk_text_buffer_insert(buffer,&iter,tbuf,strlen(tbuf));
//gtk_editable_select_region(GTK_EDITABLE(dbug->textbox), 9, 15);
GtkWidget *tree = glade_xml_get_widget(debugwin_xml, "debug_treeview");
GtkTreeStore *store = gtk_tree_store_new(1, G_TYPE_STRING);
gmdb_debug_dissect(store, fbuf, 0, length);
gtk_tree_view_set_model(GTK_TREE_VIEW(tree), store);
GtkWidget *tree = glade_xml_get_widget(xml, "debug_treeview");
GtkTreeView *store = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));
gmdb_debug_dissect(store, fbuf, 0, length);
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes("Field",
renderer, "text", 0, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW (tree), column);
free(fbuf);
free(tbuf);
}
@@ -346,7 +282,7 @@ void
gmdb_debug_add_page_ptr(GtkTreeStore *store, GtkTreeIter *parent, char *fbuf, const char *label, int offset)
{
gchar str[100];
GtkCTreeNode *node;
GtkTreeIter *node;
snprintf(str, 100, "%s", label);
node = gmdb_debug_add_item(store, parent, str, offset, offset+3);
@@ -453,35 +389,22 @@ gchar str[100];
}
}
gmdb_clear_node_cb(GtkWidget *ctree, GtkCTreeNode *node, gpointer data)
static void
gmdb_debug_clear(GladeXML *xml)
{
gpointer rowdata;
rowdata = gtk_ctree_node_get_row_data(GTK_CTREE(ctree), node);
g_free(rowdata);
gtk_ctree_remove_node(GTK_CTREE(ctree), node);
}
void
gmdb_debug_clear(GMdbDebugTab *dbug)
{
GtkCTreeNode *node;
gpointer data;
GtkTextBuffer *buffer;
GtkWidget *treeview, *textview, *store;
textview = glade_xml_get_widget (xml, "debug_textview");
treeview = glade_xml_get_widget (xml, "debug_treeview");
store = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
/* clear the tree */
gtk_ctree_post_recursive(dbug->ctree, NULL, gmdb_clear_node_cb, NULL);
/*
node = gtk_ctree_node_nth(GTK_CTREE(dbug->ctree), 0);
data = gtk_ctree_node_get_row_data(GTK_CTREE(dbug->ctree), node);
g_free(data);
gtk_ctree_remove_node(GTK_CTREE(dbug->ctree), node);
*/
gtk_tree_store_clear(GTK_TREE_STORE(store));
/* call delete text last because remove_node fires unselect signal */
//gtk_editable_delete_text(GTK_EDITABLE(dbug->textbox),0, -1);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dbug->textbox));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
gtk_text_buffer_set_text(buffer, "", 0);
}
@@ -489,28 +412,16 @@ GtkTextBuffer *buffer;
GtkTreeIter *
gmdb_debug_add_item(GtkTreeStore *store, GtkTreeIter *iter1, gchar *text, int start, int end)
{
gchar *nodetext[2];
GtkCTreeNode *node;
GMdbDebugRange *range;
GtkTreeIter *iter2;
iter2 = g_malloc(sizeof(GtkTreeIter));
gtk_tree_store_append(store, iter2, iter1);
gtk_tree_store_set(store, iter2, 0, text, -1);
#if 0
nodetext[0] = text;
nodetext[1] = "0";
node = gtk_ctree_insert_node(GTK_CTREE(dbug->ctree), parent, NULL, nodetext, 0, NULL, NULL, NULL, NULL, FALSE, FALSE);
range = g_malloc(sizeof(GMdbDebugRange));
range->start_byte = start;
range->end_byte = end;
gtk_ctree_node_set_row_data(GTK_CTREE(dbug->ctree), node, range);
#endif
gtk_tree_store_set(store, iter2, 0, text, 1, start, 2, end, -1);
return iter2;
}
void
static void
gmdb_debug_text_on(GtkWidget *textbox,
int start_byte, int end_byte)
{
@@ -528,18 +439,18 @@ GtkTextIter start, end;
gtk_text_buffer_get_iter_at_offset (buffer, &start, start_byte);
gtk_text_buffer_get_iter_at_offset (buffer, &end, end_byte);
gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(dbug->textbox),
gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(textbox),
&start, 0.0, FALSE, 0.0, 0.0);
gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
}
static void
gmdb_debug_text_off(GtkWidget *textbox,
int start_byte, int end_byte)
gmdb_debug_text_off(GtkWidget *textbox)
{
gchar *text;
GtkTextBuffer *buffer;
GtkTextTag *tag;
int end_byte;
GtkTextIter start, end;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textbox));
@@ -549,158 +460,64 @@ GtkTextIter start, end;
tag = gtk_text_buffer_create_tag (buffer, NULL,
"background", "white", NULL);
gtk_text_buffer_get_iter_at_offset (buffer, &start, start_byte);
end_byte = gtk_text_buffer_get_char_count(buffer);
gtk_text_buffer_get_iter_at_offset (buffer, &start, 0);
gtk_text_buffer_get_iter_at_offset (buffer, &end, end_byte);
gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
}
#if 0
void
gmdb_debug_tab_new(GtkWidget *notebook)
gint
gmdb_debug_delete_cb(GtkWidget *w, GladeXML *xml)
{
GtkWidget *tabbox;
GtkWidget *label;
GtkWidget *label1;
GtkWidget *button;
GtkWidget *pixmapwid;
GtkWidget *frame;
GtkWidget *hbox;
GtkWidget *hpane;
GtkWidget *vbox;
GtkWidget *scroll;
GtkWidget *scroll2;
GdkPixmap *pixmap;
GdkBitmap *mask;
GdkColormap *cmap;
dbug = g_malloc0(sizeof(GMdbDebugTab));
dbug->max_page = -1;
dbug->font = gdk_font_load("-*-*-medium-r-normal-*-10-*-*-*-m-*-*-*");
cmap = gdk_colormap_get_system();
gdk_color_white(cmap, &dbug->white);
gdk_color_black(cmap, &dbug->black);
vbox = gtk_vbox_new (FALSE,5);
gtk_widget_show (vbox);
hbox = gtk_hbox_new (FALSE,5);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 10);
label1 = gtk_label_new ("Page Number");
gtk_widget_show (label1);
gtk_box_pack_start (GTK_BOX (hbox), label1, FALSE, FALSE, 10);
dbug->pglabel = gtk_label_new (":");
gtk_widget_show (dbug->pglabel);
gtk_box_pack_start (GTK_BOX (hbox), dbug->pglabel, FALSE, FALSE, 0);
dbug->entry = gtk_entry_new ();
gtk_widget_show (dbug->entry);
gtk_box_pack_start (GTK_BOX (hbox), dbug->entry, TRUE, TRUE, 0);
gtk_signal_connect ( GTK_OBJECT (dbug->entry),
"activate", GTK_SIGNAL_FUNC (gmdb_debug_display_cb), dbug);
button = gtk_button_new_with_label ("Display");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_signal_connect ( GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (gmdb_debug_display_cb), dbug);
hpane = gtk_hpaned_new ();
gtk_paned_set_position(GTK_PANED(hpane), 200);
gtk_paned_set_gutter_size(GTK_PANED(hpane), 12);
gtk_widget_show(hpane);
gtk_box_pack_start (GTK_BOX (vbox), hpane, TRUE, TRUE, 10);
scroll = gtk_scrolled_window_new(NULL,NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_widget_show (scroll);
gtk_container_add(GTK_CONTAINER(hpane), scroll);
dbug->ctree = gtk_ctree_new (1, 0);
gtk_widget_show (dbug->ctree);
gtk_container_add (GTK_CONTAINER (scroll), dbug->ctree);
gtk_signal_connect ( GTK_OBJECT (dbug->ctree),
"tree-select-row", GTK_SIGNAL_FUNC (gmdb_debug_select_cb), dbug);
gtk_signal_connect ( GTK_OBJECT (dbug->ctree),
"tree-unselect-row", GTK_SIGNAL_FUNC (gmdb_debug_unselect_cb), dbug);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_container_set_border_width (GTK_CONTAINER (frame), 0);
//gtk_widget_set_usize (frame, 100, 75);
gtk_widget_show (frame);
gtk_container_add (GTK_CONTAINER (hpane), frame);
scroll2 = gtk_scrolled_window_new(NULL,NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll2),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_show (scroll2);
gtk_container_add(GTK_CONTAINER(frame), scroll2);
dbug->textbox = gtk_text_view_new ();
gtk_widget_modify_font(dbug->textbox,
pango_font_description_from_string("Courier"));
gtk_widget_show (dbug->textbox);
gtk_container_add(GTK_CONTAINER(scroll2), dbug->textbox);
/* set selection callback for list */
//gtk_signal_connect ( GTK_OBJECT (table_list),
// "select-child", GTK_SIGNAL_FUNC (gmdb_table_select_cb), NULL);
/* create a picture/label box and use for tab */
tabbox = gtk_hbox_new (FALSE,5);
pixmap = gdk_pixmap_colormap_create_from_xpm_d( NULL,
gtk_widget_get_colormap(app), &mask, NULL, debug_xpm);
/* a pixmap widget to contain the pixmap */
pixmapwid = gtk_pixmap_new( pixmap, mask );
gtk_widget_show( pixmapwid );
gtk_box_pack_start (GTK_BOX (tabbox), pixmapwid, FALSE, TRUE, 0);
label = gtk_label_new ("Debug");
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (tabbox), label, FALSE, TRUE, 0);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, tabbox);
if (mdb) gmdb_debug_init(mdb);
return FALSE;
}
#endif
void
gmdb_debug_close_cb(GtkWidget *w, gpointer *data)
gmdb_debug_close_cb(GtkWidget *w, GladeXML *xml)
{
GtkWidget *w;
w = glade_xml_get_widget (debugwin_xml, "debug_window");
gtk_widget_destroy(w);
GtkWidget *win;
win = glade_xml_get_widget (xml, "debug_window");
if (win) gtk_widget_destroy(win);
}
void
gmdb_debug_new_cb(GtkWidget *w, gpointer *data)
{
GtkTextView *textview;
guint32 page;
GtkWidget *entry, *mi, *button, *debugwin;
gchar text[20];
/* load the interface */
debugwin_xml = glade_xml_new("gladefiles/gmdb-debug.glade", NULL, NULL);
/* connect the signals in the interface */
glade_xml_signal_autoconnect(debugwin_xml);
/* set signals with user data, anyone know how to do this in glade? */
entry = glade_xml_get_widget (debugwin_xml, "debug_entry");
g_signal_connect (G_OBJECT (entry), "activate",
G_CALLBACK (gmdb_debug_display_cb), debugwin_xml);
mi = glade_xml_get_widget (debugwin_xml, "close_menu");
g_signal_connect (G_OBJECT (mi), "activate",
G_CALLBACK (gmdb_debug_close_cb), debugwin_xml);
button = glade_xml_get_widget (debugwin_xml, "debug_button");
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (gmdb_debug_display_cb), debugwin_xml);
debugwin = glade_xml_get_widget (debugwin_xml, "debug_window");
gtk_signal_connect (GTK_OBJECT (debugwin), "delete_event",
GTK_SIGNAL_FUNC (gmdb_debug_delete_cb), debugwin_xml);
/* this should be a preference, needs to be fixed width */
textview = glade_xml_get_widget (debugwin_xml, "debug_textview");
gtk_widget_modify_font(textview,
pango_font_description_from_string("Courier"));
if (mdb) gmdb_debug_init(mdb);
/*
GtkTreeIter iter;
/* set up treeview, libglade only gives us the empty widget */
GtkWidget *tree = glade_xml_get_widget(debugwin_xml, "debug_treeview");
GtkTreeStore *store = gtk_tree_store_new(1, G_TYPE_STRING);
gtk_tree_store_append(store, &iter, NULL);
gtk_tree_store_set(store, &iter, 0, "Test", -1);
gtk_tree_view_set_model(GTK_TREE_VIEW(tree), store);
GtkTreeStore *store = gtk_tree_store_new(3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT);
gtk_tree_view_set_model(GTK_TREE_VIEW(tree), GTK_TREE_MODEL(store));
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
@@ -708,17 +525,33 @@ GtkTextView *textview;
column = gtk_tree_view_column_new_with_attributes("Field",
renderer, "text", 0, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW (tree), column);
*/
GtkTreeSelection *select =
gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE);
g_signal_connect (G_OBJECT (select), "changed",
G_CALLBACK (gmdb_debug_select_cb), debugwin_xml);
/* check if initial page was passed */
if (mdb) {
gmdb_debug_init(mdb, debugwin_xml);
if (data) {
page = *((guint32 *)data);
sprintf(text,"%lu",page);
gtk_entry_set_text(GTK_ENTRY(entry),text);
gmdb_debug_display_cb(w, debugwin_xml);
}
}
}
void gmdb_debug_init(MdbHandle *mdb)
static void gmdb_debug_init(MdbHandle *mdb, GladeXML *xml)
{
struct stat st;
char tmpstr[100];
GtkWidget *pglabel, *entry;
pglabel = glade_xml_get_widget (debugwin_xml, "debug_num_label");
pglabel = glade_xml_get_widget (xml, "debug_num_label");
sprintf(tmpstr, "(0-%d):", gmdb_get_max_page(mdb));
gtk_label_set_text(GTK_LABEL(pglabel), tmpstr);
entry = glade_xml_get_widget (debugwin_xml, "debug_entry");
entry = glade_xml_get_widget (xml, "debug_entry");
gtk_widget_grab_focus(GTK_WIDGET(entry));
}

View File

@@ -38,70 +38,9 @@
<widget class="GtkMenu" id="file1_menu">
<child>
<widget class="GtkImageMenuItem" id="new1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_NEW_ITEM</property>
<property name="label" translatable="yes">_New</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_new1_activate" last_modification_time="Sat, 21 Dec 2002 14:54:43 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separator1">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="close1">
<widget class="GtkImageMenuItem" id="close_menu">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_CLOSE_ITEM</property>
<signal name="activate" handler="gmdb_debug_close_cb" last_modification_time="Sat, 21 Dec 2002 20:42:09 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="edit1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_EDIT_TREE</property>
<child>
<widget class="GtkMenu" id="edit1_menu">
<child>
<widget class="GtkImageMenuItem" id="cut1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_CUT_ITEM</property>
<signal name="activate" handler="on_cut1_activate" last_modification_time="Sat, 21 Dec 2002 14:54:43 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="copy1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_COPY_ITEM</property>
<signal name="activate" handler="on_copy1_activate" last_modification_time="Sat, 21 Dec 2002 14:54:43 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="paste1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_PASTE_ITEM</property>
<signal name="activate" handler="on_paste1_activate" last_modification_time="Sat, 21 Dec 2002 14:54:43 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="clear1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_CLEAR_ITEM</property>
<signal name="activate" handler="on_clear1_activate" last_modification_time="Sat, 21 Dec 2002 14:54:43 GMT"/>
</widget>
</child>
</widget>
@@ -213,7 +152,6 @@
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
<signal name="activate" handler="gmdb_debug_display_cb" after="yes" last_modification_time="Sat, 21 Dec 2002 19:05:15 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
@@ -223,13 +161,12 @@
</child>
<child>
<widget class="GtkButton" id="button4">
<widget class="GtkButton" id="debug_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Display</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<signal name="clicked" handler="gmdb_debug_display_cb" after="yes" last_modification_time="Sat, 21 Dec 2002 18:33:54 GMT"/>
</widget>
<packing>
<property name="padding">0</property>

View File

@@ -0,0 +1,487 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<requires lib="gnome"/>
<widget class="GtkDialog" id="export_dialog">
<property name="visible">True</property>
<property name="title" translatable="yes">dialog1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancelbutton1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-6</property>
<signal name="clicked" handler="gtk_widget_destroy" after="yes" object="export_dialog" last_modification_time="Mon, 30 Dec 2002 13:09:35 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="export_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-5</property>
<signal name="clicked" handler="gmdb_table_export_button_cb" last_modification_time="Mon, 30 Dec 2002 14:44:28 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="label" translatable="yes">_Export</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table1">
<property name="border_width">30</property>
<property name="visible">True</property>
<property name="n_rows">6</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">8</property>
<property name="column_spacing">30</property>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;File Name:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Line Terminator:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Column Separator:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Quotes:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Quote Character:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Options:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCombo" id="term_combo">
<property name="visible">True</property>
<property name="value_in_list">False</property>
<property name="allow_empty">True</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="combo-entry2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="combo-list2">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCombo" id="sep_combo">
<property name="visible">True</property>
<property name="value_in_list">False</property>
<property name="allow_empty">True</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="combo-entry3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="combo-list3">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCombo" id="quote_combo">
<property name="visible">True</property>
<property name="value_in_list">False</property>
<property name="allow_empty">True</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="combo-entry4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="combo-list4">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCombo" id="qchar_combo">
<property name="visible">True</property>
<property name="value_in_list">False</property>
<property name="allow_empty">True</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="combo-entry5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="combo-list5">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="headers_checkbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Include Headers</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GnomeFileEntry" id="fileentry1">
<property name="visible">True</property>
<property name="max_saved">10</property>
<property name="directory_entry">False</property>
<property name="modal">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="filename_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@@ -0,0 +1,304 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkDialog" id="props_dialog">
<property name="visible">True</property>
<property name="title" translatable="yes">dialog1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="vbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="okbutton1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-5</property>
<signal name="clicked" handler="gtk_widget_destroy" object="props_dialog" last_modification_time="Sun, 29 Dec 2002 16:32:29 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table1">
<property name="border_width">10</property>
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">8</property>
<property name="column_spacing">30</property>
<child>
<widget class="GtkLabel" id="props_numpages">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Number of Objects:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Number of Pages:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;File Size:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;JET Version:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;File Name:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">okbutton1</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="props_filename">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="props_filesize">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="props_numobjs">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="props_jetver">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@@ -0,0 +1,422 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<requires lib="gnome"/>
<widget class="GtkDialog" id="schema_dialog">
<property name="visible">True</property>
<property name="title" translatable="yes">Export Schema</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancelbutton1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-6</property>
<signal name="clicked" handler="gtk_widget_destroy" object="schema_dialog" last_modification_time="Sun, 29 Dec 2002 20:59:22 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="okbutton1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-5</property>
<signal name="clicked" handler="gmdb_schema_export_cb" last_modification_time="Sun, 29 Dec 2002 21:00:13 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Export</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table1">
<property name="border_width">33</property>
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">8</property>
<property name="column_spacing">30</property>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Table:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Schema Dialect:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCombo" id="table_combo">
<property name="visible">True</property>
<property name="value_in_list">False</property>
<property name="allow_empty">True</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="combo-entry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="combo-list1">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCombo" id="backend_combo">
<property name="visible">True</property>
<property name="value_in_list">True</property>
<property name="allow_empty">False</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="combo-list2">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
<child>
<widget class="GtkListItem" id="listitem117">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Access</property>
</widget>
</child>
<child>
<widget class="GtkListItem" id="listitem118">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Oracle</property>
</widget>
</child>
<child>
<widget class="GtkListItem" id="listitem119">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Sybase</property>
</widget>
</child>
<child>
<widget class="GtkListItem" id="listitem120">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">MS SQL Server</property>
</widget>
</child>
<child>
<widget class="GtkListItem" id="listitem121">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">PostgreSQL</property>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="rel_checkbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Include Relationships</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Options:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="drop_checkbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Include Drop Table commands</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;File Name:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GnomeFileEntry" id="fileentry1">
<property name="visible">True</property>
<property name="max_saved">10</property>
<property name="directory_entry">False</property>
<property name="modal">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="filename_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@@ -5,8 +5,9 @@
<requires lib="gnome"/>
<requires lib="bonobo"/>
<widget class="GnomeApp" id="app1">
<widget class="GnomeApp" id="sql_window">
<property name="visible">True</property>
<property name="title" translatable="yes">MDB Query Tool</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@@ -78,7 +79,7 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="execute1">
<widget class="GtkImageMenuItem" id="execute_menu">
<property name="visible">True</property>
<property name="label" translatable="yes">_Execute</property>
<property name="use_underline">True</property>
@@ -106,7 +107,7 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="close1">
<widget class="GtkImageMenuItem" id="close_menu">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_CLOSE_ITEM</property>
<signal name="activate" handler="on_close1_activate" last_modification_time="Sat, 21 Dec 2002 15:25:07 GMT"/>
@@ -156,46 +157,11 @@
<signal name="activate" handler="on_clear1_activate" last_modification_time="Sat, 21 Dec 2002 15:25:07 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separator2">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="properties1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_PROPERTIES_ITEM</property>
<signal name="activate" handler="on_properties1_activate" last_modification_time="Sat, 21 Dec 2002 15:25:07 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separator3">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="preferences1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_PREFERENCES_ITEM</property>
<signal name="activate" handler="on_preferences1_activate" last_modification_time="Sat, 21 Dec 2002 15:25:07 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="view1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_VIEW_TREE</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="help1">
<property name="visible">True</property>
@@ -208,7 +174,7 @@
<widget class="GtkImageMenuItem" id="about1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_ABOUT_ITEM</property>
<signal name="activate" handler="on_about1_activate" last_modification_time="Sat, 21 Dec 2002 15:25:07 GMT"/>
<signal name="activate" handler="gmdb_about_cb" last_modification_time="Sat, 28 Dec 2002 17:24:15 GMT"/>
</widget>
</child>
</widget>
@@ -237,13 +203,13 @@
<property name="border_width">1</property>
<property name="visible">True</property>
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
<property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
<property name="toolbar_style">GTK_TOOLBAR_ICONS</property>
<property name="tooltips">True</property>
<child>
<widget class="button" id="button1">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">New Query</property>
<property name="tooltip" translatable="yes">Start new query</property>
<property name="label">gtk-new</property>
<property name="use_stock">True</property>
</widget>
@@ -252,7 +218,7 @@
<child>
<widget class="button" id="button2">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Load Query from File</property>
<property name="tooltip" translatable="yes">Load query from file</property>
<property name="label">gtk-open</property>
<property name="use_stock">True</property>
</widget>
@@ -261,15 +227,16 @@
<child>
<widget class="button" id="button3">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Save Query</property>
<property name="tooltip" translatable="yes">Save query to file</property>
<property name="label">gtk-save</property>
<property name="use_stock">True</property>
</widget>
</child>
<child>
<widget class="button" id="button7">
<widget class="button" id="execute_button">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Execute query</property>
<property name="label">gtk-execute</property>
<property name="use_stock">True</property>
</widget>
@@ -279,8 +246,9 @@
</child>
<child>
<widget class="button" id="button9">
<widget class="button" id="close_button">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Close this window</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
</widget>
@@ -309,24 +277,35 @@
<widget class="GtkHPaned" id="hpaned1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">0</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow2">
<widget class="GtkFrame" id="frame2">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkTreeView" id="treeview2">
<widget class="GtkScrolledWindow" id="scrolledwindow5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="sql_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
</widget>
</child>
</widget>
</child>
</widget>
@@ -343,30 +322,40 @@
<property name="spacing">0</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow3">
<widget class="GtkFrame" id="frame1">
<property name="border_width">4</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkTextView" id="textview1">
<property name="border_width">1</property>
<widget class="GtkScrolledWindow" id="scrolledwindow4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_NONE</property>
<property name="cursor_visible">True</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTextView" id="sql_textview">
<property name="height_request">50</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_NONE</property>
<property name="cursor_visible">True</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
</widget>
</child>
</widget>
</child>
</widget>
@@ -406,7 +395,7 @@
</child>
<child>
<widget class="GtkCombo" id="combo1">
<widget class="GtkCombo" id="sql_combo">
<property name="visible">True</property>
<property name="value_in_list">False</property>
<property name="allow_empty">True</property>
@@ -415,7 +404,8 @@
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="combo-entry1">
<widget class="GtkEntry" id="combo_entry">
<property name="height_request">24</property>
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Recently Executed Querys</property>
<property name="can_focus">True</property>
@@ -463,22 +453,32 @@
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<widget class="GtkFrame" id="frame3">
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkTreeView" id="treeview1">
<widget class="GtkScrolledWindow" id="scrolledwindow6">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="sql_results">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
</widget>
</child>
</widget>
</child>
</widget>

View File

@@ -54,21 +54,8 @@
<child>
<widget class="GtkImageMenuItem" id="information1">
<property name="visible">True</property>
<property name="label" translatable="yes">Information</property>
<property name="use_underline">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_PROPERTIES_ITEM</property>
<signal name="activate" handler="gmdb_info_cb" last_modification_time="Sat, 21 Dec 2002 16:17:18 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image40">
<property name="visible">True</property>
<property name="stock">gtk-dialog-info</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
@@ -78,28 +65,6 @@
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="print1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_PRINT_ITEM</property>
<signal name="activate" handler="a_callback" last_modification_time="Fri, 20 Dec 2002 14:57:20 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="print_setup1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_PRINT_SETUP_ITEM</property>
<signal name="activate" handler="a_callback" last_modification_time="Fri, 20 Dec 2002 16:38:48 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separator5">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="close1">
<property name="visible">True</property>
@@ -180,58 +145,6 @@
<child>
<widget class="GtkMenu" id="edit1_menu">
<child>
<widget class="GtkImageMenuItem" id="cut1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_CUT_ITEM</property>
<signal name="activate" handler="a_callback" last_modification_time="Fri, 20 Dec 2002 16:38:48 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="copy1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_COPY_ITEM</property>
<signal name="activate" handler="a_callback" last_modification_time="Fri, 20 Dec 2002 16:38:48 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="paste1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_PASTE_ITEM</property>
<signal name="activate" handler="a_callback" last_modification_time="Fri, 20 Dec 2002 16:38:48 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="clear1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_CLEAR_ITEM</property>
<signal name="activate" handler="a_callback" last_modification_time="Fri, 20 Dec 2002 16:38:48 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separator2">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="properties1">
<property name="visible">True</property>
<property name="stock_item">GNOMEUIINFO_MENU_PROPERTIES_ITEM</property>
<signal name="activate" handler="a_callback" last_modification_time="Fri, 20 Dec 2002 16:38:48 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separator3">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="preferences1">
<property name="visible">True</property>
@@ -258,7 +171,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">S_QL Window</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_sql_window1_activate" last_modification_time="Fri, 20 Dec 2002 14:17:04 GMT"/>
<signal name="activate" handler="gmdb_sql_new_cb" last_modification_time="Sat, 28 Dec 2002 16:54:54 GMT"/>
<accelerator key="G" modifiers="GDK_CONTROL_MASK" signal="activate"/>
</widget>
</child>
@@ -271,7 +184,7 @@
<signal name="activate" handler="gmdb_debug_new_cb" last_modification_time="Sat, 21 Dec 2002 17:41:42 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image41">
<widget class="GtkImage" id="image49">
<property name="visible">True</property>
<property name="pixbuf">debug.xpm</property>
<property name="xalign">0.5</property>
@@ -288,10 +201,10 @@
<property name="visible">True</property>
<property name="label" translatable="yes">E_xport Schema</property>
<property name="use_underline">True</property>
<signal name="activate" handler="a_callback" last_modification_time="Fri, 20 Dec 2002 16:38:48 GMT"/>
<signal name="activate" handler="gmdb_schema_new_cb" last_modification_time="Sun, 29 Dec 2002 20:35:14 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image42">
<widget class="GtkImage" id="image50">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">1</property>
@@ -354,6 +267,84 @@
</packing>
</child>
<child>
<widget class="BonoboDockItem" id="bonobodockitem2">
<property name="visible">True</property>
<property name="shadow_type">GTK_SHADOW_OUT</property>
<child>
<widget class="GtkToolbar" id="toolbar1">
<property name="border_width">1</property>
<property name="visible">True</property>
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
<property name="toolbar_style">GTK_TOOLBAR_ICONS</property>
<property name="tooltips">True</property>
<child>
<widget class="button" id="button2">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Open an MDB database file</property>
<property name="label">gtk-open</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="gmdb_file_select_cb" last_modification_time="Sun, 29 Dec 2002 03:21:06 GMT"/>
</widget>
</child>
<child>
<widget class="button" id="button3">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">View database file properties</property>
<property name="label">gtk-properties</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="gmdb_info_cb" last_modification_time="Sun, 29 Dec 2002 03:21:29 GMT"/>
</widget>
</child>
<child>
<widget class="button" id="button7">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Close this database</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
</widget>
</child>
<child>
<widget class="button" id="sql_button">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Open SQL query window</property>
<property name="label" translatable="yes">SQL</property>
<property name="use_underline">True</property>
<property name="stock_pixmap">gtk-execute</property>
<signal name="clicked" handler="gmdb_sql_new_cb" last_modification_time="Sun, 29 Dec 2002 03:23:01 GMT"/>
</widget>
<packing>
<property name="new_group">True</property>
</packing>
</child>
<child>
<widget class="button" id="button5">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Export schema definition</property>
<property name="label" translatable="yes">Export Schema</property>
<property name="use_underline">True</property>
<property name="stock_pixmap">gtk-convert</property>
<signal name="clicked" handler="gmdb_schema_new_cb" last_modification_time="Sun, 29 Dec 2002 20:34:50 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="placement">BONOBO_DOCK_TOP</property>
<property name="band">1</property>
<property name="position">0</property>
<property name="offset">0</property>
<property name="behavior">BONOBO_DOCK_ITEM_BEH_EXCLUSIVE</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
@@ -595,7 +586,7 @@
<child>
<widget class="GtkLabel" id="label22">
<property name="visible">True</property>
<property name="label" translatable="yes">label22</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -716,7 +707,7 @@
<child>
<widget class="GtkLabel" id="label24">
<property name="visible">True</property>
<property name="label" translatable="yes">label24</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -837,7 +828,7 @@
<child>
<widget class="GtkLabel" id="label27">
<property name="visible">True</property>
<property name="label" translatable="yes">label27</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -958,7 +949,7 @@
<child>
<widget class="GtkLabel" id="label26">
<property name="visible">True</property>
<property name="label" translatable="yes">label26</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -1079,7 +1070,7 @@
<child>
<widget class="GtkLabel" id="label25">
<property name="visible">True</property>
<property name="label" translatable="yes">label25</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>

View File

@@ -6,6 +6,7 @@
#include <unistd.h>
#include <gtk/gtk.h>
#include <gnome.h>
#include <glade/glade.h>
#ifndef _gmdb_h_
#define _gmdb_h_
@@ -35,7 +36,6 @@ void gmdb_query_populate(MdbHandle *mdb);
void gmdb_report_populate(MdbHandle *mdb);
void gmdb_macro_populate(MdbHandle *mdb);
void gmdb_module_populate(MdbHandle *mdb);
void gmdb_debug_init(MdbHandle *mdb);
void gmdb_table_add_tab(GtkWidget *notebook);
void gmdb_debug_tab_new(GtkWidget *notebook);

View File

@@ -10,79 +10,48 @@ typedef struct GMdbInfoWindow {
GMdbInfoWindow *infow;
/* callbacks */
gint
gmdb_info_dismiss_cb(GtkWidget *w, gpointer data)
{
g_free(infow);
infow = NULL;
return FALSE;
}
void
gmdb_info_add_keyvalue(GtkWidget *table, gint row, gchar *key, gchar *value)
{
GtkWidget *label;
label = gtk_label_new(key);
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT);
gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row+1,
GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 0);
gtk_widget_show(label);
label = gtk_label_new(value);
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
gtk_table_attach(GTK_TABLE(table), label, 1, 2, row, row+1,
GTK_FILL| GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 0);
gtk_widget_show(label);
}
GtkWidget *
gmdb_info_new()
{
GtkWidget *vbox;
GtkWidget *button;
GtkWidget *table;
char tmpstr[20];
GtkWidget *propswin, *label;
GladeXML *propswin_xml;
gchar title[100];
gchar tmpstr[20];
gchar *filename, *filepath;
int i;
struct stat st;
if (infow) {
return infow->window;
}
infow = g_malloc(sizeof(GMdbInfoWindow));
infow->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(infow->window), "File Info");
gtk_widget_set_uposition(infow->window, 300,300);
gtk_widget_show(infow->window);
gtk_signal_connect ( GTK_OBJECT (infow->window),
"destroy", GTK_SIGNAL_FUNC (gmdb_info_dismiss_cb), infow->window);
vbox = gtk_vbox_new(FALSE, 0);
gtk_widget_show(vbox);
gtk_container_add(GTK_CONTAINER(infow->window), vbox);
table = gtk_table_new(3,2,FALSE);
gtk_widget_show(table);
gmdb_info_add_keyvalue(table, 0, "File Name:", mdb->filename);
gmdb_info_add_keyvalue(table, 1, "JET Version:", mdb->jet_version == MDB_VER_JET3 ? "3 (Access 97)" : "4 (Access 2000/XP)");
assert( fstat(mdb->fd, &st)!=-1 );
sprintf(tmpstr, "%ld", st.st_size);
gmdb_info_add_keyvalue(table, 2, "File Size:", tmpstr);
/* load the interface */
propswin_xml = glade_xml_new("gladefiles/gmdb-props.glade", NULL, NULL);
/* connect the signals in the interface */
glade_xml_signal_autoconnect(propswin_xml);
filepath = g_strdup(mdb->filename);
for (i=strlen(filepath);i>0 && filepath[i-1]!='/';i--);
filename=&filepath[i];
propswin = glade_xml_get_widget (propswin_xml, "props_dialog");
g_snprintf(title, 100, "%s Properties",filename);
gtk_window_set_title(GTK_WINDOW(propswin), title);
label = glade_xml_get_widget (propswin_xml, "props_filename");
gtk_label_set_text(GTK_LABEL(label), filename);
label = glade_xml_get_widget (propswin_xml, "props_jetver");
gtk_label_set_text(GTK_LABEL(label), mdb->jet_version == MDB_VER_JET3 ? "3 (Access 97)" : "4 (Access 2000/XP)");
assert( fstat(mdb->fd, &st)!=-1 );
sprintf(tmpstr, "%ld K", st.st_size/1024);
label = glade_xml_get_widget (propswin_xml, "props_filesize");
gtk_label_set_text(GTK_LABEL(label), tmpstr);
sprintf(tmpstr, "%ld", st.st_size / mdb->pg_size);
gmdb_info_add_keyvalue(table, 3, "Number of Pages:", tmpstr);
label = glade_xml_get_widget (propswin_xml, "props_numpages");
gtk_label_set_text(GTK_LABEL(label), tmpstr);
sprintf(tmpstr, "%d", mdb->num_catalog);
gmdb_info_add_keyvalue(table, 4, "Number of Tables:", tmpstr);
label = glade_xml_get_widget (propswin_xml, "props_numobjs");
gtk_label_set_text(GTK_LABEL(label), tmpstr);
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 5);
button = gtk_button_new_with_label("Close");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 5);
gtk_signal_connect_object ( GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT(infow->window));
return infow->window;
g_free(filepath);
}

View File

@@ -7,10 +7,8 @@ GtkWidget *app;
GladeXML *mainwin_xml;
MdbSQL *sql;
gmdb_table_popup_cb(GtkWidget *button, GdkEvent *event);
/* called when the user closes the window */
static gint
gint
delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
{
/* signal the main loop to quit */
@@ -38,7 +36,7 @@ pixbuf = gdk_pixbuf_new_from_file ("logo.xpm", NULL);
gtk_widget_show (gnome_about_new ("Gnome MDB Viewer", "0.2",
"Copyright 2002-2003 Brian Bruns",
_("The Gnome-MDB Viewer is the grapical interface to "
"MDB Tools. It lets you view, print and export data "
"MDB Tools. It lets you view and export data and schema"
"from MDB files produced by MS Access 97/2000/XP."),
(const gchar **) authors,
(const gchar **) authors,
@@ -94,17 +92,17 @@ gmdb_reset_widgets()
GnomeIconList *gil;
int pos;
gil = glade_xml_get_widget (mainwin_xml, "table_iconlist");
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "table_iconlist");
gnome_icon_list_clear(gil);
gil = glade_xml_get_widget (mainwin_xml, "query_iconlist");
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "query_iconlist");
gnome_icon_list_clear(gil);
gil = glade_xml_get_widget (mainwin_xml, "form_iconlist");
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "form_iconlist");
gnome_icon_list_clear(gil);
gil = glade_xml_get_widget (mainwin_xml, "report_iconlist");
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "report_iconlist");
gnome_icon_list_clear(gil);
gil = glade_xml_get_widget (mainwin_xml, "macro_iconlist");
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "macro_iconlist");
gnome_icon_list_clear(gil);
gil = glade_xml_get_widget (mainwin_xml, "module_iconlist");
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "module_iconlist");
gnome_icon_list_clear(gil);
}
@@ -115,8 +113,7 @@ void gmdb_init_popups()
int main(int argc, char *argv[])
{
GtkWidget *menuitem;
GtkWidget *menulabel;
GtkWidget *gmdb;
#ifdef SQL
/* initialize the SQL engine */
@@ -136,7 +133,8 @@ GtkWidget *menulabel;
/* connect the signals in the interface */
glade_xml_signal_autoconnect(mainwin_xml);
gtk_signal_connect (GTK_OBJECT (app), "delete_event",
gmdb = glade_xml_get_widget (mainwin_xml, "gmdb");
gtk_signal_connect (GTK_OBJECT (gmdb), "delete_event",
GTK_SIGNAL_FUNC (delete_event), NULL);
if (argc>1) {

172
src/gmdb2/schema.c Normal file
View File

@@ -0,0 +1,172 @@
#include "gmdb.h"
extern GtkWidget *app;
extern MdbHandle *mdb;
GladeXML *schemawin_xml;
static gchar backend[100];
static gchar tabname[100];
static gchar file_path[256];
static gchar relation;
static gchar drops;
#define ALL_TABLES "(All Tables)"
void
gmdb_schema_export()
{
FILE *outfile;
MdbTableDef *table;
MdbCatalogEntry *entry;
MdbColumn *col;
int i,k;
int need_headers = 0;
int need_quote = 0;
gchar delimiter[11];
gchar quotechar;
gchar lineterm[5];
gchar *str;
int rows=0;
char msg[100];
char *the_relation;
printf("file path %s\n",file_path);
if ((outfile=fopen(file_path, "w"))==NULL) {
gmdb_info_msg("Unable to Open File!");
return;
}
mdb_set_default_backend(mdb,backend);
for (i=0; i < mdb->num_catalog; i++) {
entry = g_ptr_array_index (mdb->catalog, i);
/* if it's a table */
if (entry->object_type == MDB_TABLE) {
/* skip the MSys tables */
if ((strlen(tabname) && !strcmp(entry->object_name,tabname)) ||
(!strlen(tabname) && strncmp (entry->object_name, "MSys", 4))) {
/* make sure it's a table (may be redundant) */
if (!strcmp (mdb_get_objtype_string (entry->object_type), "Table")) {
/* drop the table if it exists */
if (drops=='Y')
fprintf(outfile, "DROP TABLE %s;\n", entry->object_name);
/* create the table */
fprintf (outfile, "CREATE TABLE %s\n", entry->object_name);
fprintf (outfile, " (\n");
table = mdb_read_table (entry);
/* get the columns */
mdb_read_columns (table);
/* loop over the columns, dumping the names and types */
for (k = 0; k < table->num_cols; k++) {
col = g_ptr_array_index (table->columns, k);
fprintf (outfile, "\t%s\t\t\t%s", col->name,
mdb_get_coltype_string (mdb->default_backend, col->col_type));
if (col->col_size != 0)
fprintf (outfile, " (%d)", col->col_size);
if (k < table->num_cols - 1)
fprintf (outfile, ", \n");
else
fprintf (outfile, "\n");
}
fprintf (outfile, "\n);\n");
fprintf (outfile, "-- CREATE ANY INDEXES ...\n");
fprintf (outfile, "\n");
}
}
}
}
fprintf (outfile, "\n\n");
if (relation=='Y') {
fprintf (outfile, "-- CREATE ANY Relationships ...\n");
fprintf (outfile, "\n");
the_relation=mdb_get_relationships(mdb);
while (the_relation[0] != '\0') {
fprintf(outfile,"%s\n",the_relation);
the_relation=mdb_get_relationships(mdb);
}
}
fclose(outfile);
sprintf(msg,"Schema exported successfully.\n");
gmdb_info_msg(msg);
}
void
gmdb_schema_export_cb(GtkWidget *w, gpointer data)
{
GtkWidget *schemawin, *combo, *checkbox, *entry;
schemawin = glade_xml_get_widget (schemawin_xml, "schema_dialog");
entry = glade_xml_get_widget (schemawin_xml, "filename_entry");
strncpy(file_path,gtk_entry_get_text(GTK_ENTRY(entry)),255);
combo = glade_xml_get_widget (schemawin_xml, "table_combo");
strncpy(tabname,gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)),99);
if (!strcmp(tabname,ALL_TABLES)) tabname[0]='\0';
combo = glade_xml_get_widget (schemawin_xml, "backend_combo");
if (!strcmp(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)),"Oracle")) strcpy(backend,"oracle");
else if (!strcmp(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)),"Sybase")) strcpy(backend,"sybase");
else if (!strcmp(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)),"MS SQL Server")) strcpy(backend,"sybase");
else if (!strcmp(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)),"PostgreSQL")) strcpy(backend,"postgres");
else strcpy(backend,"access");
checkbox = glade_xml_get_widget (schemawin_xml, "rel_checkbox");
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox)))
relation = 'Y';
else
relation = 'N';
checkbox = glade_xml_get_widget (schemawin_xml, "drop_checkbox");
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox)))
drops = 'Y';
else
drops = 'N';
//printf("%s %s %c\n",tabname,backend,relation);
gtk_widget_destroy(schemawin);
gmdb_schema_export();
}
void
gmdb_schema_new_cb(GtkWidget *w, gpointer data) {
GList *glist = NULL;
GtkWidget *combo;
MdbCatalogEntry *entry;
int i;
/* load the interface */
schemawin_xml = glade_xml_new("gladefiles/gmdb-schema.glade", NULL, NULL);
/* connect the signals in the interface */
glade_xml_signal_autoconnect(schemawin_xml);
/* set signals with user data, anyone know how to do this in glade? */
combo = glade_xml_get_widget (schemawin_xml, "table_combo");
glist = g_list_append(glist, ALL_TABLES);
/* loop over each entry in the catalog */
for (i=0; i < mdb->num_catalog; i++) {
entry = g_ptr_array_index (mdb->catalog, i);
/* if it's a table */
if (entry->object_type == MDB_TABLE) {
/* skip the MSys tables */
if (strncmp (entry->object_name, "MSys", 4)) {
/* add table to list */
glist = g_list_append(glist, entry->object_name);
}
} /* if MDB_TABLE */
} /* for */
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
g_list_free(glist);
}

View File

@@ -14,45 +14,61 @@ typedef struct GMdbSQLWindow {
} GMdbSQLWindow;
GList *window_list;
GladeXML *sqlwin_xml;
extern GtkWidget *app;
extern MdbHandle *mdb;
extern MdbSQL *sql;
GtkCTreeNode *gmdb_sql_ctree_populate(MdbHandle *mdb, GMdbSQLWindow *sqlwin);
void gmdb_sql_tree_populate(MdbHandle *mdb, GladeXML *xml);
/* callbacks */
#if 0
gint
gmdb_sql_close(GtkList *list, GtkWidget *w, GMdbSQLWindow *sqlwin)
gmdb_sql_close_cb(GtkList *list, GtkWidget *w, GMdbSQLWindow *sqlwin)
{
window_list = g_list_remove(window_list, sql);
g_free(sql);
return FALSE;
}
#endif
void
gmdb_sql_tree_select_cb(GtkCTree *tree, GList *node, gint column, GMdbSQLWindow *sqlwin)
gmdb_sql_close_cb(GtkWidget *w, GladeXML *xml)
{
sqlwin->current_node = node;
GtkWidget *win;
win = glade_xml_get_widget (xml, "sql_window");
if (win) gtk_widget_destroy(win);
}
void
gmdb_sql_dnd_dataget_cb(
GtkWidget *w, GdkDragContext *dc,
GtkSelectionData *selection_data, guint info, guint t,
GMdbSQLWindow *sqlwin)
GladeXML *xml)
{
gchar tablename[256];
gchar *text[2];
//gchar *tablename = "Orders";
gchar *name;
GtkTreeSelection *select;
GtkTreeStore *store;
GtkTreeView *tree;
GtkTreeIter *iter, iter2;
gtk_ctree_get_node_info(GTK_CTREE(sqlwin->ctree), sqlwin->current_node, text, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
tree = (GtkTreeView *) glade_xml_get_widget(sqlwin_xml, "sql_treeview");
select = gtk_tree_view_get_selection(GTK_TREE_VIEW (tree));
store = (GtkTreeStore *) gtk_tree_view_get_model(tree);
gtk_tree_selection_get_selected (select, NULL, &iter2);
gtk_tree_model_get (GTK_TREE_MODEL(store), &iter2, 0, &name, -1);
strcpy(tablename,name);
g_free(name);
printf("table %s\n",tablename);
//strcpy(tablename, "Shippers");
gtk_selection_data_set(
selection_data,
GDK_SELECTION_TYPE_STRING,
8, /* 8 bits per character. */
text[0], strlen(text[0]));
tablename, strlen(tablename));
}
void gmdb_sql_dnd_datareceived_cb(
GtkWidget *w,
@@ -60,31 +76,22 @@ void gmdb_sql_dnd_datareceived_cb(
gint x, gint y,
GtkSelectionData *selection_data,
guint info, guint t,
GMdbSQLWindow *sqlwin)
GladeXML *xml)
{
gchar *buf, *lastbuf;
GtkTextIter iter, start, end;
GtkTextBuffer *txtbuffer;
int len;
GtkWidget *textview;
textview = glade_xml_get_widget(xml, "sql_textview");
buf = selection_data->data;
txtbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(sqlwin->textbox));
txtbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
if (gtk_text_buffer_get_char_count(txtbuffer)==0) {
gtk_text_buffer_get_iter_at_offset (txtbuffer, &iter, 0);
gtk_text_buffer_insert(txtbuffer, &iter, "select * from ", 14);
}
#if 0
len = gtk_text_buffer_get_char_count(txtbuffer);
gtk_text_buffer_get_iter_at_offset (txtbuffer, &end, len);
gtk_text_buffer_get_iter_at_offset (txtbuffer, &start, len - strlen(buf));
lastbuf = gtk_text_buffer_get_text(txtbuffer, &start, &end, FALSE);
printf("last buf %s\n", lastbuf);
if (strcmp(buf,lastbuf)) {
//gtk_text_buffer_insert_at_cursor(txtbuffer,buf,strlen(buf));
}
#endif
gtk_widget_grab_focus(GTK_WIDGET(sqlwin->textbox));
gtk_widget_grab_focus(GTK_WIDGET(textview));
}
void
@@ -95,13 +102,13 @@ gchar *buf;
GtkTextBuffer *txtbuffer;
child_num = gtk_list_child_position(list, w);
buf = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(sqlwin->combo)->entry));
buf = (gchar *) gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(sqlwin->combo)->entry));
txtbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(sqlwin->textbox));
gtk_text_buffer_set_text(txtbuffer, buf, strlen(buf));
}
void
gmdb_sql_execute_cb(GtkWidget *w, GMdbSQLWindow *sqlwin)
gmdb_sql_execute_cb(GtkWidget *w, GladeXML *xml)
{
guint len;
gchar *buf;
@@ -111,44 +118,76 @@ MdbSQLColumn *sqlcol;
gchar *titles[256];
GtkTextBuffer *txtbuffer;
GtkTextIter start, end;
GtkWidget *textview, *combo, *treeview, *store;
GList *history;
GType *gtypes;
GtkTreeIter iter;
GtkTreeViewColumn *column;
/* stuff this query on the history */
txtbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(sqlwin->textbox));
textview = glade_xml_get_widget(xml, "sql_textview");
combo = glade_xml_get_widget(xml, "sql_combo");
txtbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
len = gtk_text_buffer_get_char_count(txtbuffer);
gtk_text_buffer_get_iter_at_offset (txtbuffer, &start, 0);
gtk_text_buffer_get_iter_at_offset (txtbuffer, &end, len);
buf = gtk_text_buffer_get_text(txtbuffer, &start, &end, FALSE);
sqlwin->history = g_list_prepend(sqlwin->history, g_strdup(buf));
gtk_combo_set_popdown_strings(GTK_COMBO(sqlwin->combo), sqlwin->history);
/* add to the history */
history = g_object_get_data(G_OBJECT(combo),"hist_list");
history = g_list_prepend(history, g_strdup(buf));
g_object_set_data(G_OBJECT(combo), "hist_list", history);
gtk_combo_set_popdown_strings(GTK_COMBO(combo), history);
/* ok now execute it */
g_input_ptr = buf;
/* begin unsafe */
/* begin unsafe */
_mdb_sql(sql);
if (yyparse()) {
/* end unsafe */
gmdb_info_msg("Couldn't parse SQL");
mdb_sql_reset(sql);
return;
}
for (i=0;i<sql->num_columns;i++) {
bound_data[i] = (char *) malloc(MDB_BIND_SIZE);
bound_data[i][0] = '\0';
mdbsql_bind_column(sql, i+1, bound_data[i]);
sqlcol = g_ptr_array_index(sql->columns,i);
titles[i] = sqlcol->name;
}
if (sqlwin->clist) {
gtk_container_remove(GTK_CONTAINER(sqlwin->scroll), sqlwin->clist);
}
sqlwin->clist = gtk_clist_new_with_titles(sql->num_columns, titles);
gtk_container_add(GTK_CONTAINER(sqlwin->scroll),sqlwin->clist);
gtk_widget_show(sqlwin->clist);
while(mdb_fetch_row(sql->cur_table)) {
gtk_clist_append(GTK_CLIST(sqlwin->clist), bound_data);
}
treeview = glade_xml_get_widget(xml, "sql_results");
gtypes = g_malloc(sizeof(GType) * sql->num_columns);
for (i=0;i<sql->num_columns;i++)
gtypes[i]=G_TYPE_STRING;
store = gtk_tree_view_get_model(treeview);
if (store) {
i=0;
while (column = gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), i)) {
gtk_tree_view_remove_column(GTK_TREE_VIEW(treeview), column);
}
gtk_widget_destroy(store);
}
store = (GtkWidget *) gtk_list_store_newv(sql->num_columns, gtypes);
g_free(gtypes);
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(store));
GtkCellRenderer *renderer;
renderer = gtk_cell_renderer_text_new();
for (i=0;i<sql->num_columns;i++) {
bound_data[i] = (char *) malloc(MDB_BIND_SIZE);
bound_data[i][0] = '\0';
mdbsql_bind_column(sql, i+1, bound_data[i]);
sqlcol = g_ptr_array_index(sql->columns,i);
column = gtk_tree_view_column_new_with_attributes(sqlcol->name, renderer, "text", i, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW (treeview), column);
}
while(mdb_fetch_row(sql->cur_table)) {
gtk_list_store_append(GTK_LIST_STORE(store), &iter);
for (i=0;i<sql->num_columns;i++) {
gtk_list_store_set(GTK_LIST_STORE(store),
&iter, i, (gchar *) bound_data[i], -1);
}
}
/* free the memory used to bind */
@@ -161,136 +200,81 @@ GtkTextIter start, end;
}
void
gmdb_sql_new_window_cb(GtkWidget *w, gpointer data)
gmdb_sql_new_cb(GtkWidget *w, gpointer data)
{
GtkWidget *hpane;
GtkWidget *vpane;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *scroll;
GtkWidget *button;
GtkWidget *frame1;
GtkTargetEntry src;
GMdbSQLWindow *sqlwin;
GtkWindow *txtbuffer;
GtkCTreeNode *node;
GtkWidget *mi, *but;
if (!mdb) {
gmdb_info_msg("No database is open.");
return;
}
sqlwin = g_malloc0(sizeof(GMdbSQLWindow));
sqlwin->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(sqlwin->window), "Query Tool");
gtk_widget_set_usize(sqlwin->window, 400,300);
gtk_widget_show(sqlwin->window);
/* load the interface */
sqlwin_xml = glade_xml_new("gladefiles/gmdb-sql.glade", NULL, NULL);
/* connect the signals in the interface */
glade_xml_signal_autoconnect(sqlwin_xml);
gtk_signal_connect (GTK_OBJECT (sqlwin->window), "delete_event",
GTK_SIGNAL_FUNC (gmdb_sql_close), sqlwin);
mi = glade_xml_get_widget (sqlwin_xml, "close_menu");
g_signal_connect (G_OBJECT (mi), "activate",
G_CALLBACK (gmdb_sql_close_cb), sqlwin_xml);
vpane = gtk_vpaned_new();
gtk_widget_show(vpane);
gtk_paned_set_position(GTK_PANED(vpane), 100);
gtk_paned_set_gutter_size(GTK_PANED(vpane), 12);
gtk_container_add(GTK_CONTAINER(sqlwin->window), vpane);
but = glade_xml_get_widget (sqlwin_xml, "close_button");
g_signal_connect (G_OBJECT (but), "clicked",
G_CALLBACK (gmdb_sql_close_cb), sqlwin_xml);
hpane = gtk_hpaned_new();
gtk_widget_show(hpane);
gtk_paned_set_position(GTK_PANED(hpane), 100);
gtk_paned_set_gutter_size(GTK_PANED(hpane), 12);
gtk_container_add(GTK_CONTAINER(vpane), hpane);
mi = glade_xml_get_widget (sqlwin_xml, "execute_menu");
g_signal_connect (G_OBJECT (mi), "activate",
G_CALLBACK (gmdb_sql_execute_cb), sqlwin_xml);
scroll = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_widget_show (scroll);
gtk_container_add(GTK_CONTAINER(hpane), scroll);
but = glade_xml_get_widget (sqlwin_xml, "execute_button");
g_signal_connect (G_OBJECT (but), "clicked",
G_CALLBACK (gmdb_sql_execute_cb), sqlwin_xml);
sqlwin->ctree = gtk_ctree_new (1, 0);
gtk_widget_show (sqlwin->ctree);
gtk_container_add (GTK_CONTAINER (scroll), sqlwin->ctree);
/* set up treeview, libglade only gives us the empty widget */
GtkWidget *tree = glade_xml_get_widget(sqlwin_xml, "sql_treeview");
GtkTreeStore *store = gtk_tree_store_new(1, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(tree), GTK_TREE_MODEL(store));
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes("Name",
renderer, "text", 0, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW (tree), column);
GtkTreeSelection *select =
gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE);
//g_signal_connect (G_OBJECT (select), "changed",
//G_CALLBACK (gmdb_sql_select_cb), sqlwin_xml);
gtk_signal_connect ( GTK_OBJECT (sqlwin->ctree),
"tree-select-row", GTK_SIGNAL_FUNC (gmdb_sql_tree_select_cb), sqlwin);
vbox = gtk_vbox_new(FALSE,0);
gtk_widget_show (vbox);
gtk_container_add(GTK_CONTAINER(hpane), vbox);
frame1 = gtk_frame_new (NULL);
gtk_frame_set_shadow_type(GTK_FRAME(frame1), GTK_SHADOW_IN);
gtk_widget_show (frame1);
gtk_box_pack_start (GTK_BOX (vbox), frame1, TRUE, TRUE, 0);
sqlwin->textbox = gtk_text_view_new();
gtk_widget_show (sqlwin->textbox);
gtk_container_add(GTK_CONTAINER(frame1), sqlwin->textbox);
#if 0
gtk_signal_connect ( GTK_OBJECT (sqlwin->textbox),
"activate", GTK_SIGNAL_FUNC (gmdb_sql_execute_cb), sqlwin);
#endif
hbox = gtk_hbox_new(FALSE,0);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
sqlwin->combo = gtk_combo_new();
gtk_widget_show (sqlwin->combo);
gtk_box_pack_start (GTK_BOX (hbox), sqlwin->combo, TRUE, TRUE, 0);
gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(sqlwin->combo)->entry), FALSE);
gtk_signal_connect ( GTK_OBJECT (GTK_COMBO(sqlwin->combo)->list),
"select-child", GTK_SIGNAL_FUNC (gmdb_sql_select_hist_cb), sqlwin);
button = gtk_button_new_with_label("Execute");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 5);
gtk_signal_connect ( GTK_OBJECT (button),
"clicked", GTK_SIGNAL_FUNC (gmdb_sql_execute_cb), sqlwin);
sqlwin->scroll = gtk_scrolled_window_new(NULL,NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sqlwin->scroll),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_show (sqlwin->scroll);
gtk_container_add(GTK_CONTAINER(vpane), sqlwin->scroll);
sqlwin->clist = gtk_clist_new(1);
gtk_widget_show(sqlwin->clist);
gtk_container_add(GTK_CONTAINER(sqlwin->scroll),sqlwin->clist);
/* populate first level of tree */
node = gmdb_sql_ctree_populate(mdb, sqlwin);
gtk_ctree_select(sqlwin->ctree, node);
gmdb_sql_tree_populate(mdb, sqlwin_xml);
GtkWidget *textview = glade_xml_get_widget(sqlwin_xml, "sql_textview");
src.target = "table";
src.flags = 0;
src.info = 1;
gtk_drag_source_set( sqlwin->ctree, GDK_BUTTON1_MASK, &src, 1, GDK_ACTION_COPY);
gtk_drag_dest_set( sqlwin->textbox,
gtk_drag_source_set( tree, GDK_BUTTON1_MASK, &src, 1, GDK_ACTION_COPY);
gtk_drag_dest_set( textview,
//GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_HIGHLIGHT ,
// GTK_DEST_DEFAULT_DROP,
&src, 1, GDK_ACTION_COPY | GDK_ACTION_MOVE);
gtk_signal_connect( GTK_OBJECT(sqlwin->ctree), "drag_data_get",
GTK_SIGNAL_FUNC(gmdb_sql_dnd_dataget_cb), sqlwin);
gtk_signal_connect( GTK_OBJECT(sqlwin->textbox), "drag_data_received",
GTK_SIGNAL_FUNC(gmdb_sql_dnd_datareceived_cb), sqlwin);
gtk_signal_connect( GTK_OBJECT(tree), "drag_data_get",
GTK_SIGNAL_FUNC(gmdb_sql_dnd_dataget_cb), sqlwin_xml);
gtk_signal_connect( GTK_OBJECT(textview), "drag_data_received",
GTK_SIGNAL_FUNC(gmdb_sql_dnd_datareceived_cb), sqlwin_xml);
gtk_widget_grab_focus(GTK_WIDGET(sqlwin->textbox));
/* add this one to the window list */
window_list = g_list_append(window_list, sql);
gtk_widget_grab_focus(GTK_WIDGET(textview));
}
/* functions */
GtkCTreeNode *
gmdb_sql_ctree_populate(MdbHandle *mdb, GMdbSQLWindow *sqlwin)
void
gmdb_sql_tree_populate(MdbHandle *mdb, GladeXML *xml)
{
int i;
MdbCatalogEntry *entry;
gchar *text[2];
GtkCTreeNode *node, *first_node = NULL;
GtkTreeIter *iter1, *iter2;
GtkWidget *tree = glade_xml_get_widget(sqlwin_xml, "sql_treeview");
GtkTreeStore *store = (GtkTreeStore *) gtk_tree_view_get_model(GTK_TREE_VIEW(tree));
/* loop over each entry in the catalog */
for (i=0; i < mdb->num_catalog; i++) {
@@ -301,19 +285,17 @@ GtkCTreeNode *node, *first_node = NULL;
/* skip the MSys tables */
if (strncmp (entry->object_name, "MSys", 4)) {
/* add table to tab */
text[0] = entry->object_name;
text[1] = "";
node = gtk_ctree_insert_node(GTK_CTREE(sqlwin->ctree), NULL, NULL, text, 0, NULL, NULL, NULL, NULL, FALSE, FALSE);
if (! first_node) first_node = node;
}
iter2 = g_malloc(sizeof(GtkTreeIter));
gtk_tree_store_append(store, iter2, NULL);
gtk_tree_store_set(store, iter2, 0, entry->object_name, -1);
}
} /* if MDB_TABLE */
} /* for */
return first_node;
}
#else
void
gmdb_sql_new_window_cb(GtkWidget *w, gpointer data)
gmdb_sql_new_cb(GtkWidget *w, gpointer data)
{
gmdb_info_msg("SQL support was not built in.\nRun configure with the --enable-sql option.");
}

View File

@@ -12,11 +12,24 @@ extern char *mdb_access_types[];
/* callbacks */
void
gmdb_table_debug_cb(GtkList *list, GtkWidget *w, gpointer data)
{
MdbCatalogEntry *entry;
guint32 page;
/* nothing selected yet? */
if (selected_table==-1) {
return;
}
entry = g_ptr_array_index(mdb->catalog,selected_table);
gmdb_debug_new_cb(w, &entry->table_pg);
}
void
gmdb_table_def_cb(GtkList *list, GtkWidget *w, gpointer data)
{
MdbCatalogEntry *entry;
printf("here\n");
/* nothing selected yet? */
if (selected_table==-1) {
return;
@@ -63,7 +76,6 @@ MdbCatalogEntry *entry;
gchar *text;
text = (gchar *) gnome_icon_list_get_icon_data(gil, num);
printf ("text !%s!\n",text);
for (i=0;i<mdb->num_catalog;i++) {
entry = g_ptr_array_index(mdb->catalog,i);
@@ -83,7 +95,6 @@ GdkEventButton *event_button;
if (event_button->button == 3) {
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
event_button->button, event_button->time);
g_print("button press\n");
return TRUE;
}
}
@@ -107,15 +118,21 @@ GtkWidget *menu, *mi;
gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
mi = gtk_menu_item_new_with_label("Data");
gtk_widget_show(mi);
g_signal_connect_swapped (G_OBJECT (mi), "activate",
G_CALLBACK (gmdb_table_data_cb), gil);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
mi = gtk_menu_item_new_with_label("Export");
gtk_widget_show(mi);
g_signal_connect_swapped (G_OBJECT (mi), "activate",
G_CALLBACK (gmdb_table_export_cb), gil);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
mi = gtk_separator_menu_item_new();
gtk_widget_show(mi);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
mi = gtk_menu_item_new_with_label("Debug");
gtk_widget_show(mi);
g_signal_connect_swapped (G_OBJECT (mi), "activate",
G_CALLBACK (gmdb_table_debug_cb), gil);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
mi = gtk_menu_item_new_with_label("Usage Map");
gtk_widget_show(mi);

View File

@@ -2,19 +2,8 @@
extern GtkWidget *app;
extern MdbHandle *mdb;
typedef struct GMdbTableExportDialog {
MdbCatalogEntry *entry;
GtkWidget *dialog;
GtkWidget *lineterm;
GtkWidget *colsep;
GtkWidget *quote;
GtkWidget *quotechar;
GtkWidget *headers;
GtkWidget *filesel;
} GMdbTableExportDialog;
GMdbTableExportDialog *export;
GladeXML *exportwin_xml;
MdbCatalogEntry *cat_entry;
#define COMMA "Comma (,)"
#define TAB "Tab"
@@ -44,7 +33,7 @@ print_quote(FILE *outfile, int need_quote, char quotechar, char *colsep, char *s
}
void
gmdb_export_file_cb(GtkWidget *selector, GMdbTableExportDialog *export)
gmdb_table_export_button_cb(GtkWidget *w, gpointer data)
{
gchar *file_path;
FILE *outfile;
@@ -60,9 +49,12 @@ gchar lineterm[5];
gchar *str;
int rows=0;
char msg[100];
GtkWidget *combo, *fentry, *checkbox;
GtkWidget *exportwin;
str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(export->colsep)->entry));
combo = glade_xml_get_widget (exportwin_xml, "sep_combo");
str = (gchar *) gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry));
if (!strcmp(str,COMMA)) { strcpy(delimiter, ","); }
else if (!strcmp(str,TAB)) { strcpy(delimiter, "\t"); }
else if (!strcmp(str,SPACE)) { strcpy(delimiter, " "); }
@@ -74,24 +66,32 @@ char msg[100];
delimiter[10]='\0';
}
str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(export->lineterm)->entry));
combo = glade_xml_get_widget (exportwin_xml, "term_combo");
str = (gchar *) gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry));
if (!strcmp(str,LF)) { strcpy(lineterm, "\n"); }
else if (!strcmp(str,CR)) { strcpy(lineterm, "\r"); }
else if (!strcmp(str,CRLF)) { strcpy(lineterm, "\r\n"); }
str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(export->quote)->entry));
combo = glade_xml_get_widget (exportwin_xml, "quote_combo");
str = (gchar *) gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry));
if (!strcmp(str,ALWAYS)) { need_quote = 1; }
else if (!strcmp(str,NEVER)) { need_quote = 0; }
else if (!strcmp(str,AUTOMAT)) { need_quote = -1; }
str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(export->quotechar)->entry));
combo = glade_xml_get_widget (exportwin_xml, "qchar_combo");
str = (gchar *) gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry));
quotechar = str[0];
/* headers */
str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(export->headers)->entry));
if (str && str[0]=='Y') need_headers = 1;
checkbox = glade_xml_get_widget (exportwin_xml, "header_checkbox");
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox)))
need_headers = 1;
else
need_headers = 0;
fentry = glade_xml_get_widget (exportwin_xml, "filename_entry");
file_path = (gchar *) gtk_entry_get_text(GTK_ENTRY(fentry));
file_path = gtk_file_selection_get_filename (GTK_FILE_SELECTION(export->filesel));
// printf("file path %s\n",file_path);
if ((outfile=fopen(file_path, "w"))==NULL) {
gmdb_info_msg("Unable to Open File!");
@@ -99,7 +99,7 @@ char msg[100];
}
/* read table */
table = mdb_read_table(export->entry);
table = mdb_read_table(cat_entry);
mdb_read_columns(table);
mdb_rewind_table(table);
@@ -138,76 +138,34 @@ char msg[100];
}
fclose(outfile);
gtk_widget_destroy(export->dialog);
exportwin = glade_xml_get_widget (exportwin_xml, "export_dialog");
gtk_widget_destroy(exportwin);
sprintf(msg,"%d Rows exported successfully.\n", rows);
gmdb_info_msg(msg);
}
void
gmdb_export_button_cb(GtkWidget *w, GMdbTableExportDialog *export)
{
/* just print a string so that we know we got there */
export->filesel = gtk_file_selection_new("Please choose a filename.");
gtk_signal_connect (
GTK_OBJECT (GTK_FILE_SELECTION(export->filesel)->ok_button),
"clicked", GTK_SIGNAL_FUNC (gmdb_export_file_cb), export);
gtk_signal_connect_object ( GTK_OBJECT (
GTK_FILE_SELECTION(export->filesel)->ok_button),
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
(gpointer) export->filesel);
gtk_signal_connect_object (
GTK_OBJECT (GTK_FILE_SELECTION(export->filesel)->cancel_button),
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
(gpointer) export->filesel);
gtk_widget_show (export->filesel);
}
GtkWidget *
gmdb_export_add_combo(GtkWidget *table, int row, gchar *text, GList *strings)
{
GtkWidget *combo;
GtkWidget *label;
label = gtk_label_new(text);
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT);
gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row + 1,
GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 0);
gtk_widget_show(label);
combo = gtk_combo_new();
gtk_combo_set_popdown_strings(GTK_COMBO(combo), strings);
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, row, row + 1,
GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 5, 0);
gtk_widget_show(combo);
return combo;
}
void gmdb_table_export(MdbCatalogEntry *entry) {
GtkWidget *export_button;
GtkWidget *close_button;
GList *glist = NULL;
GtkWidget *table;
GtkWidget *combo;
export = g_malloc(sizeof(GMdbTableExportDialog));
export->entry = entry;
cat_entry = entry;
/* load the interface */
exportwin_xml = glade_xml_new("gladefiles/gmdb-export.glade", NULL, NULL);
/* connect the signals in the interface */
glade_xml_signal_autoconnect(exportwin_xml);
/* Create the widgets */
export->dialog = gtk_dialog_new();
gtk_widget_set_uposition(export->dialog, 300, 300);
table = gtk_table_new(3,2,FALSE);
gtk_widget_show(table);
combo = glade_xml_get_widget (exportwin_xml, "term_combo");
glist = g_list_append(glist, LF);
glist = g_list_append(glist, CR);
glist = g_list_append(glist, CRLF);
export->lineterm = gmdb_export_add_combo(table, 0, "Line Terminator:",glist);
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
g_list_free(glist);
gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(export->lineterm)->entry), FALSE);
combo = glade_xml_get_widget (exportwin_xml, "sep_combo");
glist = NULL;
glist = g_list_append(glist, COMMA);
glist = g_list_append(glist, TAB);
@@ -215,46 +173,22 @@ GtkWidget *table;
glist = g_list_append(glist, COLON);
glist = g_list_append(glist, SEMICOLON);
glist = g_list_append(glist, PIPE);
export->colsep = gmdb_export_add_combo(table, 1, "Column Separator:",glist);
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
g_list_free(glist);
combo = glade_xml_get_widget (exportwin_xml, "quote_combo");
glist = NULL;
glist = g_list_append(glist, ALWAYS);
glist = g_list_append(glist, NEVER);
glist = g_list_append(glist, AUTOMAT);
export->quote = gmdb_export_add_combo(table, 2, "Quotes:",glist);
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
g_list_free(glist);
gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(export->quote)->entry), FALSE);
combo = glade_xml_get_widget (exportwin_xml, "qchar_combo");
glist = NULL;
glist = g_list_append(glist, "\"");
glist = g_list_append(glist, "'");
glist = g_list_append(glist, "`");
export->quotechar = gmdb_export_add_combo(table, 3, "Quote Character:",glist);
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
g_list_free(glist);
glist = NULL;
glist = g_list_append(glist, "Yes");
glist = g_list_append(glist, "No");
export->headers = gmdb_export_add_combo(table, 4, "Include Headers:",glist);
g_list_free(glist);
gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(export->headers)->entry), FALSE);
export_button = gtk_button_new_with_label("Export");
gtk_signal_connect ( GTK_OBJECT (export_button),
"clicked", GTK_SIGNAL_FUNC (gmdb_export_button_cb), export);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(export->dialog)->action_area),
export_button);
close_button = gtk_button_new_with_label("Cancel");
gtk_signal_connect_object (GTK_OBJECT (close_button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT(export->dialog));
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(export->dialog)->action_area),
close_button);
/* Add the table, and show everything we've added to the dialog. */
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(export->dialog)->vbox), table);
gtk_widget_show_all (export->dialog);
}

View File

@@ -28,6 +28,7 @@ typedef struct {
int siz;
unsigned char is_null;
unsigned char is_fixed;
int colnum;
} MdbField;
static int
@@ -44,26 +45,17 @@ MdbIndex *idx;
}
return 0;
}
static int mdb_is_null(unsigned char *null_mask, int col_num)
{
int byte_num = (col_num - 1) / 8;
int bit_num = (col_num - 1) % 8;
if ((1 << bit_num) & null_mask[byte_num]) {
return 0;
} else {
return 1;
}
}
int
mdb_crack_row(MdbTableDef *table, int row_start, int row_end, MdbField *fields)
{
MdbCatalogEntry *entry = table->entry;
MdbHandle *mdb = entry->mdb;
MdbColumn *col;
int var_cols, fixed_cols, num_cols, i;
unsigned char null_mask[33]; /* 256 columns max / 8 bits per byte */
int var_cols, fixed_cols, num_cols, i, totcols;
unsigned char *nullmask;
int bitmask_sz;
int byte_num, bit_num;
printf("field 0 %s\n", fields[0].value);
@@ -73,20 +65,36 @@ int bitmask_sz;
num_cols = mdb->pg_buf[row_start];
}
totcols = 0;
var_cols = 0; /* mdb->pg_buf[row_end-1]; */
fixed_cols = 0; /* num_cols - var_cols; */
for (i = 0; i < table->num_cols; i++) {
col = g_ptr_array_index (table->columns, i);
if (mdb_is_fixed_col(col))
if (mdb_is_fixed_col(col)) {
fixed_cols++;
else
fields[totcols++].colnum = i;
fields[totcols].siz = col->col_size;
fields[totcols].is_fixed = 1;
}
}
for (i = 0; i < table->num_cols; i++) {
col = g_ptr_array_index (table->columns, i);
if (!mdb_is_fixed_col(col)) {
var_cols++;
fields[totcols++].colnum = i;
fields[totcols].is_fixed = 0;
}
}
bitmask_sz = (num_cols - 1) / 8 + 1;
nullmask = &mdb->pg_buf[row_end - bitmask_sz + 1];
for (i=0;i<bitmask_sz;i++) {
null_mask[i]=mdb->pg_buf[row_end - bitmask_sz + i + 1];
for (i=0;i<num_cols;i++) {
byte_num = i / 8;
bit_num = i % 8;
/* logic on nulls is reverse, 1 is not null, 0 is null */
fields[i].is_null = nullmask[byte_num] & 1 << bit_num ? 0 : 1;
printf("col %d is %s\n", i, fields[i].is_null ? "null" : "not null");
}
return num_cols;

View File

@@ -35,10 +35,6 @@ int opt;
fprintf (stderr, "Usage: %s <file> [<backend>]\n",argv[0]);
exit (1);
}
if (argc < 2) {
fprintf (stderr, "Usage: %s [-S] [-1 | -d<delimiter>] <file>\n",argv[0]);
exit (1);
}
while ((opt=getopt(argc, argv, "T:"))!=-1) {
switch (opt) {