Debian patches 038-removals and 041-eggiconlist source unattributed

This commit is contained in:
root 2010-06-20 18:22:16 -04:00
parent 87af69a15e
commit 751541169c
13 changed files with 179 additions and 488 deletions

View File

@ -119,7 +119,7 @@ if test "$no_glib" = "yes"; then
exit 1
fi
PKG_CHECK_MODULES(GNOME,libglade-2.0 libgnomeui-2.0, HAVE_GNOME=true, HAVE_GNOME=false)
PKG_CHECK_MODULES(GNOME,gtk+-2.0 >= 2.5 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]),

View File

@ -1,8 +1,9 @@
SUBDIRS = help gladefiles pixmaps
bin_PROGRAMS = gmdb2
include_HEADERS = gmdb.h
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 prefs.c
LIBS = -rdynamic $(GNOME_LIBS) @LIBS@ @LEXLIB@
gmdb2_SOURCES = main2.c file.c util.c table.c info.c table_def.c table_data.c table_export.c debug.c sql.c schema.c prefs.c
LIBS = -rdynamic $(GNOME_LIBS) @LIBS@ @LEXLIB@
AM_CPPFLAGS = -I$(top_srcdir)/include \
$(GNOME_CFLAGS) \
-DDATADIR="\"$(datadir)\"" \

View File

@ -18,6 +18,8 @@
#include "gmdb.h"
#include <mdbtools.h>
#include <gtk/gtkiconview.h>
#include <gtk/gtkliststore.h>
#include <gtk/gtkmessagedialog.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-config.h>
@ -27,6 +29,14 @@ MdbHandle *mdb;
extern int main_show_debug;
extern GladeXML *mainwin_xml;
#define MAX_ACTIONITEMS 7
#define MAX_ICONVIEWS 6
typedef struct {
GtkWidget* actionitems[MAX_ACTIONITEMS];
GtkWidget* iconviews[MAX_ICONVIEWS];
} GmdbWidgets;
GmdbWidgets* gmdbwidgets = NULL;
static void gmdb_file_open_recent(gchar *menuname)
{
gchar *text, cfgname[100];
@ -103,15 +113,98 @@ gmdb_file_add_recent(gchar *file_path)
gnome_config_set_string("/gmdb/RecentFiles/menu_recent1.filepath", file_path);
gnome_config_sync();
}
static void
gmdb_reset_widgets (GmdbWidgets* gw) {
int i;
GtkWidget *w;
gmdb_table_set_sensitive (FALSE);
for (i = 0; i < MAX_ACTIONITEMS; ++i) {
w = gw->actionitems[i];
gtk_widget_set_sensitive (w, FALSE);
}
for (i = 0; i < MAX_ICONVIEWS; ++i) {
w = gw->iconviews[i];
gtk_list_store_clear (GTK_LIST_STORE (gtk_icon_view_get_model (GTK_ICON_VIEW (w))));
}
w = glade_xml_get_widget (mainwin_xml, "gmdb");
gtk_window_set_title (GTK_WINDOW (w), "MDB File Viewer");
}
static void
gmdb_icon_list_fill (MdbHandle* mdb, GtkTreeModel* store, GdkPixbuf* pixbuf, int objtype) {
int i;
MdbCatalogEntry* entry;
GtkTreeIter iter;
for (i=0; i < mdb->num_catalog; i++) {
entry = g_ptr_array_index (mdb->catalog, i);
if (entry->object_type == objtype) {
/* skip the MSys tables - FIXME: can other objects be hidden too? */
if (objtype != MDB_TABLE || mdb_is_user_table (entry)) {
gtk_list_store_prepend (GTK_LIST_STORE (store), &iter);
gtk_list_store_set (GTK_LIST_STORE (store), &iter, 0, pixbuf, 1, entry->object_name, -1);
}
}
}
}
static void
gmdb_file_init (void) {
GtkWidget* w;
GtkListStore* store;
int i;
gchar* ainames[] = { "sql_menu", "debug_menu", "schema_menu", "info_menu", "sql_button", "schema_button", "info_button" };
gchar* swnames[] = { "sw_form", "sw_macro", "sw_module", "sw_query", "sw_report", "sw_table" };
if (gmdbwidgets) {
return;
}
gmdbwidgets = g_new0 (GmdbWidgets, 1);
for (i = 0; i < MAX_ACTIONITEMS; ++i) {
gmdbwidgets->actionitems[i] = glade_xml_get_widget (mainwin_xml, ainames[i]);
}
for (i = 0; i < MAX_ICONVIEWS; ++i) {
store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
gmdbwidgets->iconviews[i] = gtk_icon_view_new();
gtk_icon_view_set_model (GTK_ICON_VIEW (gmdbwidgets->iconviews[i]), GTK_TREE_MODEL (store));
gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (gmdbwidgets->iconviews[i]), 0);
gtk_icon_view_set_text_column (GTK_ICON_VIEW (gmdbwidgets->iconviews[i]), 1);
w = glade_xml_get_widget (mainwin_xml, swnames[i]);
gtk_container_add (GTK_CONTAINER (w), gmdbwidgets->iconviews[i]);
gtk_widget_show_all (w);
}
g_signal_connect_after (gmdbwidgets->iconviews[5], "selection-changed", G_CALLBACK (gmdb_table_select_cb), NULL);
gmdb_table_init_popup (gmdbwidgets->iconviews[5]);
}
void
gmdb_file_open(gchar *file_path)
{
GtkWidget *win;
GdkPixbuf *pixbuf;
GtkTreeModel *store;
gchar *file_name;
gchar title[100];
int i;
gchar* pbnames[] = { GMDB_ICONDIR "form_big.xpm", GMDB_ICONDIR "macro_big.xpm",
GMDB_ICONDIR "module_big.xpm", GMDB_ICONDIR "query_big.xpm", GMDB_ICONDIR "report_big.xpm",
GMDB_ICONDIR "table_big.xpm" };
int objtype[] = { MDB_FORM, MDB_MACRO, MDB_MODULE, MDB_QUERY, MDB_REPORT, MDB_TABLE };
gmdb_reset_widgets();
if (!gmdbwidgets) {
gmdb_file_init();
}
gmdb_reset_widgets (gmdbwidgets);
mdb = mdb_open(file_path, MDB_NOFLAGS);
if (!mdb) {
GtkWidget* dlg = gtk_message_dialog_new (NULL,
@ -127,12 +220,14 @@ gmdb_file_open(gchar *file_path)
sql->mdb = mdb;
mdb_read_catalog(mdb, MDB_ANY);
gmdb_table_populate(mdb);
gmdb_query_populate(mdb);
gmdb_form_populate(mdb);
gmdb_report_populate(mdb);
gmdb_macro_populate(mdb);
gmdb_module_populate(mdb);
for (i = 0; i < MAX_ICONVIEWS; ++i) {
store = gtk_icon_view_get_model (GTK_ICON_VIEW (gmdbwidgets->iconviews[i]));
pixbuf = gdk_pixbuf_new_from_file (pbnames[i], NULL);
gmdb_icon_list_fill (mdb, store, pixbuf, objtype[i]);
g_object_unref (pixbuf);
}
//if (main_show_debug) gmdb_debug_init(mdb);
for (i=strlen(file_path);i>0 && file_path[i-1]!='/';i--);
@ -142,7 +237,10 @@ gmdb_file_open(gchar *file_path)
g_snprintf(title, 100, "%s - MDB File Viewer",file_name);
gtk_window_set_title(GTK_WINDOW(win), title);
gmdb_set_sensitive(TRUE);
for (i = 0; i < MAX_ACTIONITEMS; ++i) {
win = gmdbwidgets->actionitems[i];
gtk_widget_set_sensitive (win, TRUE);
}
}
void
@ -180,7 +278,7 @@ gmdb_file_select_cb(GtkWidget *button, gpointer data)
void
gmdb_file_close_cb(GtkWidget *button, gpointer data)
{
gmdb_reset_widgets();
gmdb_reset_widgets (gmdbwidgets);
gmdb_debug_close_all();
gmdb_sql_close_all();
}

View File

@ -1,48 +0,0 @@
/* MDB Tools - A library for reading MS Access database file
* Copyright (C) 2000 Brian Bruns
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "gmdb.h"
#include <glade/glade.h>
extern GladeXML* mainwin_xml;
extern GtkWidget *app;
static void
gmdb_form_add_icon(gchar *text)
{
GnomeIconList *gil;
gil = (GnomeIconList *) glade_xml_get_widget(mainwin_xml, "form_iconlist");
gnome_icon_list_append(gil, GMDB_ICONDIR "form_big.xpm", text);
}
void gmdb_form_populate(MdbHandle *mdb)
{
int i;
MdbCatalogEntry *entry;
/* 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 form */
if (entry->object_type == MDB_FORM) {
/* add table to tab */
gmdb_form_add_icon(entry->object_name);
} /* if MDB_FORM */
} /* for */
}

View File

@ -54,6 +54,7 @@
<child>
<widget class="GtkImageMenuItem" id="info_menu">
<property name="visible">True</property>
<property name="sensitive">False</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"/>
</widget>
@ -169,6 +170,7 @@
<child>
<widget class="GtkImageMenuItem" id="sql_menu">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="label" translatable="yes">S_QL Window</property>
<property name="use_underline">True</property>
<signal name="activate" handler="gmdb_sql_new_cb" last_modification_time="Sat, 28 Dec 2002 16:54:54 GMT"/>
@ -190,6 +192,7 @@
<child>
<widget class="GtkImageMenuItem" id="debug_menu">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="label" translatable="yes">_Debug Window</property>
<property name="use_underline">True</property>
<signal name="activate" handler="gmdb_debug_new_cb" last_modification_time="Sat, 21 Dec 2002 17:41:42 GMT"/>
@ -210,6 +213,7 @@
<child>
<widget class="GtkImageMenuItem" id="schema_menu">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="label" translatable="yes">E_xport Schema</property>
<property name="use_underline">True</property>
<signal name="activate" handler="gmdb_schema_new_cb" last_modification_time="Sun, 29 Dec 2002 20:35:14 GMT"/>
@ -315,6 +319,7 @@
<child>
<widget class="GtkToolButton" id="info_button">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="tooltip" translatable="yes">View database file properties</property>
<property name="stock-id">gtk-properties</property>
<signal name="clicked" handler="gmdb_info_cb" last_modification_time="Sun, 29 Dec 2002 03:21:29 GMT"/>
@ -333,6 +338,7 @@
<child>
<widget class="GtkToolButton" id="sql_button">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="tooltip" translatable="yes">Perform SQL query</property>
<property name="stock-id">gtk-execute</property>
<signal name="clicked" handler="gmdb_sql_new_cb" last_modification_time="Sun, 29 Dec 2002 03:23:01 GMT"/>
@ -345,6 +351,7 @@
<child>
<widget class="GtkToolButton" id="schema_button">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="tooltip" translatable="yes">Export schema definition</property>
<property name="stock-id">gtk-convert</property>
<signal name="clicked" handler="gmdb_schema_new_cb" last_modification_time="Sun, 29 Dec 2002 20:34:50 GMT"/>
@ -404,7 +411,7 @@
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<widget class="GtkScrolledWindow" id="sw_table">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@ -412,21 +419,6 @@
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GnomeIconList" id="table_iconlist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">GTK_SELECTION_SINGLE</property>
<property name="icon_width">78</property>
<property name="row_spacing">8</property>
<property name="column_spacing">8</property>
<property name="text_spacing">2</property>
<property name="text_editable">False</property>
<property name="text_static">True</property>
<signal name="select_icon" handler="gmdb_table_select_cb" after="yes" last_modification_time="Fri, 20 Dec 2002 16:45:49 GMT"/>
<signal name="unselect_icon" handler="gmdb_table_unselect_cb" after="yes" last_modification_time="Sat, 11 Jan 2003 18:27:12 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
@ -571,7 +563,7 @@
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow9">
<widget class="GtkScrolledWindow" id="sw_query">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@ -579,19 +571,6 @@
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GnomeIconList" id="query_iconlist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">GTK_SELECTION_SINGLE</property>
<property name="icon_width">78</property>
<property name="row_spacing">8</property>
<property name="column_spacing">8</property>
<property name="text_spacing">2</property>
<property name="text_editable">False</property>
<property name="text_static">False</property>
</widget>
</child>
</widget>
</child>
</widget>
@ -692,7 +671,7 @@
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow3">
<widget class="GtkScrolledWindow" id="sw_form">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@ -700,19 +679,6 @@
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GnomeIconList" id="form_iconlist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">GTK_SELECTION_SINGLE</property>
<property name="icon_width">78</property>
<property name="row_spacing">8</property>
<property name="column_spacing">8</property>
<property name="text_spacing">2</property>
<property name="text_editable">False</property>
<property name="text_static">False</property>
</widget>
</child>
</widget>
</child>
</widget>
@ -813,7 +779,7 @@
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow7">
<widget class="GtkScrolledWindow" id="sw_report">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@ -821,19 +787,6 @@
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GnomeIconList" id="report_iconlist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">GTK_SELECTION_SINGLE</property>
<property name="icon_width">78</property>
<property name="row_spacing">8</property>
<property name="column_spacing">8</property>
<property name="text_spacing">2</property>
<property name="text_editable">False</property>
<property name="text_static">False</property>
</widget>
</child>
</widget>
</child>
</widget>
@ -934,7 +887,7 @@
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow6">
<widget class="GtkScrolledWindow" id="sw_macro">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@ -942,19 +895,6 @@
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GnomeIconList" id="macro_iconlist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">GTK_SELECTION_SINGLE</property>
<property name="icon_width">78</property>
<property name="row_spacing">8</property>
<property name="column_spacing">8</property>
<property name="text_spacing">2</property>
<property name="text_editable">False</property>
<property name="text_static">False</property>
</widget>
</child>
</widget>
</child>
</widget>
@ -1055,7 +995,7 @@
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow8">
<widget class="GtkScrolledWindow" id="sw_module">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@ -1063,19 +1003,6 @@
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GnomeIconList" id="module_iconlist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">GTK_SELECTION_SINGLE</property>
<property name="icon_width">78</property>
<property name="row_spacing">8</property>
<property name="column_spacing">8</property>
<property name="text_spacing">2</property>
<property name="text_editable">False</property>
<property name="text_static">False</property>
</widget>
</child>
</widget>
</child>
</widget>

View File

@ -5,7 +5,6 @@
#include <sys/stat.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include <gnome.h>
#include <glade/glade.h>
#ifndef _gmdb_h_
@ -24,8 +23,6 @@ void gmdb_prefs_cb(GtkWidget *w, gpointer data);
void gmdb_help_cb(GtkWidget *w, gpointer data);
void gmdb_about_cb(GtkWidget *w, gpointer data);
void gmdb_load_recent_files(void);
void gmdb_reset_widgets(void);
void gmdb_set_sensitive(gboolean b);
GtkWidget *gmdb_table_data_new(MdbCatalogEntry *entry);
GtkWidget *gmdb_table_def_new(MdbCatalogEntry *entry);
@ -46,13 +43,6 @@ void gmdb_file_open(gchar *file_path);
void gmdb_sql_new_window_cb(GtkWidget *w, gpointer data);
void gmdb_table_populate(MdbHandle *mdb);
void gmdb_form_populate(MdbHandle *mdb);
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_table_add_tab(GtkWidget *notebook);
void gmdb_debug_tab_new(GtkWidget *notebook);
@ -85,11 +75,11 @@ void gmdb_schema_help_cb(GtkWidget *w, gpointer data);
/* table.c */
void gmdb_table_debug_cb(GtkList *list, GtkWidget *w, gpointer data);
void gmdb_table_export_cb(GtkList *list, GtkWidget *w, gpointer data);
void gmdb_table_unselect_cb(GnomeIconList *gil, int num, GdkEvent *ev, gpointer data);
void gmdb_table_select_cb(GnomeIconList *gil, int num, GdkEvent *ev, gpointer data);
void gmdb_table_def_cb(GtkList *list, GtkWidget *w, gpointer data);
void gmdb_table_unselect_cb (GtkIconView*, gpointer);
void gmdb_table_select_cb (GtkIconView*, gpointer);
void gmdb_table_data_cb(GtkList *list, GtkWidget *w, gpointer data);
void gmdb_table_init_popup(void);
void gmdb_table_init_popup (GtkWidget*);
void gmdb_table_set_sensitive(gboolean b);
/* table_export.c */
@ -103,13 +93,6 @@ char gmdb_export_get_quotechar(GladeXML *xml);
int gmdb_export_get_headers(GladeXML *xml);
gchar *gmdb_export_get_filepath(GladeXML *xml);
extern GtkWidget *table_list;
extern GtkWidget *form_list;
extern GtkWidget *query_list;
extern GtkWidget *report_list;
extern GtkWidget *macro_list;
extern GtkWidget *module_list;
extern MdbSQL *sql;
#ifdef __cplusplus

View File

@ -1,48 +0,0 @@
/* MDB Tools - A library for reading MS Access database file
* Copyright (C) 2000 Brian Bruns
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "gmdb.h"
#include <glade/glade.h>
extern GladeXML* mainwin_xml;
extern GtkWidget *app;
static void
gmdb_macro_add_icon(gchar *text)
{
GnomeIconList *gil;
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "macro_iconlist");
gnome_icon_list_append(gil, GMDB_ICONDIR "macro_big.xpm", text);
}
void gmdb_macro_populate(MdbHandle *mdb)
{
int i;
MdbCatalogEntry *entry;
/* 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 macro */
if (entry->object_type == MDB_MACRO) {
/* add table to tab */
gmdb_macro_add_icon(entry->object_name);
} /* if MDB_MACRO */
} /* for */
}

View File

@ -123,64 +123,6 @@ gchar *text, *text2;
g_free(text);
}
}
void
gmdb_reset_widgets()
{
GnomeIconList *gil;
GtkWidget *win;
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "table_iconlist");
gnome_icon_list_clear(gil);
gmdb_table_set_sensitive(FALSE);
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "query_iconlist");
gnome_icon_list_clear(gil);
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "form_iconlist");
gnome_icon_list_clear(gil);
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "report_iconlist");
gnome_icon_list_clear(gil);
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "macro_iconlist");
gnome_icon_list_clear(gil);
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "module_iconlist");
gnome_icon_list_clear(gil);
win = (GtkWidget *) glade_xml_get_widget (mainwin_xml, "gmdb");
gtk_window_set_title(GTK_WINDOW(win), "MDB File Viewer");
gmdb_set_sensitive(FALSE);
}
void
gmdb_set_sensitive(gboolean b)
{
GtkWidget *mi, *button;
mi = (GtkWidget *) glade_xml_get_widget (mainwin_xml, "sql_menu");
gtk_widget_set_sensitive(mi,b);
mi = (GtkWidget *) glade_xml_get_widget (mainwin_xml, "debug_menu");
gtk_widget_set_sensitive(mi,b);
mi = (GtkWidget *) glade_xml_get_widget (mainwin_xml, "schema_menu");
gtk_widget_set_sensitive(mi,b);
mi = (GtkWidget *) glade_xml_get_widget (mainwin_xml, "info_menu");
gtk_widget_set_sensitive(mi,b);
button = (GtkWidget *) glade_xml_get_widget (mainwin_xml, "sql_button");
gtk_widget_set_sensitive(button,b);
button = (GtkWidget *) glade_xml_get_widget (mainwin_xml, "schema_button");
gtk_widget_set_sensitive(button,b);
button = (GtkWidget *) glade_xml_get_widget (mainwin_xml, "info_button");
gtk_widget_set_sensitive(button,b);
}
static void
gmdb_init_popups()
{
gmdb_table_init_popup();
}
static void
gmdb_load_icons(GladeXML *xml)
@ -260,12 +202,9 @@ GnomeProgram *program;
if (argc>1) {
gmdb_file_open(argv[1]);
} else {
gmdb_reset_widgets();
}
gmdb_load_recent_files();
gmdb_init_popups();
/* start the event loop */
gtk_main();

View File

@ -1,48 +0,0 @@
/* MDB Tools - A library for reading MS Access database file
* Copyright (C) 2000 Brian Bruns
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "gmdb.h"
#include <glade/glade.h>
extern GladeXML* mainwin_xml;
extern GtkWidget *app;
static void
gmdb_module_add_icon(gchar *text)
{
GnomeIconList *gil;
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "module_iconlist");
gnome_icon_list_append(gil, GMDB_ICONDIR "module_big.xpm", text);
}
void gmdb_module_populate(MdbHandle *mdb)
{
int i;
MdbCatalogEntry *entry;
/* 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 module */
if (entry->object_type == MDB_MODULE) {
/* add table to tab */
gmdb_module_add_icon(entry->object_name);
} /* if MDB_MODULE */
} /* for */
}

View File

@ -17,6 +17,8 @@
*/
#include "gmdb.h"
#include <libgnome/gnome-config.h>
extern GtkWidget *app;
extern MdbHandle *mdb;

View File

@ -1,49 +0,0 @@
/* MDB Tools - A library for reading MS Access database file
* Copyright (C) 2000 Brian Bruns
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "gmdb.h"
#include <glade/glade.h>
extern GladeXML* mainwin_xml;
GtkWidget *query_list;
extern GtkWidget *app;
static void
gmdb_query_add_icon(gchar *text)
{
GnomeIconList *gil;
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "query_iconlist");
gnome_icon_list_append(gil, GMDB_ICONDIR "query_big.xpm", text);
}
void gmdb_query_populate(MdbHandle *mdb)
{
int i;
MdbCatalogEntry *entry;
/* 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 query */
if (entry->object_type == MDB_QUERY) {
gmdb_query_add_icon(entry->object_name);
} /* if MDB_QUERY */
} /* for */
}

View File

@ -1,48 +0,0 @@
/* MDB Tools - A library for reading MS Access database file
* Copyright (C) 2000 Brian Bruns
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "gmdb.h"
#include <glade/glade.h>
extern GladeXML* mainwin_xml;
extern GtkWidget *app;
static void
gmdb_report_add_icon(gchar *text)
{
GnomeIconList *gil;
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "report_iconlist");
gnome_icon_list_append(gil, GMDB_ICONDIR "report_big.xpm", text);
}
void gmdb_report_populate(MdbHandle *mdb)
{
int i;
MdbCatalogEntry *entry;
/* 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 report */
if (entry->object_type == MDB_REPORT) {
/* add table to tab */
gmdb_report_add_icon(entry->object_name);
} /* if MDB_REPORT */
} /* for */
}

View File

@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "gmdb.h"
#include <gtk/gtkiconview.h>
#include <glade/glade.h>
GtkWidget *table_list;
@ -83,23 +85,36 @@ MdbCatalogEntry *entry;
gmdb_table_data_new(entry);
}
void
gmdb_table_unselect_cb(GnomeIconList *gil, int num, GdkEvent *ev, gpointer data)
{
selected_table = -1;
gmdb_table_set_sensitive(FALSE);
}
void
gmdb_table_select_cb(GnomeIconList *gil, int num, GdkEvent *ev, gpointer data)
{
gmdb_table_select_cb (GtkIconView* giv, gpointer data) {
int i;
MdbCatalogEntry *entry;
gchar *text;
text = (gchar *) gnome_icon_list_get_icon_data(gil, num);
GList *selection;
GtkTreeModel *store;
GtkTreePath *path;
GtkTreeIter iter;
selected_table = -1;
selection = gtk_icon_view_get_selected_items (giv);
if (g_list_length (selection) < 1) {
gmdb_table_set_sensitive (FALSE);
g_list_free (selection);
return;
}
store = gtk_icon_view_get_model (giv);
path = (GtkTreePath*) selection->data;
if (!gtk_tree_model_get_iter (store, &iter, path)) {
/* FIXME */
g_error ("Failed to get selection iter!!!");
g_list_foreach (selection, (GFunc) gtk_tree_path_free, NULL);
g_list_free (selection);
}
gtk_tree_model_get (store, &iter, 1, &text, -1);
for (i=0;i<mdb->num_catalog;i++) {
entry = g_ptr_array_index(mdb->catalog,i);
if (entry->object_type==MDB_TABLE &&
@ -107,36 +122,32 @@ gmdb_table_select_cb(GnomeIconList *gil, int num, GdkEvent *ev, gpointer data)
selected_table = i;
}
}
g_free (text);
if (selected_table>0) {
gmdb_table_set_sensitive(TRUE);
} else {
gmdb_table_set_sensitive(FALSE);
}
}
static gboolean
gmdb_table_popup_cb(GtkWidget *menu, GdkEvent *event)
{
GdkEventButton *event_button;
GnomeIconList *gil;
gdouble x,y;
int num;
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "table_iconlist");
if (selected_table == -1) return FALSE;
g_list_foreach (selection, (GFunc) gtk_tree_path_free, NULL);
g_list_free (selection);
}
static gboolean
gmdb_table_popup_cb (GtkIconView* giv, GdkEvent* event, gpointer data) {
GtkWidget* menu = GTK_WIDGET (data);
GdkEventButton *event_button;
int num;
if (event->type == GDK_BUTTON_PRESS) {
event_button = (GdkEventButton *) event;
x = event_button->x;
y = event_button->y;
num = gnome_icon_list_get_icon_at(gil, x, y);
if (num != -1) {
gnome_icon_list_select_icon(gil, num);
}
if (event_button->button == 3) {
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
event_button->button, event_button->time);
return TRUE;
GtkTreePath *path = gtk_icon_view_get_path_at_pos (giv, (gint) event_button->x, (gint) event_button->y);
if (path) {
gtk_icon_view_select_path (giv, path);
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event_button->button, event_button->time);
return TRUE;
}
}
}
return FALSE;
@ -157,29 +168,26 @@ gmdb_table_set_sensitive(gboolean b)
gtk_widget_set_sensitive(button,b);
}
void
gmdb_table_init_popup()
{
GnomeIconList *gil;
gmdb_table_init_popup (GtkWidget* w) {
GtkWidget *menu, *mi;
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "table_iconlist");
GtkIconView *giv = GTK_ICON_VIEW (w);
menu = gtk_menu_new();
gtk_widget_show(menu);
mi = gtk_menu_item_new_with_label("Definition");
gtk_widget_show(mi);
g_signal_connect_swapped (G_OBJECT (mi), "activate",
G_CALLBACK (gmdb_table_def_cb), gil);
G_CALLBACK (gmdb_table_def_cb), giv);
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);
G_CALLBACK (gmdb_table_data_cb), giv);
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);
G_CALLBACK (gmdb_table_export_cb), giv);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
mi = gtk_separator_menu_item_new();
gtk_widget_show(mi);
@ -187,37 +195,11 @@ GtkWidget *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);
G_CALLBACK (gmdb_table_debug_cb), giv);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
//mi = gtk_menu_item_new_with_label("Usage Map");
//gtk_widget_show(mi);
//gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
g_signal_connect_swapped (GTK_OBJECT (gil), "button_press_event",
G_CALLBACK (gmdb_table_popup_cb), GTK_OBJECT(menu));
g_signal_connect (giv, "button_press_event", G_CALLBACK (gmdb_table_popup_cb), menu);
}
static void
gmdb_table_add_icon(gchar *text)
{
GnomeIconList *gil;
int pos;
gil = (GnomeIconList *) glade_xml_get_widget (mainwin_xml, "table_iconlist");
pos = gnome_icon_list_append(gil, GMDB_ICONDIR "table_big.xpm", text);
gnome_icon_list_set_icon_data(gil, pos, text);
}
void gmdb_table_populate(MdbHandle *mdb)
{
int i;
MdbCatalogEntry *entry;
/* add all user tables in catalog to tab */
for (i=0; i < mdb->num_catalog; i++) {
entry = g_ptr_array_index (mdb->catalog, i);
if (mdb_is_user_table(entry)) {
gmdb_table_add_icon(entry->object_name);
}
} /* for */
}