mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-11-26 10:29:27 +08:00
Patch gmdbtabledef.diff from Nirgal
This commit is contained in:
committed by
Brian Bruns
parent
7656d25aaf
commit
8c3b8d5cff
@@ -16,7 +16,6 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
#include "gmdb.h"
|
#include "gmdb.h"
|
||||||
#include "pixmaps/pk.xpm"
|
|
||||||
|
|
||||||
extern GtkWidget *app;
|
extern GtkWidget *app;
|
||||||
extern MdbHandle *mdb;
|
extern MdbHandle *mdb;
|
||||||
@@ -48,8 +47,8 @@ GtkWidget *scroll;
|
|||||||
GdkPixmap *pixmap;
|
GdkPixmap *pixmap;
|
||||||
GdkBitmap *mask;
|
GdkBitmap *mask;
|
||||||
int i,j;
|
int i,j;
|
||||||
gchar *titles[] = { "", "Column", "Name", "Type", "Size", "Allow Nulls" };
|
gchar *titles[] = { "", "Column", "Name", "Type", "Size", "Allow Nulls", "Description" };
|
||||||
gchar *row[6];
|
gchar *row[sizeof(titles)/sizeof(titles[0])];
|
||||||
GMdbDefWindow *defw;
|
GMdbDefWindow *defw;
|
||||||
GtkStyle *style;
|
GtkStyle *style;
|
||||||
|
|
||||||
@@ -84,18 +83,20 @@ GtkStyle *style;
|
|||||||
mdb_read_columns(table);
|
mdb_read_columns(table);
|
||||||
mdb_rewind_table(table);
|
mdb_rewind_table(table);
|
||||||
|
|
||||||
clist = gtk_clist_new_with_titles(5, titles);
|
clist = gtk_clist_new_with_titles(sizeof(titles)/sizeof(titles[0]), titles);
|
||||||
gtk_clist_set_column_width (GTK_CLIST(clist), 0, 20);
|
gtk_clist_set_column_width (GTK_CLIST(clist), 0, 20);
|
||||||
gtk_clist_set_column_width (GTK_CLIST(clist), 1, 35);
|
gtk_clist_set_column_width (GTK_CLIST(clist), 1, 35);
|
||||||
gtk_clist_set_column_width (GTK_CLIST(clist), 2, 80);
|
gtk_clist_set_column_width (GTK_CLIST(clist), 2, 80);
|
||||||
gtk_clist_set_column_width (GTK_CLIST(clist), 3, 60);
|
gtk_clist_set_column_width (GTK_CLIST(clist), 3, 60);
|
||||||
gtk_clist_set_column_width (GTK_CLIST(clist), 4, 30);
|
gtk_clist_set_column_width (GTK_CLIST(clist), 4, 30);
|
||||||
gtk_clist_set_column_width (GTK_CLIST(clist), 5, 30);
|
gtk_clist_set_column_width (GTK_CLIST(clist), 5, 30);
|
||||||
|
gtk_clist_set_column_width (GTK_CLIST(clist), 6, 60);
|
||||||
gtk_widget_show(clist);
|
gtk_widget_show(clist);
|
||||||
gtk_container_add(GTK_CONTAINER(scroll),clist);
|
gtk_container_add(GTK_CONTAINER(scroll),clist);
|
||||||
|
|
||||||
for (i=0;i<table->num_cols;i++) {
|
for (i=0;i<table->num_cols;i++) {
|
||||||
/* display column titles */
|
/* display column titles */
|
||||||
|
const char *propval;
|
||||||
col=g_ptr_array_index(table->columns,i);
|
col=g_ptr_array_index(table->columns,i);
|
||||||
row[0] = (char *) g_malloc0(MDB_BIND_SIZE);
|
row[0] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||||
row[1] = (char *) g_malloc0(MDB_BIND_SIZE);
|
row[1] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||||
@@ -103,16 +104,15 @@ GtkStyle *style;
|
|||||||
row[3] = (char *) g_malloc0(MDB_BIND_SIZE);
|
row[3] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||||
row[4] = (char *) g_malloc0(MDB_BIND_SIZE);
|
row[4] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||||
row[5] = (char *) g_malloc0(MDB_BIND_SIZE);
|
row[5] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||||
|
row[6] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||||
strcpy(row[0],"");
|
strcpy(row[0],"");
|
||||||
sprintf(row[1],"%d", col->col_num+1);
|
sprintf(row[1],"%d", col->col_num+1);
|
||||||
strcpy(row[2],col->name);
|
strcpy(row[2],col->name);
|
||||||
strcpy(row[3], mdb_get_colbacktype_string(col));
|
strcpy(row[3], mdb_get_colbacktype_string(col));
|
||||||
sprintf(row[4],"%d",col->col_size);
|
sprintf(row[4],"%d",col->col_size);
|
||||||
if (col->is_fixed) {
|
strcpy(row[5], col->is_fixed ? "No" : "Yes");
|
||||||
strcpy(row[5],"No");
|
propval = mdb_col_get_prop(col, "Description");
|
||||||
} else {
|
strcpy(row[6], propval ? propval : "");
|
||||||
strcpy(row[5],"Yes");
|
|
||||||
}
|
|
||||||
gtk_clist_append(GTK_CLIST(clist), row);
|
gtk_clist_append(GTK_CLIST(clist), row);
|
||||||
}
|
}
|
||||||
style = gtk_widget_get_style(clist);
|
style = gtk_widget_get_style(clist);
|
||||||
@@ -120,8 +120,6 @@ GtkStyle *style;
|
|||||||
&mask,
|
&mask,
|
||||||
&style->bg[GTK_STATE_NORMAL],
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
GMDB_ICONDIR "pk.xpm");
|
GMDB_ICONDIR "pk.xpm");
|
||||||
//pixmap = gdk_pixmap_colormap_create_from_xpm_d( NULL,
|
|
||||||
//gtk_widget_get_colormap(app), &mask, NULL, pk_xpm);
|
|
||||||
|
|
||||||
mdb_read_indices(table);
|
mdb_read_indices(table);
|
||||||
for (i=0;i<table->num_idxs;i++) {
|
for (i=0;i<table->num_idxs;i++) {
|
||||||
@@ -138,6 +136,8 @@ GtkStyle *style;
|
|||||||
}
|
}
|
||||||
} /* for */
|
} /* for */
|
||||||
|
|
||||||
|
gtk_clist_columns_autosize(GTK_CLIST(clist));
|
||||||
|
|
||||||
/* add this one to the window list */
|
/* add this one to the window list */
|
||||||
window_list = g_list_append(window_list, defw);
|
window_list = g_list_append(window_list, defw);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user