forked from AuroraMiddleware/gtk
removed gtk_*_store_get, and moved to GtkTreeModel.
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed gtk_*_store_get, and moved to GtkTreeModel. * gtk/gtktreemodel.h (gtk_tree_model_set{v,}): Added * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_finalize): added. * gtk/Makefile.am: remove gtktreemodelmapping.[ch] * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_func): let you set the func. * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data): freeze/thaw notify between setting all the properties for a cell. * gtk/gtk.h: remove gtktreemodelsimple.h, and gtktreemodelmapping.h
This commit is contained in:
parent
08add3cd50
commit
b10825d537
21
ChangeLog
21
ChangeLog
@ -1,3 +1,22 @@
|
||||
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed
|
||||
gtk_*_store_get, and moved to GtkTreeModel.
|
||||
|
||||
* gtk/gtktreemodel.h (gtk_tree_model_set{v,}): Added
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_finalize): added.
|
||||
|
||||
* gtk/Makefile.am: remove gtktreemodelmapping.[ch]
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_func): let you
|
||||
set the func.
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data):
|
||||
freeze/thaw notify between setting all the properties for a cell.
|
||||
|
||||
* gtk/gtk.h: remove gtktreemodelsimple.h, and gtktreemodelmapping.h
|
||||
|
||||
2001-02-15 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gdk/gdkpango.c (gdk_pango_layout_line_get_clip_region): convert
|
||||
@ -41,7 +60,7 @@ Fri Feb 16 14:22:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/Makefile.am: Removed gtktreemodelsimple.[ch]
|
||||
|
||||
* gtk/gtktreemodelsimple.[ch]: removes
|
||||
* gtk/gtktreemodelsimple.[ch]: removed.
|
||||
|
||||
2001-02-16 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
|
@ -1,3 +1,22 @@
|
||||
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed
|
||||
gtk_*_store_get, and moved to GtkTreeModel.
|
||||
|
||||
* gtk/gtktreemodel.h (gtk_tree_model_set{v,}): Added
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_finalize): added.
|
||||
|
||||
* gtk/Makefile.am: remove gtktreemodelmapping.[ch]
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_func): let you
|
||||
set the func.
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data):
|
||||
freeze/thaw notify between setting all the properties for a cell.
|
||||
|
||||
* gtk/gtk.h: remove gtktreemodelsimple.h, and gtktreemodelmapping.h
|
||||
|
||||
2001-02-15 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gdk/gdkpango.c (gdk_pango_layout_line_get_clip_region): convert
|
||||
@ -41,7 +60,7 @@ Fri Feb 16 14:22:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/Makefile.am: Removed gtktreemodelsimple.[ch]
|
||||
|
||||
* gtk/gtktreemodelsimple.[ch]: removes
|
||||
* gtk/gtktreemodelsimple.[ch]: removed.
|
||||
|
||||
2001-02-16 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
|
@ -1,3 +1,22 @@
|
||||
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed
|
||||
gtk_*_store_get, and moved to GtkTreeModel.
|
||||
|
||||
* gtk/gtktreemodel.h (gtk_tree_model_set{v,}): Added
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_finalize): added.
|
||||
|
||||
* gtk/Makefile.am: remove gtktreemodelmapping.[ch]
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_func): let you
|
||||
set the func.
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data):
|
||||
freeze/thaw notify between setting all the properties for a cell.
|
||||
|
||||
* gtk/gtk.h: remove gtktreemodelsimple.h, and gtktreemodelmapping.h
|
||||
|
||||
2001-02-15 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gdk/gdkpango.c (gdk_pango_layout_line_get_clip_region): convert
|
||||
@ -41,7 +60,7 @@ Fri Feb 16 14:22:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/Makefile.am: Removed gtktreemodelsimple.[ch]
|
||||
|
||||
* gtk/gtktreemodelsimple.[ch]: removes
|
||||
* gtk/gtktreemodelsimple.[ch]: removed.
|
||||
|
||||
2001-02-16 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
|
@ -1,3 +1,22 @@
|
||||
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed
|
||||
gtk_*_store_get, and moved to GtkTreeModel.
|
||||
|
||||
* gtk/gtktreemodel.h (gtk_tree_model_set{v,}): Added
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_finalize): added.
|
||||
|
||||
* gtk/Makefile.am: remove gtktreemodelmapping.[ch]
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_func): let you
|
||||
set the func.
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data):
|
||||
freeze/thaw notify between setting all the properties for a cell.
|
||||
|
||||
* gtk/gtk.h: remove gtktreemodelsimple.h, and gtktreemodelmapping.h
|
||||
|
||||
2001-02-15 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gdk/gdkpango.c (gdk_pango_layout_line_get_clip_region): convert
|
||||
@ -41,7 +60,7 @@ Fri Feb 16 14:22:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/Makefile.am: Removed gtktreemodelsimple.[ch]
|
||||
|
||||
* gtk/gtktreemodelsimple.[ch]: removes
|
||||
* gtk/gtktreemodelsimple.[ch]: removed.
|
||||
|
||||
2001-02-16 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
|
@ -1,3 +1,22 @@
|
||||
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed
|
||||
gtk_*_store_get, and moved to GtkTreeModel.
|
||||
|
||||
* gtk/gtktreemodel.h (gtk_tree_model_set{v,}): Added
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_finalize): added.
|
||||
|
||||
* gtk/Makefile.am: remove gtktreemodelmapping.[ch]
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_func): let you
|
||||
set the func.
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data):
|
||||
freeze/thaw notify between setting all the properties for a cell.
|
||||
|
||||
* gtk/gtk.h: remove gtktreemodelsimple.h, and gtktreemodelmapping.h
|
||||
|
||||
2001-02-15 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gdk/gdkpango.c (gdk_pango_layout_line_get_clip_region): convert
|
||||
@ -41,7 +60,7 @@ Fri Feb 16 14:22:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/Makefile.am: Removed gtktreemodelsimple.[ch]
|
||||
|
||||
* gtk/gtktreemodelsimple.[ch]: removes
|
||||
* gtk/gtktreemodelsimple.[ch]: removed.
|
||||
|
||||
2001-02-16 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
|
@ -1,3 +1,22 @@
|
||||
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed
|
||||
gtk_*_store_get, and moved to GtkTreeModel.
|
||||
|
||||
* gtk/gtktreemodel.h (gtk_tree_model_set{v,}): Added
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_finalize): added.
|
||||
|
||||
* gtk/Makefile.am: remove gtktreemodelmapping.[ch]
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_func): let you
|
||||
set the func.
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data):
|
||||
freeze/thaw notify between setting all the properties for a cell.
|
||||
|
||||
* gtk/gtk.h: remove gtktreemodelsimple.h, and gtktreemodelmapping.h
|
||||
|
||||
2001-02-15 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gdk/gdkpango.c (gdk_pango_layout_line_get_clip_region): convert
|
||||
@ -41,7 +60,7 @@ Fri Feb 16 14:22:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/Makefile.am: Removed gtktreemodelsimple.[ch]
|
||||
|
||||
* gtk/gtktreemodelsimple.[ch]: removes
|
||||
* gtk/gtktreemodelsimple.[ch]: removed.
|
||||
|
||||
2001-02-16 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
|
@ -1,3 +1,22 @@
|
||||
Fri Feb 16 17:49:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreestore.[hc], gtk/gtkliststore.[ch]: removed
|
||||
gtk_*_store_get, and moved to GtkTreeModel.
|
||||
|
||||
* gtk/gtktreemodel.h (gtk_tree_model_set{v,}): Added
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_finalize): added.
|
||||
|
||||
* gtk/Makefile.am: remove gtktreemodelmapping.[ch]
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_func): let you
|
||||
set the func.
|
||||
|
||||
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_cell_data):
|
||||
freeze/thaw notify between setting all the properties for a cell.
|
||||
|
||||
* gtk/gtk.h: remove gtktreemodelsimple.h, and gtktreemodelmapping.h
|
||||
|
||||
2001-02-15 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gdk/gdkpango.c (gdk_pango_layout_line_get_clip_region): convert
|
||||
@ -41,7 +60,7 @@ Fri Feb 16 14:22:05 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/Makefile.am: Removed gtktreemodelsimple.[ch]
|
||||
|
||||
* gtk/gtktreemodelsimple.[ch]: removes
|
||||
* gtk/gtktreemodelsimple.[ch]: removed.
|
||||
|
||||
2001-02-16 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
|
@ -35,7 +35,7 @@ window_closed_cb (GtkWidget *window, gpointer data)
|
||||
gboolean italic;
|
||||
|
||||
gtk_tree_model_get_iter (cbdata->model, &iter, cbdata->path);
|
||||
gtk_tree_store_get (GTK_TREE_STORE (cbdata->model), &iter,
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (cbdata->model), &iter,
|
||||
ITALIC_COLUMN, &italic,
|
||||
-1);
|
||||
if (italic)
|
||||
@ -262,7 +262,7 @@ button_press_event_cb (GtkTreeView *tree_view,
|
||||
GtkWidget *window;
|
||||
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
gtk_tree_store_get (GTK_TREE_STORE (model),
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (model),
|
||||
&iter,
|
||||
FUNC_COLUMN, &func,
|
||||
ITALIC_COLUMN, &italic,
|
||||
|
@ -174,7 +174,6 @@ gtk_public_h_sources = @STRIP_BEGIN@ \
|
||||
gtktreeitem.h \
|
||||
gtktreemodel.h \
|
||||
gtktreemodelsort.h \
|
||||
gtktreemodelmapping.h \
|
||||
gtktreeselection.h \
|
||||
gtktreesortable.h \
|
||||
gtktreestore.h \
|
||||
@ -341,7 +340,6 @@ gtk_c_sources = @STRIP_BEGIN@ \
|
||||
gtktreednd.c \
|
||||
gtktreemodel.c \
|
||||
gtktreemodelsort.c \
|
||||
gtktreemodelmapping.c \
|
||||
gtktreeselection.c \
|
||||
gtktreestore.c \
|
||||
gtktreeview.c \
|
||||
|
@ -142,9 +142,7 @@
|
||||
#include <gtk/gtktreednd.h>
|
||||
#include <gtk/gtktreeitem.h>
|
||||
#include <gtk/gtktreemodel.h>
|
||||
#include <gtk/gtktreemodelsimple.h>
|
||||
#include <gtk/gtktreemodelsort.h>
|
||||
#include <gtk/gtktreemodelmapping.h>
|
||||
#include <gtk/gtktreeselection.h>
|
||||
#include <gtk/gtktreestore.h>
|
||||
#include <gtk/gtktreeview.h>
|
||||
|
@ -701,88 +701,6 @@ gtk_list_store_set (GtkListStore *list_store,
|
||||
va_end (var_args);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_list_store_get_valist:
|
||||
* @list_store: a #GtkListStore
|
||||
* @iter: a row in @list_store
|
||||
* @var_args: va_list of column/return location pairs
|
||||
*
|
||||
* See gtk_list_store_get(), this version takes a va_list for
|
||||
* language bindings to use.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gtk_list_store_get_valist (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args)
|
||||
{
|
||||
gint column;
|
||||
|
||||
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
|
||||
|
||||
column = va_arg (var_args, gint);
|
||||
|
||||
while (column != -1)
|
||||
{
|
||||
GValue value = { 0, };
|
||||
gchar *error = NULL;
|
||||
|
||||
if (column >= list_store->n_columns)
|
||||
{
|
||||
g_warning ("%s: Invalid column number %d accessed (remember to end your list of columns with a -1)", G_STRLOC, column);
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_list_store_get_value (GTK_TREE_MODEL (list_store), iter, column, &value);
|
||||
|
||||
G_VALUE_LCOPY (&value, var_args, &error);
|
||||
if (error)
|
||||
{
|
||||
g_warning ("%s: %s", G_STRLOC, error);
|
||||
g_free (error);
|
||||
|
||||
/* we purposely leak the value here, it might not be
|
||||
* in a sane state if an error condition occoured
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
g_value_unset (&value);
|
||||
|
||||
column = va_arg (var_args, gint);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_list_store_get:
|
||||
* @list_store: a #GtkListStore
|
||||
* @iter: a row in @list_store
|
||||
* @Varargs: pairs of column number and value return locations, terminated by -1
|
||||
*
|
||||
* Gets the value of one or more cells in the row referenced by @iter.
|
||||
* The variable argument list should contain integer column numbers,
|
||||
* each column number followed by a place to store the value being
|
||||
* retrieved. The list is terminated by a -1. For example, to get a
|
||||
* value from column 0 with type %G_TYPE_STRING, you would
|
||||
* write: gtk_list_store_set (store, iter, 0, &place_string_here, -1),
|
||||
* where place_string_here is a gchar* to be filled with the string.
|
||||
* If appropriate, the returned values have to be freed or unreferenced.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gtk_list_store_get (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
...)
|
||||
{
|
||||
va_list var_args;
|
||||
|
||||
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
|
||||
|
||||
va_start (var_args, iter);
|
||||
gtk_list_store_get_valist (list_store, iter, var_args);
|
||||
va_end (var_args);
|
||||
}
|
||||
|
||||
static GSList*
|
||||
remove_link_saving_prev (GSList *list,
|
||||
GSList *link,
|
||||
|
@ -87,12 +87,6 @@ void gtk_list_store_set (GtkListStore *list_store,
|
||||
void gtk_list_store_set_valist (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args);
|
||||
void gtk_list_store_get (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
...);
|
||||
void gtk_list_store_get_valist (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args);
|
||||
void gtk_list_store_remove (GtkListStore *store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_list_store_insert (GtkListStore *store,
|
||||
|
@ -20,6 +20,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
#include "gtktreemodel.h"
|
||||
|
||||
struct _GtkTreePath
|
||||
@ -174,8 +177,6 @@ void
|
||||
gtk_tree_path_append_index (GtkTreePath *path,
|
||||
gint index)
|
||||
{
|
||||
gint *new_indices;
|
||||
|
||||
g_return_if_fail (path != NULL);
|
||||
g_return_if_fail (index >= 0);
|
||||
|
||||
@ -597,16 +598,6 @@ deleted_callback (GtkTreeModel *tree_model,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
reordered_callback (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
gint *new_order,
|
||||
gpointer data)
|
||||
{
|
||||
|
||||
/* FIXME */
|
||||
}
|
||||
|
||||
static void
|
||||
connect_ref_callbacks (GtkTreeModel *model,
|
||||
RowRefList *refs)
|
||||
@ -631,7 +622,7 @@ connect_ref_callbacks (GtkTreeModel *model,
|
||||
/* FIXME */
|
||||
g_signal_connect_data (G_OBJECT (model),
|
||||
"reordered",
|
||||
(GCallback) reordered_callback,
|
||||
(GCallback) reorderedc_allback,
|
||||
refs,
|
||||
NULL,
|
||||
FALSE,
|
||||
@ -1143,3 +1134,85 @@ gtk_tree_model_unref_iter (GtkTreeModel *tree_model,
|
||||
if (GTK_TREE_MODEL_GET_IFACE (tree_model)->unref_iter)
|
||||
(* GTK_TREE_MODEL_GET_IFACE (tree_model)->unref_iter) (tree_model, iter);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_model_get:
|
||||
* @tree_model: a #GtkTreeModel
|
||||
* @iter: a row in @tree_model
|
||||
* @Varargs: pairs of column number and value return locations, terminated by -1
|
||||
*
|
||||
* Gets the value of one or more cells in the row referenced by @iter.
|
||||
* The variable argument list should contain integer column numbers,
|
||||
* each column number followed by a place to store the value being
|
||||
* retrieved. The list is terminated by a -1. For example, to get a
|
||||
* value from column 0 with type %G_TYPE_STRING, you would
|
||||
* write: gtk_tree_model_set (model, iter, 0, &place_string_here, -1),
|
||||
* where place_string_here is a gchar* to be filled with the string.
|
||||
* If appropriate, the returned values have to be freed or unreferenced.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gtk_tree_model_get (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
...)
|
||||
{
|
||||
va_list var_args;
|
||||
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
||||
|
||||
va_start (var_args, iter);
|
||||
gtk_tree_model_get_valist (tree_model, iter, var_args);
|
||||
va_end (var_args);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_model_get_valist:
|
||||
* @tree_model: a #GtkTreeModel
|
||||
* @iter: a row in @tree_model
|
||||
* @var_args: va_list of column/return location pairs
|
||||
*
|
||||
* See gtk_tree_model_get(), this version takes a va_list for
|
||||
* language bindings to use.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gtk_tree_model_get_valist (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args)
|
||||
{
|
||||
gint column;
|
||||
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
||||
|
||||
column = va_arg (var_args, gint);
|
||||
|
||||
while (column != -1)
|
||||
{
|
||||
GValue value = { 0, };
|
||||
gchar *error = NULL;
|
||||
|
||||
if (column >= gtk_tree_model_get_n_columns (tree_model))
|
||||
{
|
||||
g_warning ("%s: Invalid column number %d accessed (remember to end your list of columns with a -1)", G_STRLOC, column);
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_tree_model_get_value (GTK_TREE_MODEL (tree_model), iter, column, &value);
|
||||
|
||||
G_VALUE_LCOPY (&value, var_args, &error);
|
||||
if (error)
|
||||
{
|
||||
g_warning ("%s: %s", G_STRLOC, error);
|
||||
g_free (error);
|
||||
|
||||
/* we purposely leak the value here, it might not be
|
||||
* in a sane state if an error condition occoured
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
g_value_unset (&value);
|
||||
|
||||
column = va_arg (var_args, gint);
|
||||
}
|
||||
}
|
||||
|
@ -165,37 +165,46 @@ GType gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
|
||||
|
||||
|
||||
/* Iterator movement */
|
||||
gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreePath *path);
|
||||
gboolean gtk_tree_model_get_first (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
GtkTreePath *gtk_tree_model_get_path (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_tree_model_get_value (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
gint column,
|
||||
GValue *value);
|
||||
gboolean gtk_tree_model_iter_next (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
gboolean gtk_tree_model_iter_children (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent);
|
||||
gboolean gtk_tree_model_iter_has_child (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
gint gtk_tree_model_iter_n_children (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
gboolean gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent,
|
||||
gint n);
|
||||
gboolean gtk_tree_model_iter_parent (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *child);
|
||||
void gtk_tree_model_ref_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_tree_model_unref_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreePath *path);
|
||||
gboolean gtk_tree_model_get_first (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
GtkTreePath *gtk_tree_model_get_path (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_tree_model_get_value (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
gint column,
|
||||
GValue *value);
|
||||
gboolean gtk_tree_model_iter_next (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
gboolean gtk_tree_model_iter_children (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent);
|
||||
gboolean gtk_tree_model_iter_has_child (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
gint gtk_tree_model_iter_n_children (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
gboolean gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent,
|
||||
gint n);
|
||||
gboolean gtk_tree_model_iter_parent (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *child);
|
||||
void gtk_tree_model_ref_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_tree_model_unref_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
|
||||
void gtk_tree_model_get (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
...);
|
||||
void gtk_tree_model_get_valist (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,571 +0,0 @@
|
||||
/* gtktreemodelmapping.c
|
||||
* Copyright (C) 2000 Red Hat, Inc., Alexander Larsson <alexl@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gtktreemodelmapping.h"
|
||||
#include "gtksignal.h"
|
||||
|
||||
enum {
|
||||
CHANGED,
|
||||
INSERTED,
|
||||
CHILD_TOGGLED,
|
||||
DELETED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint tree_model_mapping_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void gtk_tree_model_mapping_init (GtkTreeModelMapping *tree_model_mapping);
|
||||
static void gtk_tree_model_mapping_class_init (GtkTreeModelMappingClass *tree_model_mapping_class);
|
||||
static void gtk_tree_model_mapping_tree_model_init (GtkTreeModelIface *iface);
|
||||
static void gtk_tree_model_mapping_finalize (GObject *object);
|
||||
/* signals */
|
||||
static void gtk_tree_model_mapping_changed (GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data);
|
||||
static void gtk_tree_model_mapping_inserted (GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data);
|
||||
static void gtk_tree_model_mapping_child_toggled (GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data);
|
||||
static void gtk_tree_model_mapping_deleted (GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
gpointer data);
|
||||
static void gtk_tree_model_mapping_reordered (GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
gint *new_order);
|
||||
/* vtable */
|
||||
static GtkTreeModelFlags gtk_tree_model_mapping_get_flags (GtkTreeModel *tree_model);
|
||||
static gint gtk_tree_model_mapping_get_n_columns (GtkTreeModel *tree_model);
|
||||
static GType gtk_tree_model_mapping_get_column_type (GtkTreeModel *tree_model,
|
||||
gint index);
|
||||
static gboolean gtk_tree_model_mapping_get_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreePath *path);
|
||||
static GtkTreePath *gtk_tree_model_mapping_get_path (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
static void gtk_tree_model_mapping_get_value (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
gint column,
|
||||
GValue *value);
|
||||
static gboolean gtk_tree_model_mapping_iter_next (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
static gboolean gtk_tree_model_mapping_iter_children (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent);
|
||||
static gboolean gtk_tree_model_mapping_iter_has_child (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
static gint gtk_tree_model_mapping_iter_n_children (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
static gboolean gtk_tree_model_mapping_iter_nth_child (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent,
|
||||
gint n);
|
||||
static gboolean gtk_tree_model_mapping_iter_parent (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *child);
|
||||
static void gtk_tree_model_mapping_ref_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
static void gtk_tree_model_mapping_unref_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
|
||||
|
||||
GtkType
|
||||
gtk_tree_model_mapping_get_type (void)
|
||||
{
|
||||
static GtkType tree_model_mapping_type = 0;
|
||||
|
||||
if (!tree_model_mapping_type)
|
||||
{
|
||||
static const GTypeInfo tree_model_mapping_info =
|
||||
{
|
||||
sizeof (GtkTreeModelMappingClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gtk_tree_model_mapping_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GtkTreeModelMapping),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gtk_tree_model_mapping_init
|
||||
};
|
||||
|
||||
static const GInterfaceInfo tree_model_info =
|
||||
{
|
||||
(GInterfaceInitFunc) gtk_tree_model_mapping_tree_model_init,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
tree_model_mapping_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkTreeModelMapping", &tree_model_mapping_info, 0);
|
||||
g_type_add_interface_static (tree_model_mapping_type,
|
||||
GTK_TYPE_TREE_MODEL,
|
||||
&tree_model_info);
|
||||
}
|
||||
|
||||
return tree_model_mapping_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_mapping_class_init (GtkTreeModelMappingClass *tree_model_mapping_class)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
|
||||
object_class = (GObjectClass *) tree_model_mapping_class;
|
||||
|
||||
object_class->finalize = gtk_tree_model_mapping_finalize;
|
||||
|
||||
tree_model_mapping_signals[CHANGED] =
|
||||
gtk_signal_new ("changed",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkTreeModelMappingClass, changed),
|
||||
gtk_marshal_VOID__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
tree_model_mapping_signals[INSERTED] =
|
||||
gtk_signal_new ("inserted",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkTreeModelMappingClass, inserted),
|
||||
gtk_marshal_VOID__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
tree_model_mapping_signals[CHILD_TOGGLED] =
|
||||
gtk_signal_new ("child_toggled",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkTreeModelMappingClass, child_toggled),
|
||||
gtk_marshal_VOID__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
tree_model_mapping_signals[DELETED] =
|
||||
gtk_signal_new ("deleted",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkTreeModelMappingClass, deleted),
|
||||
gtk_marshal_VOID__POINTER,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_POINTER);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_mapping_tree_model_init (GtkTreeModelIface *iface)
|
||||
{
|
||||
iface->get_flags = gtk_tree_model_mapping_get_flags;
|
||||
iface->get_n_columns = gtk_tree_model_mapping_get_n_columns;
|
||||
iface->get_column_type = gtk_tree_model_mapping_get_column_type;
|
||||
iface->get_iter = gtk_tree_model_mapping_get_iter;
|
||||
iface->get_path = gtk_tree_model_mapping_get_path;
|
||||
iface->get_value = gtk_tree_model_mapping_get_value;
|
||||
iface->iter_next = gtk_tree_model_mapping_iter_next;
|
||||
iface->iter_children = gtk_tree_model_mapping_iter_children;
|
||||
iface->iter_has_child = gtk_tree_model_mapping_iter_has_child;
|
||||
iface->iter_n_children = gtk_tree_model_mapping_iter_n_children;
|
||||
iface->iter_nth_child = gtk_tree_model_mapping_iter_nth_child;
|
||||
iface->iter_parent = gtk_tree_model_mapping_iter_parent;
|
||||
iface->ref_iter = gtk_tree_model_mapping_ref_iter;
|
||||
iface->unref_iter = gtk_tree_model_mapping_unref_iter;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_mapping_init (GtkTreeModelMapping *tree_model_mapping)
|
||||
{
|
||||
}
|
||||
|
||||
GtkTreeModel *
|
||||
gtk_tree_model_mapping_new (void)
|
||||
{
|
||||
return GTK_TREE_MODEL (gtk_type_new (gtk_tree_model_mapping_get_type ()));
|
||||
}
|
||||
|
||||
GtkTreeModel *
|
||||
gtk_tree_model_mapping_new_with_model (GtkTreeModel *child_model)
|
||||
{
|
||||
GtkTreeModel *retval;
|
||||
|
||||
retval = gtk_tree_model_mapping_new ();
|
||||
gtk_tree_model_mapping_set_model (GTK_TREE_MODEL_MAPPING (retval), child_model);
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_tree_model_mapping_set_n_columns (GtkTreeModelMapping *tree_model_mapping,
|
||||
gint n_columns)
|
||||
{
|
||||
g_return_if_fail (tree_model_mapping != NULL);
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model_mapping));
|
||||
|
||||
tree_model_mapping->n_columns = n_columns;
|
||||
tree_model_mapping->column_maps = g_realloc (tree_model_mapping->column_maps, sizeof (GtkTreeModelMapping)*n_columns);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_tree_model_mapping_set_column_mapping (GtkTreeModelMapping *tree_model_mapping,
|
||||
gint column,
|
||||
gint src_column,
|
||||
GType col_type,
|
||||
GValueMapFunc map_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkTreeModelMappingMap *map;
|
||||
|
||||
g_return_if_fail (tree_model_mapping != NULL);
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model_mapping));
|
||||
g_return_if_fail (column < tree_model_mapping->n_columns);
|
||||
|
||||
map = &tree_model_mapping->column_maps[column];
|
||||
map->src_column = src_column;
|
||||
map->col_type = col_type;
|
||||
map->map_func = map_func;
|
||||
map->user_data = user_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_model_mapping_set_model:
|
||||
* @tree_model_mapping: The #GtkTreeModelMapping.
|
||||
* @child_model: A #GtkTreeModel, or NULL.
|
||||
*
|
||||
* Sets the model of @tree_model_mapping to be @model. If @model is NULL, then the
|
||||
* old model is unset.
|
||||
**/
|
||||
void
|
||||
gtk_tree_model_mapping_set_model (GtkTreeModelMapping *tree_model_mapping,
|
||||
GtkTreeModel *child_model)
|
||||
{
|
||||
g_return_if_fail (tree_model_mapping != NULL);
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model_mapping));
|
||||
|
||||
if (child_model)
|
||||
g_object_ref (G_OBJECT (child_model));
|
||||
|
||||
if (tree_model_mapping->child_model)
|
||||
{
|
||||
gtk_signal_disconnect_by_func (GTK_OBJECT (tree_model_mapping->child_model),
|
||||
gtk_tree_model_mapping_changed,
|
||||
tree_model_mapping);
|
||||
gtk_signal_disconnect_by_func (GTK_OBJECT (tree_model_mapping->child_model),
|
||||
gtk_tree_model_mapping_inserted,
|
||||
tree_model_mapping);
|
||||
gtk_signal_disconnect_by_func (GTK_OBJECT (tree_model_mapping->child_model),
|
||||
gtk_tree_model_mapping_child_toggled,
|
||||
tree_model_mapping);
|
||||
gtk_signal_disconnect_by_func (GTK_OBJECT (tree_model_mapping->child_model),
|
||||
gtk_tree_model_mapping_deleted,
|
||||
tree_model_mapping);
|
||||
|
||||
g_object_unref (G_OBJECT (tree_model_mapping->child_model));
|
||||
}
|
||||
|
||||
tree_model_mapping->child_model = child_model;
|
||||
|
||||
if (child_model)
|
||||
{
|
||||
gtk_signal_connect (GTK_OBJECT (child_model),
|
||||
"changed",
|
||||
gtk_tree_model_mapping_changed,
|
||||
tree_model_mapping);
|
||||
gtk_signal_connect (GTK_OBJECT (child_model),
|
||||
"inserted",
|
||||
gtk_tree_model_mapping_inserted,
|
||||
tree_model_mapping);
|
||||
gtk_signal_connect (GTK_OBJECT (child_model),
|
||||
"child_toggled",
|
||||
gtk_tree_model_mapping_child_toggled,
|
||||
tree_model_mapping);
|
||||
gtk_signal_connect (GTK_OBJECT (child_model),
|
||||
"deleted",
|
||||
gtk_tree_model_mapping_deleted,
|
||||
tree_model_mapping);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_model_mapping_get_model:
|
||||
* @tree_model: a #GtkTreeModelMapping
|
||||
*
|
||||
* Returns the model the #GtkTreeModelMapping is mappinging.
|
||||
*
|
||||
* Return value: the "child model" being mappinged
|
||||
**/
|
||||
GtkTreeModel*
|
||||
gtk_tree_model_mapping_get_model (GtkTreeModelMapping *tree_model)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model), NULL);
|
||||
|
||||
return tree_model->child_model;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_mapping_finalize (GObject *object)
|
||||
{
|
||||
GtkTreeModelMapping *tree_model_mapping = (GtkTreeModelMapping *) object;
|
||||
|
||||
g_free (tree_model_mapping->column_maps);
|
||||
tree_model_mapping->column_maps = NULL;
|
||||
|
||||
if (tree_model_mapping->child_model)
|
||||
{
|
||||
g_object_unref (G_OBJECT (tree_model_mapping->child_model));
|
||||
tree_model_mapping->child_model = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_mapping_changed (GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (data), "changed", path, iter);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_mapping_inserted (GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (data), "inserted", path, iter);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_mapping_child_toggled (GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (data), "child_toggled", path, iter);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_mapping_deleted (GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (data), "deleted", path);
|
||||
}
|
||||
|
||||
|
||||
static GtkTreeModelFlags
|
||||
gtk_tree_model_mapping_get_flags (GtkTreeModel *tree_model)
|
||||
{
|
||||
GtkTreeModel *child_model;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model), 0);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_MAPPING (tree_model)->child_model != NULL, 0);
|
||||
|
||||
child_model = GTK_TREE_MODEL_MAPPING (tree_model)->child_model;
|
||||
|
||||
return gtk_tree_model_get_flags (child_model);
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_tree_model_mapping_get_n_columns (GtkTreeModel *tree_model)
|
||||
{
|
||||
GtkTreeModelMapping *tree_model_mapping;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model), 0);
|
||||
|
||||
tree_model_mapping = GTK_TREE_MODEL_MAPPING (tree_model);
|
||||
|
||||
return tree_model_mapping->n_columns;
|
||||
}
|
||||
|
||||
static GType
|
||||
gtk_tree_model_mapping_get_column_type (GtkTreeModel *tree_model,
|
||||
gint index)
|
||||
{
|
||||
GtkTreeModelMapping *tree_model_mapping;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model), 0);
|
||||
|
||||
tree_model_mapping = GTK_TREE_MODEL_MAPPING (tree_model);
|
||||
|
||||
return tree_model_mapping->column_maps[index].col_type;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_model_mapping_get_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
GtkTreeModel *child_model;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model), 0);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_MAPPING (tree_model)->child_model != NULL, 0);
|
||||
|
||||
child_model = GTK_TREE_MODEL_MAPPING (tree_model)->child_model;
|
||||
|
||||
return gtk_tree_model_get_iter (child_model, iter, path);
|
||||
}
|
||||
|
||||
static GtkTreePath *
|
||||
gtk_tree_model_mapping_get_path (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GtkTreeModel *child_model;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model), 0);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_MAPPING (tree_model)->child_model != NULL, 0);
|
||||
|
||||
child_model = GTK_TREE_MODEL_MAPPING (tree_model)->child_model;
|
||||
|
||||
return gtk_tree_model_get_path (child_model, iter);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_mapping_get_value (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
gint column,
|
||||
GValue *value)
|
||||
{
|
||||
GValue src_val = { 0, };
|
||||
GtkTreeModel *child_model;
|
||||
GtkTreeModelMapping *tree_model_mapping;
|
||||
GtkTreeModelMappingMap *map;
|
||||
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model));
|
||||
g_return_if_fail (GTK_TREE_MODEL_MAPPING (tree_model)->child_model != NULL);
|
||||
|
||||
tree_model_mapping = GTK_TREE_MODEL_MAPPING (tree_model);
|
||||
child_model = tree_model_mapping->child_model;
|
||||
|
||||
map = &tree_model_mapping->column_maps[column];
|
||||
|
||||
gtk_tree_model_get_value (child_model, iter, map->src_column, &src_val);
|
||||
(* map->map_func) (&src_val, value, map->user_data);
|
||||
g_value_unset (&src_val);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_model_mapping_iter_next (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GtkTreeModel *child_model;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model), 0);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_MAPPING (tree_model)->child_model != NULL, 0);
|
||||
|
||||
child_model = GTK_TREE_MODEL_MAPPING (tree_model)->child_model;
|
||||
|
||||
return gtk_tree_model_iter_next (child_model, iter);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_model_mapping_iter_children (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent)
|
||||
{
|
||||
GtkTreeModel *child_model;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model), 0);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_MAPPING (tree_model)->child_model != NULL, 0);
|
||||
|
||||
child_model = GTK_TREE_MODEL_MAPPING (tree_model)->child_model;
|
||||
return gtk_tree_model_iter_children (child_model, iter, parent);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_model_mapping_iter_has_child (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
|
||||
{
|
||||
GtkTreeModel *child_model;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model), 0);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_MAPPING (tree_model)->child_model != NULL, 0);
|
||||
|
||||
child_model = GTK_TREE_MODEL_MAPPING (tree_model)->child_model;
|
||||
return gtk_tree_model_iter_has_child (child_model, iter);
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_tree_model_mapping_iter_n_children (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GtkTreeModel *child_model;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model), 0);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_MAPPING (tree_model)->child_model != NULL, 0);
|
||||
|
||||
child_model = GTK_TREE_MODEL_MAPPING (tree_model)->child_model;
|
||||
return gtk_tree_model_iter_n_children (child_model, iter);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_model_mapping_iter_nth_child (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent,
|
||||
gint n)
|
||||
{
|
||||
GtkTreeModel *child_model;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model), 0);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_MAPPING (tree_model)->child_model != NULL, 0);
|
||||
|
||||
child_model = GTK_TREE_MODEL_MAPPING (tree_model)->child_model;
|
||||
return gtk_tree_model_iter_nth_child (child_model, iter, parent, n);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_model_mapping_iter_parent (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *child)
|
||||
{
|
||||
GtkTreeModel *child_model;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model), 0);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_MAPPING (tree_model)->child_model != NULL, 0);
|
||||
|
||||
child_model = GTK_TREE_MODEL_MAPPING (tree_model)->child_model;
|
||||
return gtk_tree_model_iter_parent (child_model, iter, child);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_mapping_ref_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GtkTreeModel *child_model;
|
||||
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model));
|
||||
g_return_if_fail (GTK_TREE_MODEL_MAPPING (tree_model)->child_model != NULL);
|
||||
|
||||
child_model = GTK_TREE_MODEL_MAPPING (tree_model)->child_model;
|
||||
gtk_tree_model_ref_iter (child_model, iter);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_mapping_unref_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GtkTreeModel *child_model;
|
||||
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL_MAPPING (tree_model));
|
||||
g_return_if_fail (GTK_TREE_MODEL_MAPPING (tree_model)->child_model != NULL);
|
||||
|
||||
child_model = GTK_TREE_MODEL_MAPPING (tree_model)->child_model;
|
||||
gtk_tree_model_unref_iter (child_model, iter);
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
/* gtktreemodelmapping.h
|
||||
* Copyright (C) 2000 Red Hat, Inc., Alexander Larsson <alexl@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_TREE_MODEL_MAPPING_H__
|
||||
#define __GTK_TREE_MODEL_MAPPING_H__
|
||||
|
||||
#include <gtk/gtktreemodel.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GTK_TYPE_TREE_MODEL_MAPPING (gtk_tree_model_mapping_get_type ())
|
||||
#define GTK_TREE_MODEL_MAPPING(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TREE_MODEL_MAPPING, GtkTreeModelMapping))
|
||||
#define GTK_TREE_MODEL_MAPPING_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE_MODEL_MAPPING, GtkTreeModelMappingClass))
|
||||
#define GTK_IS_TREE_MODEL_MAPPING(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TREE_MODEL_MAPPING))
|
||||
#define GTK_IS_TREE_MODEL_MAPPING_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GTK_TYPE_TREE_MODEL_MAPPING))
|
||||
|
||||
typedef struct _GtkTreeModelMapping GtkTreeModelMapping;
|
||||
typedef struct _GtkTreeModelMappingClass GtkTreeModelMappingClass;
|
||||
typedef struct _GtkTreeModelMappingMap GtkTreeModelMappingMap;
|
||||
|
||||
typedef void (* GValueMapFunc) (const GValue *a,
|
||||
GValue *b,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
struct _GtkTreeModelMappingMap
|
||||
{
|
||||
gint src_column;
|
||||
GType col_type;
|
||||
GValueMapFunc map_func;
|
||||
gpointer user_data;
|
||||
};
|
||||
|
||||
struct _GtkTreeModelMapping
|
||||
{
|
||||
GtkObject parent;
|
||||
|
||||
/* < private > */
|
||||
GtkTreeModel *child_model;
|
||||
gint n_columns;
|
||||
GtkTreeModelMappingMap *column_maps;
|
||||
};
|
||||
|
||||
struct _GtkTreeModelMappingClass
|
||||
{
|
||||
GtkObjectClass parent_class;
|
||||
|
||||
/* signals */
|
||||
/* Will be moved into the GtkTreeModelIface eventually */
|
||||
void (* changed) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeIter *iter);
|
||||
void (* inserted) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeIter *iter);
|
||||
void (* child_toggled) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeIter *iter);
|
||||
void (* deleted) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path);
|
||||
};
|
||||
|
||||
|
||||
GtkType gtk_tree_model_mapping_get_type (void);
|
||||
GtkTreeModel *gtk_tree_model_mapping_new (void);
|
||||
GtkTreeModel *gtk_tree_model_mapping_new_with_model (GtkTreeModel *child_model);
|
||||
void gtk_tree_model_mapping_set_n_columns (GtkTreeModelMapping *tree_model_mapping,
|
||||
gint n_columns);
|
||||
void gtk_tree_model_mapping_set_column_mapping (GtkTreeModelMapping *tree_model_mapping,
|
||||
gint column,
|
||||
gint src_column,
|
||||
GType col_type,
|
||||
GValueMapFunc map_func,
|
||||
gpointer user_data);
|
||||
void gtk_tree_model_mapping_set_model (GtkTreeModelMapping *tree_model_mapping,
|
||||
GtkTreeModel *child_model);
|
||||
GtkTreeModel *gtk_tree_model_mapping_get_model (GtkTreeModelMapping *tree_model);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GTK_TREE_MODEL_MAPPING_H__ */
|
@ -626,6 +626,16 @@ gtk_tree_store_set_cell (GtkTreeStore *tree_store,
|
||||
NULL, iter);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_store_set_valist:
|
||||
* @tree_store: a #GtkTreeStore
|
||||
* @iter: row to set data for
|
||||
* @var_args: va_list of column/value pairs
|
||||
*
|
||||
* See gtk_tree_store_set(); this version takes a va_list for
|
||||
* use by language bindings.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gtk_tree_store_set_valist (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
@ -699,62 +709,6 @@ gtk_tree_store_set (GtkTreeStore *tree_store,
|
||||
va_end (var_args);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_tree_store_get_valist (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args)
|
||||
{
|
||||
gint column;
|
||||
|
||||
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
||||
|
||||
column = va_arg (var_args, gint);
|
||||
|
||||
while (column != -1)
|
||||
{
|
||||
GValue value = { 0, };
|
||||
gchar *error = NULL;
|
||||
|
||||
if (column >= tree_store->n_columns)
|
||||
{
|
||||
g_warning ("%s: Invalid column number %d accessed (remember to end your list of columns with a -1)", G_STRLOC, column);
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_tree_store_get_value (GTK_TREE_MODEL (tree_store), iter, column, &value);
|
||||
|
||||
G_VALUE_LCOPY (&value, var_args, &error);
|
||||
if (error)
|
||||
{
|
||||
g_warning ("%s: %s", G_STRLOC, error);
|
||||
g_free (error);
|
||||
|
||||
/* we purposely leak the value here, it might not be
|
||||
* in a sane state if an error condition occoured
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
g_value_unset (&value);
|
||||
|
||||
column = va_arg (var_args, gint);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_tree_store_get (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
...)
|
||||
{
|
||||
va_list var_args;
|
||||
|
||||
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
||||
|
||||
va_start (var_args, iter);
|
||||
gtk_tree_store_get_valist (tree_store, iter, var_args);
|
||||
va_end (var_args);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_tree_store_remove (GtkTreeStore *model,
|
||||
GtkTreeIter *iter)
|
||||
|
@ -87,12 +87,6 @@ void gtk_tree_store_set (GtkTreeStore *tree_store,
|
||||
void gtk_tree_store_set_valist (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args);
|
||||
void gtk_tree_store_get (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
...);
|
||||
void gtk_tree_store_get_valist (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args);
|
||||
void gtk_tree_store_remove (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_tree_store_insert (GtkTreeStore *tree_store,
|
||||
|
@ -821,6 +821,7 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
|
||||
(gfloat) MAX (tree_view->priv->height - allocation->height, 0));
|
||||
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (tree_view->priv->vadjustment), "changed");
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@ -989,7 +990,8 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
|
||||
gint bin_window_width;
|
||||
GtkTreePath *cursor_path;
|
||||
GtkTreePath *drag_dest_path;
|
||||
|
||||
GList *last_column;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
|
||||
|
||||
@ -1043,7 +1045,14 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
|
||||
|
||||
gdk_drawable_get_size (tree_view->priv->bin_window,
|
||||
&bin_window_width, NULL);
|
||||
|
||||
|
||||
for (last_column = g_list_last (tree_view->priv->columns);
|
||||
last_column &&
|
||||
!(GTK_TREE_VIEW_COLUMN (last_column->data)->visible) &&
|
||||
GTK_WIDGET_CAN_FOCUS (GTK_TREE_VIEW_COLUMN (last_column->data)->button);
|
||||
last_column = last_column->prev)
|
||||
;
|
||||
|
||||
/* Actually process the expose event. To do this, we want to
|
||||
* start at the first node of the event, and walk the tree in
|
||||
* order, drawing each successive node.
|
||||
@ -1096,7 +1105,7 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
|
||||
|
||||
background_area.x = cell_offset;
|
||||
background_area.width = TREE_VIEW_COLUMN_WIDTH (column);
|
||||
|
||||
|
||||
cell_area = background_area;
|
||||
cell_area.y += TREE_VIEW_VERTICAL_SEPARATOR / 2;
|
||||
cell_area.height -= TREE_VIEW_VERTICAL_SEPARATOR;
|
||||
|
@ -57,17 +57,17 @@ static void gtk_tree_view_column_class_init (GtkTreeViewColumnClass *klass)
|
||||
static void gtk_tree_view_column_set_attributesv (GtkTreeViewColumn *tree_column,
|
||||
va_list args);
|
||||
static void gtk_real_tree_column_clicked (GtkTreeViewColumn *tree_column);
|
||||
static void gtk_tree_view_column_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer);
|
||||
static void gtk_tree_view_column_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer);
|
||||
|
||||
static void gtk_tree_view_column_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer);
|
||||
static void gtk_tree_view_column_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec,
|
||||
const gchar *trailer);
|
||||
static void gtk_tree_view_column_finalize (GObject *object);
|
||||
|
||||
|
||||
static GtkObjectClass *parent_class = NULL;
|
||||
@ -111,6 +111,7 @@ gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class)
|
||||
|
||||
class->clicked = gtk_real_tree_column_clicked;
|
||||
|
||||
object_class->finalize = gtk_tree_view_column_finalize;
|
||||
object_class->set_property = gtk_tree_view_column_set_property;
|
||||
object_class->get_property = gtk_tree_view_column_get_property;
|
||||
|
||||
@ -413,6 +414,18 @@ gtk_tree_view_column_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_view_column_finalize (GObject *object)
|
||||
{
|
||||
GtkTreeViewColumn *tree_column = (GtkTreeViewColumn *) object;
|
||||
|
||||
if (tree_column->func_data && tree_column->destroy)
|
||||
(tree_column->destroy) (tree_column->func_data);
|
||||
|
||||
g_slist_free (tree_column->attributes);
|
||||
g_free (tree_column->title);
|
||||
}
|
||||
|
||||
/* used to make the buttons 'unclickable' */
|
||||
|
||||
static gint
|
||||
@ -477,7 +490,7 @@ gtk_tree_view_column_new (void)
|
||||
* Return value: A newly created #GtkTreeViewColumn.
|
||||
**/
|
||||
GtkTreeViewColumn *
|
||||
gtk_tree_view_column_new_with_attributes (gchar *title,
|
||||
gtk_tree_view_column_new_with_attributes (const gchar *title,
|
||||
GtkCellRenderer *cell,
|
||||
...)
|
||||
{
|
||||
@ -553,7 +566,7 @@ gtk_tree_view_column_get_cell_renderer (GtkTreeViewColumn *tree_column)
|
||||
**/
|
||||
void
|
||||
gtk_tree_view_column_add_attribute (GtkTreeViewColumn *tree_column,
|
||||
gchar *attribute,
|
||||
const gchar *attribute,
|
||||
gint column)
|
||||
{
|
||||
g_return_if_fail (tree_column != NULL);
|
||||
@ -615,6 +628,37 @@ gtk_tree_view_column_set_attributes (GtkTreeViewColumn *tree_column,
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gtk_tree_view_column_set_func:
|
||||
* @tree_column: A #GtkTreeViewColumn
|
||||
* @func: The #GtkTreeViewColumnFunc to use.
|
||||
* @func_data: The user data for @func.
|
||||
* @destroy: The destroy notification for @func_data
|
||||
*
|
||||
* Sets the #GtkTreeViewColumnFunc to use for the column. This function is used
|
||||
* instead of the standard attributes mapping for setting the column value, and
|
||||
* should set the value of @tree_column 's cell renderer as appropriate. @func
|
||||
* may be NULL to remove an older one.
|
||||
**/
|
||||
void
|
||||
gtk_tree_view_column_set_func (GtkTreeViewColumn *tree_column,
|
||||
GtkTreeViewColumnFunc *func,
|
||||
gpointer func_data,
|
||||
GtkDestroyNotify destroy)
|
||||
{
|
||||
g_return_if_fail (tree_column != NULL);
|
||||
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
||||
|
||||
if (tree_column->func_data && tree_column->destroy)
|
||||
(tree_column->destroy) (tree_column->func_data);
|
||||
|
||||
tree_column->func = func;
|
||||
tree_column->func_data = func_data;
|
||||
tree_column->destroy = destroy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gtk_tree_view_column_clear_attributes:
|
||||
* @tree_column: a #GtkTreeViewColumn
|
||||
@ -667,15 +711,17 @@ gtk_tree_view_column_set_cell_data (GtkTreeViewColumn *tree_column,
|
||||
if (tree_model == NULL)
|
||||
return;
|
||||
|
||||
if (tree_column->func && (* tree_column->func) (tree_column,
|
||||
tree_model,
|
||||
iter,
|
||||
tree_column->func_data))
|
||||
return;
|
||||
if (tree_column->func)
|
||||
{
|
||||
(* tree_column->func) (tree_column, tree_model, iter, tree_column->func_data);
|
||||
return;
|
||||
}
|
||||
|
||||
cell = (GObject *) tree_column->cell;
|
||||
list = tree_column->attributes;
|
||||
|
||||
g_object_freeze_notify (cell);
|
||||
|
||||
while (list && list->next)
|
||||
{
|
||||
gtk_tree_model_get_value (tree_model, iter,
|
||||
@ -684,7 +730,9 @@ gtk_tree_view_column_set_cell_data (GtkTreeViewColumn *tree_column,
|
||||
g_object_set_property (cell, (gchar *) list->data, &value);
|
||||
g_value_unset (&value);
|
||||
list = list->next->next;
|
||||
|
||||
}
|
||||
g_object_thaw_notify (cell);
|
||||
}
|
||||
|
||||
/* Options for manipulating the columns */
|
||||
|
@ -45,11 +45,12 @@ typedef enum
|
||||
typedef struct _GtkTreeViewColumn GtkTreeViewColumn;
|
||||
typedef struct _GtkTreeViewColumnClass GtkTreeViewColumnClass;
|
||||
|
||||
typedef gboolean (* GtkTreeViewColumnFunc) (GtkTreeViewColumn *tree_column,
|
||||
GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data);
|
||||
typedef void (* GtkTreeViewColumnFunc) (GtkTreeViewColumn *tree_column,
|
||||
GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data);
|
||||
|
||||
|
||||
struct _GtkTreeViewColumn
|
||||
{
|
||||
GtkObject parent;
|
||||
@ -70,6 +71,7 @@ struct _GtkTreeViewColumn
|
||||
|
||||
GtkTreeViewColumnFunc func;
|
||||
gpointer func_data;
|
||||
GtkDestroyNotify destroy;
|
||||
gchar *title;
|
||||
GtkCellRenderer *cell;
|
||||
GSList *attributes;
|
||||
@ -91,17 +93,21 @@ struct _GtkTreeViewColumnClass
|
||||
|
||||
GtkType gtk_tree_view_column_get_type (void);
|
||||
GtkTreeViewColumn *gtk_tree_view_column_new (void);
|
||||
GtkTreeViewColumn *gtk_tree_view_column_new_with_attributes (gchar *title,
|
||||
GtkTreeViewColumn *gtk_tree_view_column_new_with_attributes (const gchar *title,
|
||||
GtkCellRenderer *cell,
|
||||
...);
|
||||
void gtk_tree_view_column_set_cell_renderer (GtkTreeViewColumn *tree_column,
|
||||
GtkCellRenderer *cell);
|
||||
GtkCellRenderer *gtk_tree_view_column_get_cell_renderer (GtkTreeViewColumn *tree_column);
|
||||
void gtk_tree_view_column_add_attribute (GtkTreeViewColumn *tree_column,
|
||||
gchar *attribute,
|
||||
const gchar *attribute,
|
||||
gint column);
|
||||
void gtk_tree_view_column_set_attributes (GtkTreeViewColumn *tree_column,
|
||||
...);
|
||||
void gtk_tree_view_column_set_func (GtkTreeViewColumn *tree_column,
|
||||
GtkTreeViewColumnFunc *func,
|
||||
gpointer func_data,
|
||||
GtkDestroyNotify destroy);
|
||||
void gtk_tree_view_column_clear_attributes (GtkTreeViewColumn *tree_column);
|
||||
void gtk_tree_view_column_set_cell_data (GtkTreeViewColumn *tree_column,
|
||||
GtkTreeModel *tree_model,
|
||||
|
@ -259,30 +259,6 @@ make_window (gint view_type)
|
||||
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (sort_model));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
GtkTreeModel *map_model;
|
||||
|
||||
map_model = gtk_tree_model_mapping_new_with_model (GTK_TREE_MODEL (base_model));
|
||||
|
||||
gtk_tree_model_mapping_set_n_columns (GTK_TREE_MODEL_MAPPING (map_model), 2);
|
||||
gtk_tree_model_mapping_set_column_mapping (GTK_TREE_MODEL_MAPPING (map_model),
|
||||
0,
|
||||
1,
|
||||
G_TYPE_STRING,
|
||||
uppercase_value,
|
||||
NULL);
|
||||
gtk_tree_model_mapping_set_column_mapping (GTK_TREE_MODEL_MAPPING (map_model),
|
||||
1,
|
||||
0,
|
||||
G_TYPE_STRING,
|
||||
uppercase_value,
|
||||
NULL);
|
||||
|
||||
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (map_model));
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
selection = GTK_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)));
|
||||
|
@ -259,30 +259,6 @@ make_window (gint view_type)
|
||||
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (sort_model));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
GtkTreeModel *map_model;
|
||||
|
||||
map_model = gtk_tree_model_mapping_new_with_model (GTK_TREE_MODEL (base_model));
|
||||
|
||||
gtk_tree_model_mapping_set_n_columns (GTK_TREE_MODEL_MAPPING (map_model), 2);
|
||||
gtk_tree_model_mapping_set_column_mapping (GTK_TREE_MODEL_MAPPING (map_model),
|
||||
0,
|
||||
1,
|
||||
G_TYPE_STRING,
|
||||
uppercase_value,
|
||||
NULL);
|
||||
gtk_tree_model_mapping_set_column_mapping (GTK_TREE_MODEL_MAPPING (map_model),
|
||||
1,
|
||||
0,
|
||||
G_TYPE_STRING,
|
||||
uppercase_value,
|
||||
NULL);
|
||||
|
||||
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (map_model));
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
selection = GTK_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)));
|
||||
|
Loading…
Reference in New Issue
Block a user