From 457b5a77ec5cda3cea7afcb8ab721f14f6dab121 Mon Sep 17 00:00:00 2001 From: Bernhard Reiter Date: Wed, 10 Aug 2011 18:00:18 -0400 Subject: [PATCH] Migrate from Gtk1 File Selector to Gtk2 File Chooser --- configure.in | 2 +- src/gmdb2/file.c | 45 +- src/gmdb2/gladefiles/Makefile.am | 1 - src/gmdb2/gladefiles/gmdb-debug.glade | 875 +++++++++------------ src/gmdb2/gladefiles/gmdb-export.glade | 40 +- src/gmdb2/gladefiles/gmdb-schema.glade | 962 ++++++++++++----------- src/gmdb2/gladefiles/gmdb-sql-file.glade | 37 - src/gmdb2/gladefiles/gmdb-sql.glade | 941 ++++++++++------------ src/gmdb2/gmdb.h | 1 - src/gmdb2/main2.c | 1 + src/gmdb2/schema.c | 6 +- src/gmdb2/sql.c | 89 +-- src/gmdb2/table_export.c | 6 +- 13 files changed, 1363 insertions(+), 1643 deletions(-) delete mode 100644 src/gmdb2/gladefiles/gmdb-sql-file.glade diff --git a/configure.in b/configure.in index 1f6c44d..82fc798 100644 --- a/configure.in +++ b/configure.in @@ -119,7 +119,7 @@ if test "$no_glib" = "yes"; then exit 1 fi -PKG_CHECK_MODULES(GNOME,gtk+-2.0 >= 2.5 libglade-2.0 libgnomeui-2.0, HAVE_GNOME=true, HAVE_GNOME=false) +PKG_CHECK_MODULES(GNOME,gtk+-2.0 >= 2.14 libglade-2.0 libgnomeui-2.0, HAVE_GNOME=true, HAVE_GNOME=false) AC_ARG_ENABLE(gmdb2, AC_HELP_STRING([--disable-gmdb2], [do not build gmdb2]), diff --git a/src/gmdb2/file.c b/src/gmdb2/file.c index ec696ab..ddb1f41 100644 --- a/src/gmdb2/file.c +++ b/src/gmdb2/file.c @@ -24,7 +24,6 @@ #include #include -GtkWidget *file_selector; MdbHandle *mdb; extern int main_show_debug; extern GladeXML *mainwin_xml; @@ -243,38 +242,30 @@ gmdb_file_open(gchar *file_path) } } -void -gmdb_file_open_cb(GtkWidget *selector, gpointer data) -{ -gchar *file_path; - file_path = (gchar *) gtk_file_selection_get_filename (GTK_FILE_SELECTION(file_selector)); - gmdb_file_open(file_path); - gmdb_load_recent_files(); -} - - void gmdb_file_select_cb(GtkWidget *button, gpointer data) { - /*just print a string so that we know we got there*/ - file_selector = gtk_file_selection_new("Please select a database."); + GtkWindow *parent_window = (GtkWindow *) glade_xml_get_widget (mainwin_xml, "gmdb"); - gtk_signal_connect ( - GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->ok_button), - "clicked", GTK_SIGNAL_FUNC (gmdb_file_open_cb), NULL); - - gtk_signal_connect_object ( GTK_OBJECT ( - GTK_FILE_SELECTION(file_selector)->ok_button), - "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), - (gpointer) file_selector); + GtkWidget *dialog = gtk_file_chooser_dialog_new ("Please select a database.", + parent_window, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); - gtk_signal_connect_object ( - GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->cancel_button), - "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), - (gpointer) file_selector); - - gtk_widget_show (file_selector); + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) + { + char *filename; + + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + gmdb_file_open(filename); + gmdb_load_recent_files(); + } + + gtk_widget_destroy (dialog); } + void gmdb_file_close_cb(GtkWidget *button, gpointer data) { diff --git a/src/gmdb2/gladefiles/Makefile.am b/src/gmdb2/gladefiles/Makefile.am index 1f043e4..de4dc27 100644 --- a/src/gmdb2/gladefiles/Makefile.am +++ b/src/gmdb2/gladefiles/Makefile.am @@ -3,7 +3,6 @@ gladedir = $(datadir)/gmdb/glade glade_DATA = \ gmdb.glade \ gmdb-sql.glade \ - gmdb-sql-file.glade \ gmdb-debug.glade \ gmdb-export.glade \ gmdb-schema.glade \ diff --git a/src/gmdb2/gladefiles/gmdb-debug.glade b/src/gmdb2/gladefiles/gmdb-debug.glade index d13bc46..974467d 100644 --- a/src/gmdb2/gladefiles/gmdb-debug.glade +++ b/src/gmdb2/gladefiles/gmdb-debug.glade @@ -1,515 +1,364 @@ - - - + - - - - - True - MDB File Debugger - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 600 - 200 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - - - - True - True - - - - True - GTK_SHADOW_NONE - - - - True - - - - True - GNOMEUIINFO_MENU_FILE_TREE - - - - - - - True - GNOMEUIINFO_MENU_NEW_ITEM - _New - True - - - - - - - True - - - - - - True - GNOMEUIINFO_MENU_CLOSE_ITEM - - - - - - - - - - - True - GNOMEUIINFO_MENU_VIEW_TREE - - - - - - - True - _Dissector - True - True - - - - - - - True - _Back - True - - - - - - - True - GNOMEUIINFO_MENU_NEW_ITEM - _Forward - True - - - - - - - True - - - - - - True - _Selected Page - True - - - - - - - True - Selected Page (_MSB) - True - - - - - - - - - - - True - GNOMEUIINFO_MENU_HELP_TREE - - - - - - - True - GNOMEUIINFO_MENU_ABOUT_ITEM - - - - - - - - - - - - BONOBO_DOCK_TOP - 0 - 0 - 0 - BONOBO_DOCK_ITEM_BEH_EXCLUSIVE|BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL|BONOBO_DOCK_ITEM_BEH_LOCKED - - - - - - True - GTK_SHADOW_OUT - - - - 1 - True - GTK_ORIENTATION_HORIZONTAL - GTK_TOOLBAR_ICONS - True - True - - - - True - Open a new window - - True - True - True - False - gtk-new - - - - False - True - - - - - - True - True - True - True - - - False - False - - - - - - True - Back - - True - True - True - False - gtk-go-back - - - - False - True - - - - - - True - Forward - - True - True - True - False - gtk-go-forward - - - - False - True - - - - - - True - Jump to - - True - True - True - False - gtk-jump-to - - - - False - True - - - - - - True - True - True - True - - - False - False - - - - - - True - Close window - - True - True - True - False - gtk-close - - - - False - True - - - - - - - BONOBO_DOCK_TOP - 1 - 0 - 0 - BONOBO_DOCK_ITEM_BEH_EXCLUSIVE - - - - - - True - False - 0 - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - False - 12 - - - - True - Page Number - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - True - True - True - 0 - - True - * - False - - - - 0 - True - True - - - - - - True - True - _Display - True - GTK_RELIEF_NORMAL - True - - - - 0 - False - False - - - - - - - 0 - False - False - - - - - - True - True - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - False - True - - - - - True - False - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - True - True - - - - - 0 - True - True - - - - - - - 0 - True - True - - - - - - True - True - True - - - 0 - True - True - - - - + + + + True + MDB File Viewer + + + True + + + True + + + True + File + + + + + gtk-new + True + True + True + + + + + + True + + + + + gtk-close + True + True + True + + + + + + + + + + True + View + + + + + True + _Dissector + True + True + + + + + + True + _Back + True + + + + + + gtk-new + True + True + True + + + + + + True + + + + + True + _Selected Page + True + + + + + + True + Selected Page (_MSB) + True + + + + + + + + + + True + Help + + + + + gtk-about + True + True + True + + + + + + + + + + False + 0 + + + + + True + + + True + 1 + icons + + + True + Open a new window + True + gtk-new + + + + False + True + + + + + True + + + False + + + + + True + Back + True + gtk-go-back + + + + False + True + + + + + True + Forward + True + gtk-go-forward + + + + False + True + + + + + True + Jump to + True + gtk-jump-to + + + + False + True + + + + + True + + + False + + + + + True + Close window + True + gtk-close + + + + False + True + + + + + + + 1 + + + + + True + + + True + 0 + none + + + True + 12 + + + True + Page Number + + + False + False + 0 + + + + + True + + + False + False + 1 + + + + + True + True + + + + 2 + + + + + _Display + True + True + False + True + + + + False + False + 3 + + + + + + + False + False + 0 + + + + + True + True + + + True + True + automatic + automatic + + + True + True + False + + + + + False + True + + + + + True + True + automatic + automatic + + + True + True + + + + + True + True + + + + + 1 + + + + + 2 + + + + + True + 2 + + + True + + + 0 + + + + + False + 3 + + + + + diff --git a/src/gmdb2/gladefiles/gmdb-export.glade b/src/gmdb2/gladefiles/gmdb-export.glade index d461570..ca0eaff 100644 --- a/src/gmdb2/gladefiles/gmdb-export.glade +++ b/src/gmdb2/gladefiles/gmdb-export.glade @@ -2,7 +2,6 @@ - True @@ -466,36 +465,15 @@ - - - - True - 10 - False - False - - - - True - True - True - True - 0 - - True - * - False - - - - - 1 - 2 - 0 - 1 - - - + + + True + + + 1 + 2 + + 0 diff --git a/src/gmdb2/gladefiles/gmdb-schema.glade b/src/gmdb2/gladefiles/gmdb-schema.glade index f4c17b2..0f36bec 100644 --- a/src/gmdb2/gladefiles/gmdb-schema.glade +++ b/src/gmdb2/gladefiles/gmdb-schema.glade @@ -1,455 +1,525 @@ - - - - - - True - Export Schema - normal - - - True + + + True + Export Schema + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-help + True + GTK_RELIEF_NORMAL + -11 + + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + -6 + + + + + + + True + True + True + GTK_RELIEF_NORMAL + -5 + + + + + True + 0.5 + 0.5 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-convert + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Export + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + 0 + False + True + GTK_PACK_END + + + + + + 33 + True + 5 + 2 + False + 8 + 30 + + + + True + <b>Table:</b> + False + True + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + <b>Schema Dialect:</b> + False + True + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + False + True + False + True + False + + + + True + True + True + True + 0 + Access + True + * + False + + + + + + True + GTK_SELECTION_BROWSE + + + + + 1 + 2 + 1 + 2 + + + + + + + True + True + False + False + True + False + + + + True + True + False + True + 0 + Access + True + * + False + + + + + + True + GTK_SELECTION_BROWSE + + + + True + True + Access + + + + + + True + True + Oracle + + + + + + True + True + Sybase + + + + + + True + True + MS SQL Server + + + + + + True + True + PostgreSQL + + + + + + True + True + MySQL + + + + + + + 1 + 2 + 2 + 3 + + + + + + + True + True + Include Relationships + True + GTK_RELIEF_NORMAL + True + False + True + + + 1 + 2 + 9 + 10 + fill + + + + + + + True + <b>Options:</b> + False + True + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + True + Include Drop Table commands + True + GTK_RELIEF_NORMAL + True + False + True + + + 1 + 2 + 3 + 4 + fill + + + + + + + Include Not Null constraints + True + True + True + True + True + GTK_RELIEF_NORMAL + False + + + 1 + 2 + 4 + 5 + fill + + + + + + + Include indexes + True + True + True + True + True + GTK_RELIEF_NORMAL + False + + + 1 + 2 + 8 + 9 + fill + + + + + + + Include description on tables and columns + True + True + True + True + True + GTK_RELIEF_NORMAL + False + + + 1 + 2 + 7 + 8 + fill + + + + + + + Include Not Empty constraints + True + True + True + True + True + GTK_RELIEF_NORMAL + False + + + 1 + 2 + 6 + 7 + fill + + + + + + + Include Default values + True + True + True + True + True + GTK_RELIEF_NORMAL + False + + + 1 + 2 + 5 + 6 + fill + + + + + + + True + <b>File Name:</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 0 + 1 + fill + + + + - + True - 33 - 10 - 2 - 30 - 8 - - - True - 0 - <b>Table:</b> - True - right - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - <b>Schema Dialect:</b> - True - right - - - 2 - 3 - GTK_FILL - - - - - - True - False - - - True - True - Access - - - 0 - - - - - True - browse - - - - - 1 - 2 - 1 - 2 - - - - - - True - False - False - True - - - True - True - False - Access - - - 0 - - - - - True - browse - - - True - True - Access - - - - - True - True - Oracle - - - - - True - True - Sybase - - - - - True - True - MS SQL Server - - - - - True - True - PostgreSQL - - - - - True - True - MySQL - - - - - - - 1 - 2 - 2 - 3 - - - - - - True - 0 - <b>Options:</b> - True - right - - - 3 - 4 - GTK_FILL - - - - - - True - 0 - <b>File Name:</b> - True - - - GTK_FILL - - - - - - True - 10 - - - True - True - - - - - 1 - 2 - - - - - - Include Drop Table commands - True - True - False - True - True - True - - - 1 - 2 - 3 - 4 - GTK_FILL - - - - - - Include Not Null constraints - True - True - False - True - True - True - - - 1 - 2 - 4 - 5 - GTK_FILL - - - - - - Include Relationships - True - True - False - True - True - True - - - 1 - 2 - 9 - 10 - GTK_FILL - - - - - - Include indexes - True - True - False - True - True - True - - - 1 - 2 - 8 - 9 - GTK_FILL - - - - - - Include description on tables and columns - True - True - False - True - True - True - - - 1 - 2 - 7 - 8 - GTK_FILL - - - - - - - - - - - - - - - - - - - - - - - - Include Not Empty constraints - True - True - False - True - True - True - - - 1 - 2 - 6 - 7 - GTK_FILL - - - - - - Include Default values - True - True - False - True - True - True - - - 1 - 2 - 5 - 6 - GTK_FILL - - - - False - 2 + 1 + 2 - - - True - end - - - gtk-help - -11 - True - True - True - False - True - - - - False - False - 0 - - - - - gtk-cancel - -6 - True - True - True - False - True - - - - False - False - 1 - - - - - -5 - True - True - True - False - - - - True - 0 - 0 - - - True - 2 - - - True - gtk-convert - - - False - False - 0 - - - - - True - _Export - True - - - False - False - 1 - - - - - - - - - False - False - 2 - - - - - False - end - 0 - - - - - + + + 0 + True + False + + + + + + diff --git a/src/gmdb2/gladefiles/gmdb-sql-file.glade b/src/gmdb2/gladefiles/gmdb-sql-file.glade deleted file mode 100644 index 63d6b21..0000000 --- a/src/gmdb2/gladefiles/gmdb-sql-file.glade +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - 10 - True - Open SQL Query - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - - - - True - True - True - GTK_RELIEF_NORMAL - - - - - - - True - True - True - GTK_RELIEF_NORMAL - - - - - diff --git a/src/gmdb2/gladefiles/gmdb-sql.glade b/src/gmdb2/gladefiles/gmdb-sql.glade index c13e6a5..52d7882 100644 --- a/src/gmdb2/gladefiles/gmdb-sql.glade +++ b/src/gmdb2/gladefiles/gmdb-sql.glade @@ -1,525 +1,420 @@ - - - + - - - - - True - MDB Query Tool - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - - - - True - True - - - - True - GTK_SHADOW_NONE - - - - True - - - - True - _Query - True - - - - - - - True - GNOMEUIINFO_MENU_NEW_ITEM - _New - True - - - - - - - True - GNOMEUIINFO_MENU_OPEN_ITEM - - - - - - True - GNOMEUIINFO_MENU_SAVE_ITEM - - - - - - True - GNOMEUIINFO_MENU_SAVE_AS_ITEM - - - - - - True - Save _Results... - True - - - - True - stock_export-16.png - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - - - - - - True - _Execute - True - - - - - True - gtk-execute - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - - - - - - True - GNOMEUIINFO_MENU_CLOSE_ITEM - - - - - - - - - - True - GNOMEUIINFO_MENU_EDIT_TREE - - - - - - - True - GNOMEUIINFO_MENU_CUT_ITEM - - - - - - True - GNOMEUIINFO_MENU_COPY_ITEM - - - - - - True - GNOMEUIINFO_MENU_PASTE_ITEM - - - - - - - - - - True - GNOMEUIINFO_MENU_HELP_TREE - - - - - - - True - GNOMEUIINFO_MENU_ABOUT_ITEM - - - - - - - - - - - - BONOBO_DOCK_TOP - 0 - 0 - 0 - BONOBO_DOCK_ITEM_BEH_EXCLUSIVE|BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL|BONOBO_DOCK_ITEM_BEH_LOCKED - - - - - - True - GTK_SHADOW_OUT - - - - 1 - True - GTK_ORIENTATION_HORIZONTAL - GTK_TOOLBAR_ICONS - True - - - - True - Start new query - gtk-new - - - - - - - True - Load query from file - gtk-open - - - - - - True - Save query to file - Save Results - True - gtk-save - - - - - - True - Execute query - gtk-execute - - - True - - - - - - True - Save results to a file - Save Results - True - stock_export.png - - - - - - True - Close this window - gtk-close - - - True - - - - - - - BONOBO_DOCK_TOP - 1 - 0 - 0 - BONOBO_DOCK_ITEM_BEH_EXCLUSIVE - - - - - - True - True - - - - True - True - 0 - - - - 5 - True - 0 - 0.5 - GTK_SHADOW_IN - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - False - True - - - - - - - True - False - - - - - - True - False - 0 - - - - 4 - True - 0 - 0.5 - GTK_SHADOW_IN - - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - 50 - True - True - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - 0 - True - True - - - - - - 5 - True - False - 0 - - - - True - Recent Queries: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - False - True - False - True - False - - - - 24 - True - Recently Executed Queries - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - - 0 - True - True - - - - - 0 - False - False - - - - - True - True - - - - - True - False - - - - - - 3 - True - 0 - 0.5 - GTK_SHADOW_IN - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - - - - - - - True - True - - - - - - - 0 - True - True - - - - - - True - True - True - - - 0 - True - True - - - - + + + + True + MDB File Viewer + + + True + + + True + + + True + _Query + True + + + + + gtk-new + True + True + True + + + + + + gtk-open + True + True + True + + + + + gtk-save + True + True + True + + + + + gtk-save-as + True + True + True + + + + + Save _Results... + True + True + False + + + True + stock_export-16.png + + + + + + + True + + + + + gtk-execute + True + True + True + + + + + + True + + + + + gtk-close + True + True + True + + + + + + + + + True + Edit + + + + + gtk-cut + True + True + True + + + + + gtk-copy + True + True + True + + + + + gtk-paste + True + True + True + + + + + + + + + True + Help + + + + + gtk-about + True + True + True + + + + + + + + + + False + 0 + + + + + True + + + True + 1 + icons + + + True + Start new query + gtk-new + + + + False + True + + + + + True + Load query from file + gtk-open + + + False + True + + + + + True + Save query to file + Save Results + True + gtk-save + + + False + True + + + + + True + Execute query + gtk-execute + + + False + True + + + + + True + Save results to a file + Save Results + True + stock_export.png + + + False + True + + + + + True + Close this window + gtk-close + + + False + True + + + + + + + 1 + + + + + True + True + + + True + True + + + True + 5 + 0 + in + + + True + True + automatic + automatic + + + True + True + False + + + + + + + False + True + + + + + True + + + True + 4 + 0 + in + + + True + True + never + automatic + + + 50 + True + True + + + + + + + 0 + + + + + True + 5 + + + True + Recent Queries: + + + False + False + 0 + + + + + True + False + + + 24 + True + True + Recently Executed Queries + + + 0 + + + + + True + browse + + + + + 1 + + + + + False + False + 1 + + + + + True + True + + + + + False + True + + + + + True + 3 + 0 + in + + + True + True + automatic + automatic + + + True + True + + + + + + + True + True + + + + + 2 + + + + + True + 2 + + + True + + + 0 + + + + + False + 3 + + + + + diff --git a/src/gmdb2/gmdb.h b/src/gmdb2/gmdb.h index f162a75..c6f6f40 100644 --- a/src/gmdb2/gmdb.h +++ b/src/gmdb2/gmdb.h @@ -33,7 +33,6 @@ void gmdb_table_export_populate_dialog(GladeXML *xml); /* file.c */ void gmdb_file_select_cb(GtkWidget *w, gpointer data); -void gmdb_file_open_cb(GtkWidget *w, gpointer data); void gmdb_file_close_cb(GtkWidget *w, gpointer data); void gmdb_file_open_recent_1(void); void gmdb_file_open_recent_2(void); diff --git a/src/gmdb2/main2.c b/src/gmdb2/main2.c index ecee8c5..6ce38d5 100644 --- a/src/gmdb2/main2.c +++ b/src/gmdb2/main2.c @@ -45,6 +45,7 @@ const gchar *authors[] = { "Brian Bruns", "Jeff Smith", "Filip Van Raemdonck", + "Bernhard Reiter", NULL }; const gchar *documenters[] = { diff --git a/src/gmdb2/schema.c b/src/gmdb2/schema.c index 01b7f1a..2ccd925 100644 --- a/src/gmdb2/schema.c +++ b/src/gmdb2/schema.c @@ -76,13 +76,13 @@ FILE *outfile; void gmdb_schema_export_cb(GtkWidget *w, gpointer data) { -GtkWidget *schemawin, *combo, *checkbox, *entry; +GtkWidget *schemawin, *combo, *checkbox, *chooser; int i; 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)),PATH_MAX); + chooser = glade_xml_get_widget (schemawin_xml, "filechooserbutton1"); + strncpy(file_path,gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser)),PATH_MAX); file_path[PATH_MAX]=0; combo = glade_xml_get_widget (schemawin_xml, "table_combo"); diff --git a/src/gmdb2/sql.c b/src/gmdb2/sql.c index 3bce30b..8f89a39 100644 --- a/src/gmdb2/sql.c +++ b/src/gmdb2/sql.c @@ -147,34 +147,6 @@ gmdb_sql_write_rslt_cb(GtkWidget *w, GladeXML *xml) gtk_widget_destroy (dlg); } static void -gmdb_sql_write_cb(GtkWidget *w, GladeXML *xml) -{ - gchar *file_path; - GladeXML *sql_xml; - GtkWidget *filesel; - - filesel = glade_xml_get_widget (xml, "file_dialog"); - file_path = (gchar *) gtk_file_selection_get_filename (GTK_FILE_SELECTION(filesel)); - sql_xml = g_object_get_data(G_OBJECT(filesel), "sql_xml"); - gmdb_sql_save_query(sql_xml, file_path); - - gtk_widget_destroy(filesel); -} -static void -gmdb_sql_load_cb(GtkWidget *w, GladeXML *xml) -{ - gchar *file_path; - GladeXML *sql_xml; - GtkWidget *filesel; - - filesel = glade_xml_get_widget (xml, "file_dialog"); - file_path = (gchar *) gtk_file_selection_get_filename (GTK_FILE_SELECTION(filesel)); - sql_xml = g_object_get_data(G_OBJECT(filesel), "sql_xml"); - gmdb_sql_load_query(sql_xml, file_path); - - gtk_widget_destroy(filesel); -} -static void gmdb_sql_results_cb(GtkWidget *w, GladeXML *xml) { GladeXML *dialog_xml; @@ -220,42 +192,45 @@ gmdb_sql_save_cb(GtkWidget *w, GladeXML *xml) void gmdb_sql_save_as_cb(GtkWidget *w, GladeXML *xml) { - GladeXML *dialog_xml; - GtkWidget *but; - GtkWidget *filesel; + GtkWindow *parent_window = (GtkWindow *) glade_xml_get_widget (xml, "gmdb"); + GtkWidget *dialog = gtk_file_chooser_dialog_new ("Save Query As", + parent_window, + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, + NULL); - /* load the interface */ - dialog_xml = glade_xml_new(GMDB_GLADEDIR "gmdb-sql-file.glade", NULL, NULL); - /* connect the signals in the interface */ - glade_xml_signal_autoconnect(dialog_xml); + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) + { + char *filename; - filesel = glade_xml_get_widget (dialog_xml, "file_dialog"); - gtk_window_set_title(GTK_WINDOW(filesel), "Save Query As"); + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + gmdb_sql_save_query(xml, filename); + } - but = glade_xml_get_widget (dialog_xml, "ok_button"); - g_signal_connect (G_OBJECT (but), "clicked", - G_CALLBACK (gmdb_sql_write_cb), dialog_xml); - - g_object_set_data(G_OBJECT(filesel), "sql_xml", xml); + gtk_widget_destroy (dialog); } static void gmdb_sql_open_cb(GtkWidget *w, GladeXML *xml) { - GladeXML *dialog_xml; - GtkWidget *but; - GtkWidget *filesel; + GtkWindow *parent_window = (GtkWindow *) glade_xml_get_widget (xml, "gmdb"); + GtkWidget *dialog = gtk_file_chooser_dialog_new ("Open SQL Query", + parent_window, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); - /* load the interface */ - dialog_xml = glade_xml_new(GMDB_GLADEDIR "gmdb-sql-file.glade", NULL, NULL); - /* connect the signals in the interface */ - glade_xml_signal_autoconnect(dialog_xml); + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) + { + char *filename; - but = glade_xml_get_widget (dialog_xml, "ok_button"); - g_signal_connect (G_OBJECT (but), "clicked", - G_CALLBACK (gmdb_sql_load_cb), dialog_xml); + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + gmdb_sql_load_query(xml, filename); + } + + gtk_widget_destroy (dialog); - filesel = glade_xml_get_widget (dialog_xml, "file_dialog"); - g_object_set_data(G_OBJECT(filesel), "sql_xml", xml); } static void gmdb_sql_copy_cb(GtkWidget *w, GladeXML *xml) @@ -521,9 +496,9 @@ gmdb_sql_new_cb(GtkWidget *w, gpointer data) g_signal_connect (G_OBJECT (mi), "activate", G_CALLBACK (gmdb_sql_save_as_cb), sqlwin_xml); - but = glade_xml_get_widget (sqlwin_xml, "save_as_button"); - g_signal_connect (G_OBJECT (but), "clicked", - G_CALLBACK (gmdb_sql_save_as_cb), sqlwin_xml); + //but = glade_xml_get_widget (sqlwin_xml, "save_as_button"); + //g_signal_connect (G_OBJECT (but), "clicked", + // G_CALLBACK (gmdb_sql_save_as_cb), sqlwin_xml); mi = glade_xml_get_widget (sqlwin_xml, "results_menu"); g_signal_connect (G_OBJECT (mi), "activate", diff --git a/src/gmdb2/table_export.c b/src/gmdb2/table_export.c index 1d9479c..400e9e8 100644 --- a/src/gmdb2/table_export.c +++ b/src/gmdb2/table_export.c @@ -129,10 +129,10 @@ gmdb_export_get_headers(GladeXML *xml) gchar * gmdb_export_get_filepath(GladeXML *xml) { - GtkWidget *fentry; + GtkWidget *fchoose; - fentry = glade_xml_get_widget(xml, "filename_entry"); - return (gchar *) gtk_entry_get_text(GTK_ENTRY(fentry)); + fchoose = glade_xml_get_widget(xml, "filechooserbutton1"); + return (gchar *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (fchoose)); } void