Commit 40743e12 authored by Kristian Rietveld's avatar Kristian Rietveld Committed by Kristian Rietveld

implement the GtkCellLayout interface, drop packing/attribute/cell data

Wed Oct  1 22:43:40 2003  Kristian Rietveld  <kris@gtk.org>

	* gtk/gtkcellview.[ch]: implement the GtkCellLayout interface, drop
	packing/attribute/cell data functions from the header,
	(gtk_cell_view_set_cell_data): added support for cell data funcs.

	* gtk/gtkcombobox.[ch]: implement the GtkCellLayout interface, drop
	packing/attribute/cell data functions from the header, implemented
	cell data func support.

	* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new): updated
	for the move to GtkCellLayout.

	* tests/testcombo.c (create_combo_box_grid_demo), (main): ditto.
parent c0addc2e
Wed Oct 1 22:43:40 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellview.[ch]: implement the GtkCellLayout interface, drop
packing/attribute/cell data functions from the header,
(gtk_cell_view_set_cell_data): added support for cell data funcs.
* gtk/gtkcombobox.[ch]: implement the GtkCellLayout interface, drop
packing/attribute/cell data functions from the header, implemented
cell data func support.
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new): updated
for the move to GtkCellLayout.
* tests/testcombo.c (create_combo_box_grid_demo), (main): ditto.
2003-10-01 Matthias Clasen <maclas@gmx.de>
* gtk/gtkaction.c (gtk_action_class_init):
......
Wed Oct 1 22:43:40 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellview.[ch]: implement the GtkCellLayout interface, drop
packing/attribute/cell data functions from the header,
(gtk_cell_view_set_cell_data): added support for cell data funcs.
* gtk/gtkcombobox.[ch]: implement the GtkCellLayout interface, drop
packing/attribute/cell data functions from the header, implemented
cell data func support.
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new): updated
for the move to GtkCellLayout.
* tests/testcombo.c (create_combo_box_grid_demo), (main): ditto.
2003-10-01 Matthias Clasen <maclas@gmx.de>
* gtk/gtkaction.c (gtk_action_class_init):
......
Wed Oct 1 22:43:40 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellview.[ch]: implement the GtkCellLayout interface, drop
packing/attribute/cell data functions from the header,
(gtk_cell_view_set_cell_data): added support for cell data funcs.
* gtk/gtkcombobox.[ch]: implement the GtkCellLayout interface, drop
packing/attribute/cell data functions from the header, implemented
cell data func support.
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new): updated
for the move to GtkCellLayout.
* tests/testcombo.c (create_combo_box_grid_demo), (main): ditto.
2003-10-01 Matthias Clasen <maclas@gmx.de>
* gtk/gtkaction.c (gtk_action_class_init):
......
Wed Oct 1 22:43:40 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellview.[ch]: implement the GtkCellLayout interface, drop
packing/attribute/cell data functions from the header,
(gtk_cell_view_set_cell_data): added support for cell data funcs.
* gtk/gtkcombobox.[ch]: implement the GtkCellLayout interface, drop
packing/attribute/cell data functions from the header, implemented
cell data func support.
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new): updated
for the move to GtkCellLayout.
* tests/testcombo.c (create_combo_box_grid_demo), (main): ditto.
2003-10-01 Matthias Clasen <maclas@gmx.de>
* gtk/gtkaction.c (gtk_action_class_init):
......
Wed Oct 1 22:43:40 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellview.[ch]: implement the GtkCellLayout interface, drop
packing/attribute/cell data functions from the header,
(gtk_cell_view_set_cell_data): added support for cell data funcs.
* gtk/gtkcombobox.[ch]: implement the GtkCellLayout interface, drop
packing/attribute/cell data functions from the header, implemented
cell data func support.
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_new): updated
for the move to GtkCellLayout.
* tests/testcombo.c (create_combo_box_grid_demo), (main): ditto.
2003-10-01 Matthias Clasen <maclas@gmx.de>
* gtk/gtkaction.c (gtk_action_class_init):
......
......@@ -18,6 +18,7 @@
*/
#include <gtk/gtkcellview.h>
#include <gtk/gtkcelllayout.h>
#include <gtk/gtkintl.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkcellrenderertext.h>
......@@ -35,6 +36,10 @@ struct _GtkCellViewCellInfo
guint pack : 1;
GSList *attributes;
GtkCellLayoutDataFunc func;
gpointer func_data;
GDestroyNotify destroy;
};
struct _GtkCellViewPrivate
......@@ -50,6 +55,7 @@ struct _GtkCellViewPrivate
static void gtk_cell_view_class_init (GtkCellViewClass *klass);
static void gtk_cell_view_cell_layout_init (GtkCellLayoutIface *iface);
static void gtk_cell_view_get_property (GObject *object,
guint param_id,
GValue *value,
......@@ -68,15 +74,34 @@ static void gtk_cell_view_size_allocate (GtkWidget *wid
GtkAllocation *allocation);
static gboolean gtk_cell_view_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_cell_view_set_attributesv (GtkCellView *cellview,
GtkCellRenderer *renderer,
va_list args);
static void gtk_cell_view_set_valuesv (GtkCellView *cellview,
GtkCellRenderer *renderer,
va_list args);
static GtkCellViewCellInfo *gtk_cell_view_get_cell_info (GtkCellView *cellview,
GtkCellRenderer *renderer);
static void gtk_cell_view_set_cell_data (GtkCellView *cellview);
static void gtk_cell_view_cell_layout_pack_start (GtkCellLayout *layout,
GtkCellRenderer *renderer,
gboolean expand);
static void gtk_cell_view_cell_layout_pack_end (GtkCellLayout *layout,
GtkCellRenderer *renderer,
gboolean expand);
static void gtk_cell_view_cell_layout_add_attribute (GtkCellLayout *layout,
GtkCellRenderer *renderer,
const gchar *attribute,
gint column);
static void gtk_cell_view_cell_layout_clear (GtkCellLayout *layout);
static void gtk_cell_view_cell_layout_clear_attributes (GtkCellLayout *layout,
GtkCellRenderer *renderer);
static void gtk_cell_view_cell_layout_set_cell_data_func (GtkCellLayout *layout,
GtkCellRenderer *cell,
GtkCellLayoutDataFunc func,
gpointer func_data,
GDestroyNotify destroy);
enum
{
PROP_0,
......@@ -108,8 +133,18 @@ gtk_cell_view_get_type (void)
(GInstanceInitFunc) gtk_cell_view_init
};
static const GInterfaceInfo cell_layout_info =
{
(GInterfaceInitFunc) gtk_cell_view_cell_layout_init,
NULL,
NULL
};
cell_view_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkCellView",
&cell_view_info, 0);
g_type_add_interface_static (cell_view_type, GTK_TYPE_CELL_LAYOUT,
&cell_layout_info);
}
return cell_view_type;
......@@ -157,6 +192,17 @@ gtk_cell_view_class_init (GtkCellViewClass *klass)
g_type_class_add_private (gobject_class, sizeof (GtkCellViewPrivate));
}
static void
gtk_cell_view_cell_layout_init (GtkCellLayoutIface *iface)
{
iface->pack_start = gtk_cell_view_cell_layout_pack_start;
iface->pack_end = gtk_cell_view_cell_layout_pack_end;
iface->clear = gtk_cell_view_cell_layout_clear;
iface->add_attribute = gtk_cell_view_cell_layout_add_attribute;
iface->set_cell_data_func = gtk_cell_view_cell_layout_set_cell_data_func;
iface->clear_attributes = gtk_cell_view_cell_layout_clear_attributes;
}
static void
gtk_cell_view_get_property (GObject *object,
guint param_id,
......@@ -447,76 +493,6 @@ gtk_cell_view_expose (GtkWidget *widget,
return FALSE;
}
GtkWidget *
gtk_cell_view_new (void)
{
GtkCellView *cellview;
cellview = GTK_CELL_VIEW (g_object_new (gtk_cell_view_get_type (), NULL));
return GTK_WIDGET (cellview);
}
GtkWidget *
gtk_cell_view_new_with_text (const gchar *text)
{
GtkCellView *cellview;
GtkCellRenderer *renderer;
GValue value = {0, };
cellview = GTK_CELL_VIEW (gtk_cell_view_new ());
renderer = gtk_cell_renderer_text_new ();
gtk_cell_view_pack_start (cellview, renderer, TRUE);
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, text);
gtk_cell_view_set_values (cellview, renderer, "text", &value, NULL);
g_value_unset (&value);
return GTK_WIDGET (cellview);
}
GtkWidget *
gtk_cell_view_new_with_markup (const gchar *markup)
{
GtkCellView *cellview;
GtkCellRenderer *renderer;
GValue value = {0, };
cellview = GTK_CELL_VIEW (gtk_cell_view_new ());
renderer = gtk_cell_renderer_text_new ();
gtk_cell_view_pack_start (cellview, renderer, TRUE);
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, markup);
gtk_cell_view_set_values (cellview, renderer, "markup", &value, NULL);
g_value_unset (&value);
return GTK_WIDGET (cellview);
}
GtkWidget *
gtk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf)
{
GtkCellView *cellview;
GtkCellRenderer *renderer;
GValue value = {0, };
cellview = GTK_CELL_VIEW (gtk_cell_view_new ());
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_cell_view_pack_start (cellview, renderer, TRUE);
g_value_init (&value, GDK_TYPE_PIXBUF);
g_value_set_object (&value, pixbuf);
gtk_cell_view_set_values (cellview, renderer, "pixbuf", &value, NULL);
g_value_unset (&value);
return GTK_WIDGET (cellview);
}
static GtkCellViewCellInfo *
gtk_cell_view_get_cell_info (GtkCellView *cellview,
GtkCellRenderer *renderer)
......@@ -534,12 +510,57 @@ gtk_cell_view_get_cell_info (GtkCellView *cellview,
return NULL;
}
void
gtk_cell_view_pack_start (GtkCellView *cellview,
GtkCellRenderer *renderer,
gboolean expand)
static void
gtk_cell_view_set_cell_data (GtkCellView *cellview)
{
GList *i;
GtkTreeIter iter;
GtkTreePath *path;
g_return_if_fail (cellview->priv->displayed_row != NULL);
path = gtk_tree_row_reference_get_path (cellview->priv->displayed_row);
gtk_tree_model_get_iter (cellview->priv->model, &iter, path);
gtk_tree_path_free (path);
for (i = cellview->priv->cell_list; i; i = i->next)
{
GSList *j;
GtkCellViewCellInfo *info = i->data;
if (info->func)
{
(* info->func) (GTK_CELL_LAYOUT (cellview),
info->cell,
cellview->priv->model,
&iter,
info->func_data);
continue;
}
for (j = info->attributes; j && j->next; j = j->next->next)
{
gchar *property = j->data;
gint column = GPOINTER_TO_INT (j->next->data);
GValue value = {0, };
gtk_tree_model_get_value (cellview->priv->model, &iter,
column, &value);
g_object_set_property (G_OBJECT (info->cell),
property, &value);
g_value_unset (&value);
}
}
}
/* GtkCellLayout implementation */
static void
gtk_cell_view_cell_layout_pack_start (GtkCellLayout *layout,
GtkCellRenderer *renderer,
gboolean expand)
{
GtkCellViewCellInfo *info;
GtkCellView *cellview = GTK_CELL_VIEW (layout);
g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
......@@ -556,12 +577,13 @@ gtk_cell_view_pack_start (GtkCellView *cellview,
cellview->priv->cell_list = g_list_append (cellview->priv->cell_list, info);
}
void
gtk_cell_view_pack_end (GtkCellView *cellview,
GtkCellRenderer *renderer,
gboolean expand)
static void
gtk_cell_view_cell_layout_pack_end (GtkCellLayout *layout,
GtkCellRenderer *renderer,
gboolean expand)
{
GtkCellViewCellInfo *info;
GtkCellView *cellview = GTK_CELL_VIEW (layout);
g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
......@@ -578,13 +600,14 @@ gtk_cell_view_pack_end (GtkCellView *cellview,
cellview->priv->cell_list = g_list_append (cellview->priv->cell_list, info);
}
void
gtk_cell_view_add_attribute (GtkCellView *cellview,
GtkCellRenderer *renderer,
const gchar *attribute,
gint column)
static void
gtk_cell_view_cell_layout_add_attribute (GtkCellLayout *layout,
GtkCellRenderer *renderer,
const gchar *attribute,
gint column)
{
GtkCellViewCellInfo *info;
GtkCellView *cellview = GTK_CELL_VIEW (layout);
g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
info = gtk_cell_view_get_cell_info (cellview, renderer);
......@@ -596,16 +619,19 @@ gtk_cell_view_add_attribute (GtkCellView *cellview,
g_strdup (attribute));
}
void
gtk_cell_view_clear (GtkCellView *cellview)
static void
gtk_cell_view_cell_layout_clear (GtkCellLayout *layout)
{
GList *i;
GtkCellView *cellview = GTK_CELL_VIEW (layout);
g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
for (i = cellview->priv->cell_list; i; i = i->next)
{
GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
gtk_cell_view_clear_attributes (cellview, info->cell);
gtk_cell_view_cell_layout_clear_attributes (layout, info->cell);
g_object_unref (G_OBJECT (info->cell));
g_free (info);
}
......@@ -614,17 +640,47 @@ gtk_cell_view_clear (GtkCellView *cellview)
cellview->priv->cell_list = NULL;
}
void
gtk_cell_view_clear_attributes (GtkCellView *cellview,
GtkCellRenderer *renderer)
static void
gtk_cell_view_cell_layout_set_cell_data_func (GtkCellLayout *layout,
GtkCellRenderer *cell,
GtkCellLayoutDataFunc func,
gpointer func_data,
GDestroyNotify destroy)
{
GtkCellView *cellview = GTK_CELL_VIEW (layout);
GtkCellViewCellInfo *info;
g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
info = gtk_cell_view_get_cell_info (cellview, cell);
g_return_if_fail (info != NULL);
if (info->destroy)
{
GDestroyNotify d = info->destroy;
info->destroy = NULL;
d (info->func_data);
}
info->func = func;
info->func_data = func_data;
info->destroy = destroy;
}
static void
gtk_cell_view_cell_layout_clear_attributes (GtkCellLayout *layout,
GtkCellRenderer *renderer)
{
GtkCellViewCellInfo *info;
GtkCellView *cellview = GTK_CELL_VIEW (layout);
GSList *list;
g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
info = gtk_cell_view_get_cell_info (cellview, renderer);
g_return_if_fail (info != NULL);
list = info->attributes;
......@@ -638,40 +694,79 @@ gtk_cell_view_clear_attributes (GtkCellView *cellview,
info->attributes = NULL;
}
static void
gtk_cell_view_set_attributesv (GtkCellView *cellview,
GtkCellRenderer *renderer,
va_list args)
/* public API */
GtkWidget *
gtk_cell_view_new (void)
{
gchar *attribute;
gint column;
GtkCellView *cellview;
attribute = va_arg (args, gchar *);
cellview = GTK_CELL_VIEW (g_object_new (gtk_cell_view_get_type (), NULL));
gtk_cell_view_clear_attributes (cellview, renderer);
return GTK_WIDGET (cellview);
}
while (attribute)
{
column = va_arg (args, gint);
gtk_cell_view_add_attribute (cellview, renderer, attribute, column);
attribute = va_arg (args, gchar *);
}
GtkWidget *
gtk_cell_view_new_with_text (const gchar *text)
{
GtkCellView *cellview;
GtkCellRenderer *renderer;
GValue value = {0, };
cellview = GTK_CELL_VIEW (gtk_cell_view_new ());
renderer = gtk_cell_renderer_text_new ();
gtk_cell_view_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview),
renderer, TRUE);
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, text);
gtk_cell_view_set_values (cellview, renderer, "text", &value, NULL);
g_value_unset (&value);
return GTK_WIDGET (cellview);
}
void
gtk_cell_view_set_attributes (GtkCellView *cellview,
GtkCellRenderer *renderer,
...)
GtkWidget *
gtk_cell_view_new_with_markup (const gchar *markup)
{
va_list args;
GtkCellView *cellview;
GtkCellRenderer *renderer;
GValue value = {0, };
g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
g_return_if_fail (gtk_cell_view_get_cell_info (cellview, renderer));
cellview = GTK_CELL_VIEW (gtk_cell_view_new ());
va_start (args, renderer);
gtk_cell_view_set_attributesv (cellview, renderer, args);
va_end (args);
renderer = gtk_cell_renderer_text_new ();
gtk_cell_view_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview),
renderer, TRUE);
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, markup);
gtk_cell_view_set_values (cellview, renderer, "markup", &value, NULL);
g_value_unset (&value);
return GTK_WIDGET (cellview);
}
GtkWidget *
gtk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf)
{
GtkCellView *cellview;
GtkCellRenderer *renderer;
GValue value = {0, };
cellview = GTK_CELL_VIEW (gtk_cell_view_new ());
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_cell_view_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview),
renderer, TRUE);
g_value_init (&value, GDK_TYPE_PIXBUF);
g_value_set_object (&value, pixbuf);
gtk_cell_view_set_values (cellview, renderer, "pixbuf", &value, NULL);
g_value_unset (&value);
return GTK_WIDGET (cellview);
}
void
......@@ -746,39 +841,6 @@ gtk_cell_view_set_model (GtkCellView *cellview,
g_object_ref (G_OBJECT (cellview->priv->model));
}
static void
gtk_cell_view_set_cell_data (GtkCellView *cellview)
{
GList *i;
GtkTreeIter iter;
GtkTreePath *path;
g_return_if_fail (cellview->priv->displayed_row != NULL);
path = gtk_tree_row_reference_get_path (cellview->priv->displayed_row);
gtk_tree_model_get_iter (cellview->priv->model, &iter, path);
gtk_tree_path_free (path);
for (i = cellview->priv->cell_list; i; i = i->next)
{
GSList *j;
GtkCellViewCellInfo *info = i->data;
for (j = info->attributes; j && j->next; j = j->next->next)
{
gchar *property = j->data;
gint column = GPOINTER_TO_INT (j->next->data);
GValue value = {0, };
gtk_tree_model_get_value (cellview->priv->model, &iter,
column, &value);
g_object_set_property (G_OBJECT (info->cell),
property, &value);
g_value_unset (&value);
}
}
}
void
gtk_cell_view_set_displayed_row (GtkCellView *cellview,
GtkTreePath *path)
......
......@@ -58,22 +58,6 @@ GtkWidget *gtk_cell_view_new_with_markup (const gchar *markup)
GtkWidget *gtk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf);
void gtk_cell_view_pack_start (GtkCellView *cell_view,
GtkCellRenderer *renderer,
gboolean expand);
void gtk_cell_view_pack_end (GtkCellView *cell_view,
GtkCellRenderer *renderer,
gboolean expand);
void gtk_cell_view_clear (GtkCellView *cell_view);
void gtk_cell_view_add_attribute (GtkCellView *cell_view,
GtkCellRenderer *renderer,
const gchar *attribute,
gint column);
void gtk_cell_view_clear_attributes (GtkCellView *cell_view,
GtkCellRenderer *attribute);
void gtk_cell_view_set_attributes (GtkCellView *cell_view,
GtkCellRenderer *renderer,
...);
void gtk_cell_view_set_value (GtkCellView *cell_view,
GtkCellRenderer *renderer,
gchar *property,
......
......@@ -18,6 +18,7 @@
*/
#include <gtk/gtkcombobox.h>
#include <gtk/gtkcelllayout.h>
#include <gtk/gtkcellview.h>
#include <gtk/gtkcellviewmenuitem.h>
......@@ -54,6 +55,10 @@ struct _ComboCellInfo
GtkCellRenderer *cell;
GSList *attributes;
GtkCellLayoutDataFunc func;
gpointer func_data;
GDestroyNotify destroy;
guint expand : 1;
guint pack : 1;
};
......@@ -119,6 +124,7 @@ static guint combo_box_signals[LAST_SIGNAL] = {0,};
/* common */
static void gtk_combo_box_class_init (GtkComboBoxClass *klass);
static void gtk_combo_box_cell_layout_init (GtkCellLayoutIface *iface);
static void gtk_combo_box_init (GtkComboBox *combo_box);
static void gtk_combo_box_set_property (GObject *object,
......@@ -223,6 +229,26 @@ static void gtk_combo_box_menu_row_changed (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data);
/* cell layout */
static void gtk_combo_box_cell_layout_pack_start (GtkCellLayout *layout,
GtkCellRenderer *cell,
gboolean expand);
static void gtk_combo_box_cell_layout_pack_end (GtkCellLayout *layout,
GtkCellRenderer *cell,
gboolean expand);
static void gtk_combo_box_cell_layout_clear (GtkCellLayout *layout);
static void gtk_combo_box_cell_layout_add_attribute (GtkCellLayout *layout,
GtkCellRenderer *cell,
const gchar *attribute,
gint column);
static void gtk_combo_box_cell_layout_set_cell_data_func (GtkCellLayout *layout,
GtkCellRenderer *cell,
GtkCellLayoutDataFunc func,
gpointer func_data,
GDestroyNotify destroy);
static void gtk_combo_box_cell_layout_clear_attributes (GtkCellLayout *layout,
GtkCellRenderer *cell);
GType
gtk_combo_box_get_type (void)
......@@ -244,10 +270,21 @@ gtk_combo_box_get_type (void)
(GInstanceInitFunc) gtk_combo_box_init
};
static const GInterfaceInfo cell_layout_info =
{
(GInterfaceInitFunc) gtk_combo_box_cell_layout_init,
NULL,
NULL
};
combo_box_type = g_type_register_static (GTK_TYPE_BIN,
"GtkComboBox",
&combo_box_info,
0);
g_type_add_interface_static (combo_box_type,
GTK_TYPE_CELL_LAYOUT,
&cell_layout_info);
}
return combo_box_type;
......@@ -348,6 +385,17 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
g_type_class_add_private (object_class, sizeof (GtkComboBoxPrivate));
}
static void
gtk_combo_box_cell_layout_init (GtkCellLayoutIface *iface)
{
iface->pack_start = gtk_combo_box_cell_layout_pack_start;
iface->pack_end = gtk_combo_box_cell_layout_pack_end;
iface->clear = gtk_combo_box_cell_layout_clear;
iface->add_attribute = gtk_combo_box_cell_layout_add_attribute;
iface->set_cell_data_func = gtk_combo_box_cell_layout_set_cell_data_func;
iface->clear_attributes = gtk_combo_box_cell_layout_clear_attributes;
}
static void
gtk_combo_box_init (GtkComboBox *combo_box)
{
......@@ -1097,18 +1145,22 @@ cell_view_sync_cells (GtkComboBox *combo_box,
ComboCellInfo *info = (ComboCellInfo *)k->data;
if (info->pack == GTK_PACK_START)
gtk_cell_view_pack_start (cell_view,
info->cell, info->expand);
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cell_view),
info->cell, info->expand);
else if (info->pack == GTK_PACK_END)
gtk_cell_view_pack_end (cell_view,
info->cell, info->expand);
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (cell_view),
info->cell, info->expand);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cell_view),
info->cell,
info->func, info->func_data, NULL);
for (j = info->attributes; j; j = j->next->next)
{
gtk_cell_view_add_attribute (cell_view,
info->cell,
j->data,
GPOINTER_TO_INT (j->next->data));
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (cell_view),
info->cell,
j->data,
GPOINTER_TO_INT (j->next->data));
}
}
}
......@@ -1856,29 +1908,15 @@ gtk_combo_box_list_row_changed (GtkTreeModel *model,
}
/*
* public API
* GtkCellLayout implementation
*/
GtkWidget *
gtk_combo_box_new (GtkTreeModel *model)
{
GtkComboBox *combo_box;
g_return_val_if_fail (GTK_IS_TREE_MODEL (model), NULL);
combo_box = GTK_COMBO_BOX (g_object_new (gtk_combo_box_get_type (),