[gnome-db] Patch for GnomeDBGrid
- From: Stéphane Wirtel <stephane wirtel belgacom net>
- To: Rodrigo Moya <rodrigo gnome-db org>
- Cc: gnome-db <gnome-db-list gnome org>
- Subject: [gnome-db] Patch for GnomeDBGrid
- Date: Tue, 16 Dec 2003 15:32:30 +0100
In this patch, there are two functions.
diffstat libgnomedb-db_grid_set_get_column_title.patch
gnome-db-grid.c | 53
+++++++++++++++++++++++++++++++++++++++++++++++++++++
gnome-db-grid.h | 2 ++
2 files changed, 55 insertions(+)
void gnome_db_grid_set_column_title(GnomeDbGrid *grid, gint col, const
gchar *title);
This function change the title of a column of a dbgrid
const gchar *gnome_db_grid_get_column_title(GnomeDbGrid *grid, gint col)
This function returns the title of a column.
Bye all,
Stephane aka matrixise
diff -Nru libgnomedb/libgnomedb/gnome-db-grid.c libgnomedb.matrixise/libgnomedb/gnome-db-grid.c
--- libgnomedb/libgnomedb/gnome-db-grid.c 2003-12-11 16:34:05.000000000 +0100
+++ libgnomedb.matrixise/libgnomedb/gnome-db-grid.c 2003-12-16 14:39:17.000000000 +0100
@@ -719,6 +719,59 @@
}
/**
+ * gnome_db_grid_set_column_title
+ * @grid a #GnomeDbGrid widget
+ * @col the number of the column to change the title
+ * @title the new title for this column
+ *
+ * Set the title for a column
+ */
+void
+gnome_db_grid_set_column_title(GnomeDbGrid *grid, gint col, const gchar *title)
+{
+ GtkTreeViewColumn *column = NULL;
+ gint number_columns;
+ GList *list = NULL;
+ g_return_if_fail(GNOME_DB_IS_GRID(grid));
+ g_return_if_fail(title != NULL);
+
+ list = gtk_tree_view_get_columns(GTK_TREE_VIEW(grid->priv->tree_view));
+ g_return_if_fail(list != NULL);
+
+ if ( list != NULL )
+ {
+ number_columns = g_list_length(list);
+ if ( col >= 0 && col < number_columns )
+ {
+ column = gtk_tree_view_get_column(GTK_TREE_VIEW(grid->priv->tree_view), col);
+ gtk_tree_view_column_set_title(column, title);
+ }
+ }
+
+}
+
+/**
+ * gnome_db_grid_get_column_title
+ * @grid a #GnomeDbGrid widget
+ * @col the number of the column to get the title
+ *
+ * Get the title of a column
+ * Returns: the title of a column.
+ */
+const gchar *
+gnome_db_grid_get_column_title(GnomeDbGrid *grid, gint col)
+{
+ GtkTreeViewColumn *column = NULL;
+ gchar *title = NULL;
+
+ g_return_val_if_fail (GNOME_DB_IS_GRID(grid), NULL);
+ column = gtk_tree_view_get_column(GTK_TREE_VIEW(grid->priv->tree_view), col);
+ title = gtk_tree_view_column_get_title(column);
+ return title;
+}
+
+
+/**
* gnome_db_grid_get_show_title
* @grid: a #GnomeDbGrid widget.
*
diff -Nru libgnomedb/libgnomedb/gnome-db-grid.h libgnomedb.matrixise/libgnomedb/gnome-db-grid.h
--- libgnomedb/libgnomedb/gnome-db-grid.h 2003-12-11 16:34:05.000000000 +0100
+++ libgnomedb.matrixise/libgnomedb/gnome-db-grid.h 2003-12-16 13:29:32.000000000 +0100
@@ -61,6 +61,8 @@
const gchar *gnome_db_grid_get_title (GnomeDbGrid *grid);
void gnome_db_grid_set_title (GnomeDbGrid *grid, const gchar *title);
+void gnome_db_grid_set_column_title (GnomeDbGrid *grid, gint col, const gchar *title);
+const gchar *gnome_db_grid_get_column_title (GnomeDbGrid *grid, gint col);
gboolean gnome_db_grid_get_show_title (GnomeDbGrid *grid);
void gnome_db_grid_set_show_title (GnomeDbGrid *grid, gboolean show);
void gnome_db_grid_set_title_icon_from_file (GnomeDbGrid *grid, const gchar *file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]