Fri Dec 19 23:36:00 2003  Kristian Rietveld  <kris@gtk.org>

	Fixes #108458.

	* gtk/gtkcelllayout.[ch]: added a reorder method.

	* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_cell_layout_init),
	(gtk_tree_view_column_cell_layout_reorder): implement reorder.

	* gtk/gtkcellview.c (gtk_cell_view_cell_layout_init),
	(gtk_cell_view_cell_layout_reorder): ditto.

	* gtk/gtkcombobox.c (gtk_combo_box_cell_layout_init),
	(gtk_combo_box_cell_layout_reorder): ditto.

	* gtk/gtkentrycompletion.c (gtk_entry_completion_cell_layout_init),
	(gtk_entry_completion_reorder): ditto.
This commit is contained in:
Kristian Rietveld 2003-12-19 22:47:20 +00:00 committed by Kristian Rietveld
parent 30d9f88996
commit 2f4326e406
11 changed files with 262 additions and 0 deletions

View File

@ -1,3 +1,21 @@
Fri Dec 19 23:36:00 2003 Kristian Rietveld <kris@gtk.org>
Fixes #108458.
* gtk/gtkcelllayout.[ch]: added a reorder method.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_cell_layout_init),
(gtk_tree_view_column_cell_layout_reorder): implement reorder.
* gtk/gtkcellview.c (gtk_cell_view_cell_layout_init),
(gtk_cell_view_cell_layout_reorder): ditto.
* gtk/gtkcombobox.c (gtk_combo_box_cell_layout_init),
(gtk_combo_box_cell_layout_reorder): ditto.
* gtk/gtkentrycompletion.c (gtk_entry_completion_cell_layout_init),
(gtk_entry_completion_reorder): ditto.
Fri Dec 19 22:18:19 2003 Kristian Rietveld <kris@gtk.org> Fri Dec 19 22:18:19 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr * gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr

View File

@ -1,3 +1,21 @@
Fri Dec 19 23:36:00 2003 Kristian Rietveld <kris@gtk.org>
Fixes #108458.
* gtk/gtkcelllayout.[ch]: added a reorder method.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_cell_layout_init),
(gtk_tree_view_column_cell_layout_reorder): implement reorder.
* gtk/gtkcellview.c (gtk_cell_view_cell_layout_init),
(gtk_cell_view_cell_layout_reorder): ditto.
* gtk/gtkcombobox.c (gtk_combo_box_cell_layout_init),
(gtk_combo_box_cell_layout_reorder): ditto.
* gtk/gtkentrycompletion.c (gtk_entry_completion_cell_layout_init),
(gtk_entry_completion_reorder): ditto.
Fri Dec 19 22:18:19 2003 Kristian Rietveld <kris@gtk.org> Fri Dec 19 22:18:19 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr * gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr

View File

@ -1,3 +1,21 @@
Fri Dec 19 23:36:00 2003 Kristian Rietveld <kris@gtk.org>
Fixes #108458.
* gtk/gtkcelllayout.[ch]: added a reorder method.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_cell_layout_init),
(gtk_tree_view_column_cell_layout_reorder): implement reorder.
* gtk/gtkcellview.c (gtk_cell_view_cell_layout_init),
(gtk_cell_view_cell_layout_reorder): ditto.
* gtk/gtkcombobox.c (gtk_combo_box_cell_layout_init),
(gtk_combo_box_cell_layout_reorder): ditto.
* gtk/gtkentrycompletion.c (gtk_entry_completion_cell_layout_init),
(gtk_entry_completion_reorder): ditto.
Fri Dec 19 22:18:19 2003 Kristian Rietveld <kris@gtk.org> Fri Dec 19 22:18:19 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr * gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr

View File

@ -1,3 +1,21 @@
Fri Dec 19 23:36:00 2003 Kristian Rietveld <kris@gtk.org>
Fixes #108458.
* gtk/gtkcelllayout.[ch]: added a reorder method.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_cell_layout_init),
(gtk_tree_view_column_cell_layout_reorder): implement reorder.
* gtk/gtkcellview.c (gtk_cell_view_cell_layout_init),
(gtk_cell_view_cell_layout_reorder): ditto.
* gtk/gtkcombobox.c (gtk_combo_box_cell_layout_init),
(gtk_combo_box_cell_layout_reorder): ditto.
* gtk/gtkentrycompletion.c (gtk_entry_completion_cell_layout_init),
(gtk_entry_completion_reorder): ditto.
Fri Dec 19 22:18:19 2003 Kristian Rietveld <kris@gtk.org> Fri Dec 19 22:18:19 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr * gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr

View File

@ -1,3 +1,21 @@
Fri Dec 19 23:36:00 2003 Kristian Rietveld <kris@gtk.org>
Fixes #108458.
* gtk/gtkcelllayout.[ch]: added a reorder method.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_cell_layout_init),
(gtk_tree_view_column_cell_layout_reorder): implement reorder.
* gtk/gtkcellview.c (gtk_cell_view_cell_layout_init),
(gtk_cell_view_cell_layout_reorder): ditto.
* gtk/gtkcombobox.c (gtk_combo_box_cell_layout_init),
(gtk_combo_box_cell_layout_reorder): ditto.
* gtk/gtkentrycompletion.c (gtk_entry_completion_cell_layout_init),
(gtk_entry_completion_reorder): ditto.
Fri Dec 19 22:18:19 2003 Kristian Rietveld <kris@gtk.org> Fri Dec 19 22:18:19 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr * gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr

View File

@ -250,3 +250,27 @@ gtk_cell_layout_clear_attributes (GtkCellLayout *cell_layout,
(* GTK_CELL_LAYOUT_GET_IFACE (cell_layout)->clear_attributes) (cell_layout, (* GTK_CELL_LAYOUT_GET_IFACE (cell_layout)->clear_attributes) (cell_layout,
cell); cell);
} }
/**
* gtk_cell_layout_reorder:
* @cell_layout: A #GtkCellLayout.
* @cell: A #GtkCellRenderer to reorder.
* @position: New position to insert @cell at.
*
* Re-inserts @cell at @position. Note that @cell has already to be packed
* into @cell_layout for this to function properly.
*
* Since: 2.4
*/
void
gtk_cell_layout_reorder (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
gint position)
{
g_return_if_fail (GTK_IS_CELL_LAYOUT (cell_layout));
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
(* GTK_CELL_LAYOUT_GET_IFACE (cell_layout)->reorder) (cell_layout,
cell,
position);
}

View File

@ -65,6 +65,9 @@ struct _GtkCellLayoutIface
GDestroyNotify destroy); GDestroyNotify destroy);
void (* clear_attributes) (GtkCellLayout *cell_layout, void (* clear_attributes) (GtkCellLayout *cell_layout,
GtkCellRenderer *cell); GtkCellRenderer *cell);
void (* reorder) (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
gint position);
}; };
GType gtk_cell_layout_get_type (void); GType gtk_cell_layout_get_type (void);
@ -89,6 +92,9 @@ void gtk_cell_layout_set_cell_data_func (GtkCellLayout *cell_layout,
GDestroyNotify destroy); GDestroyNotify destroy);
void gtk_cell_layout_clear_attributes (GtkCellLayout *cell_layout, void gtk_cell_layout_clear_attributes (GtkCellLayout *cell_layout,
GtkCellRenderer *cell); GtkCellRenderer *cell);
void gtk_cell_layout_reorder (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
gint position);
G_END_DECLS G_END_DECLS

View File

@ -100,6 +100,9 @@ static void gtk_cell_view_cell_layout_set_cell_data_func (GtkCellLayout
GtkCellLayoutDataFunc func, GtkCellLayoutDataFunc func,
gpointer func_data, gpointer func_data,
GDestroyNotify destroy); GDestroyNotify destroy);
static void gtk_cell_view_cell_layout_reorder (GtkCellLayout *layout,
GtkCellRenderer *cell,
gint position);
#define GTK_CELL_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_VIEW, GtkCellViewPrivate)) #define GTK_CELL_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_VIEW, GtkCellViewPrivate))
@ -203,6 +206,7 @@ gtk_cell_view_cell_layout_init (GtkCellLayoutIface *iface)
iface->add_attribute = gtk_cell_view_cell_layout_add_attribute; 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->set_cell_data_func = gtk_cell_view_cell_layout_set_cell_data_func;
iface->clear_attributes = gtk_cell_view_cell_layout_clear_attributes; iface->clear_attributes = gtk_cell_view_cell_layout_clear_attributes;
iface->reorder = gtk_cell_view_cell_layout_reorder;
} }
static void static void
@ -698,6 +702,34 @@ gtk_cell_view_cell_layout_clear_attributes (GtkCellLayout *layout,
info->attributes = NULL; info->attributes = NULL;
} }
static void
gtk_cell_view_cell_layout_reorder (GtkCellLayout *layout,
GtkCellRenderer *cell,
gint position)
{
GList *link;
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 (cell));
info = gtk_cell_view_get_cell_info (cellview, cell);
g_return_if_fail (info != NULL);
g_return_if_fail (position >= 0);
link = g_list_find (cellview->priv->cell_list, info);
g_return_if_fail (link != NULL);
cellview->priv->cell_list = g_list_remove_link (cellview->priv->cell_list,
link);
cellview->priv->cell_list = g_list_insert (cellview->priv->cell_list,
info, position);
gtk_widget_queue_draw (GTK_WIDGET (cellview));
}
/* public API */ /* public API */
GtkWidget * GtkWidget *

View File

@ -252,6 +252,9 @@ static void gtk_combo_box_cell_layout_set_cell_data_func (GtkCellLayout
GDestroyNotify destroy); GDestroyNotify destroy);
static void gtk_combo_box_cell_layout_clear_attributes (GtkCellLayout *layout, static void gtk_combo_box_cell_layout_clear_attributes (GtkCellLayout *layout,
GtkCellRenderer *cell); GtkCellRenderer *cell);
static void gtk_combo_box_cell_layout_reorder (GtkCellLayout *layout,
GtkCellRenderer *cell,
gint position);
GType GType
@ -399,6 +402,7 @@ gtk_combo_box_cell_layout_init (GtkCellLayoutIface *iface)
iface->add_attribute = gtk_combo_box_cell_layout_add_attribute; 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->set_cell_data_func = gtk_combo_box_cell_layout_set_cell_data_func;
iface->clear_attributes = gtk_combo_box_cell_layout_clear_attributes; iface->clear_attributes = gtk_combo_box_cell_layout_clear_attributes;
iface->reorder = gtk_combo_box_cell_layout_reorder;
} }
static void static void
@ -2294,6 +2298,63 @@ gtk_combo_box_cell_layout_clear_attributes (GtkCellLayout *layout,
gtk_widget_queue_resize (GTK_WIDGET (combo_box)); gtk_widget_queue_resize (GTK_WIDGET (combo_box));
} }
static void
gtk_combo_box_cell_layout_reorder (GtkCellLayout *layout,
GtkCellRenderer *cell,
gint position)
{
ComboCellInfo *info;
GtkComboBox *combo_box = GTK_COMBO_BOX (layout);
GtkWidget *menu;
GSList *link;
g_return_if_fail (GTK_IS_COMBO_BOX (layout));
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
info = gtk_combo_box_get_cell_info (combo_box, cell);
g_return_if_fail (info != NULL);
g_return_if_fail (position >= 0);
link = g_slist_find (combo_box->priv->cells, info);
g_return_if_fail (link != NULL);
combo_box->priv->cells = g_slist_remove_link (combo_box->priv->cells, link);
combo_box->priv->cells = g_slist_insert (combo_box->priv->cells, info,
position);
if (combo_box->priv->cell_view)
gtk_cell_layout_reorder (GTK_CELL_LAYOUT (combo_box->priv->cell_view),
cell, position);
if (combo_box->priv->column)
gtk_cell_layout_reorder (GTK_CELL_LAYOUT (combo_box->priv->column),
cell, position);
menu = combo_box->priv->popup_widget;
if (GTK_IS_MENU (menu))
{
GList *i, *list;
list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next)
{
GtkCellView *view;
if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
else
view = GTK_CELL_VIEW (i->data);
gtk_cell_layout_reorder (GTK_CELL_LAYOUT (view), cell, position);
}
g_list_free (list);
}
gtk_widget_queue_draw (GTK_WIDGET (combo_box));
}
/* /*
* public API * public API
*/ */

View File

@ -84,6 +84,9 @@ static void gtk_entry_completion_set_cell_data_func (GtkCellLayout
GDestroyNotify destroy); GDestroyNotify destroy);
static void gtk_entry_completion_clear_attributes (GtkCellLayout *cell_layout, static void gtk_entry_completion_clear_attributes (GtkCellLayout *cell_layout,
GtkCellRenderer *cell); GtkCellRenderer *cell);
static void gtk_entry_completion_reorder (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
gint position);
static gboolean gtk_entry_completion_visible_func (GtkTreeModel *model, static gboolean gtk_entry_completion_visible_func (GtkTreeModel *model,
GtkTreeIter *iter, GtkTreeIter *iter,
@ -216,6 +219,7 @@ gtk_entry_completion_cell_layout_init (GtkCellLayoutIface *iface)
iface->add_attribute = gtk_entry_completion_add_attribute; iface->add_attribute = gtk_entry_completion_add_attribute;
iface->set_cell_data_func = gtk_entry_completion_set_cell_data_func; iface->set_cell_data_func = gtk_entry_completion_set_cell_data_func;
iface->clear_attributes = gtk_entry_completion_clear_attributes; iface->clear_attributes = gtk_entry_completion_clear_attributes;
iface->reorder = gtk_entry_completion_reorder;
} }
static void static void
@ -467,6 +471,20 @@ gtk_entry_completion_clear_attributes (GtkCellLayout *cell_layout,
gtk_tree_view_column_clear_attributes (priv->column, cell); gtk_tree_view_column_clear_attributes (priv->column, cell);
} }
static void
gtk_entry_completion_reorder (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
gint position)
{
GtkEntryCompletionPrivate *priv;
g_return_if_fail (GTK_IS_ENTRY_COMPLETION (cell_layout));
priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (cell_layout);
gtk_cell_layout_reorder (GTK_CELL_LAYOUT (priv->column), cell, position);
}
/* all those callbacks */ /* all those callbacks */
static gboolean static gboolean
gtk_entry_completion_default_completion_func (GtkEntryCompletion *completion, gtk_entry_completion_default_completion_func (GtkEntryCompletion *completion,

View File

@ -107,6 +107,9 @@ static void gtk_tree_view_column_cell_layout_set_cell_data_func (GtkCellLayout
GDestroyNotify destroy); GDestroyNotify destroy);
static void gtk_tree_view_column_cell_layout_clear_attributes (GtkCellLayout *cell_layout, static void gtk_tree_view_column_cell_layout_clear_attributes (GtkCellLayout *cell_layout,
GtkCellRenderer *cell); GtkCellRenderer *cell);
static void gtk_tree_view_column_cell_layout_reorder (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
gint position);
/* Button handling code */ /* Button handling code */
static void gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column); static void gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column);
@ -356,6 +359,7 @@ gtk_tree_view_column_cell_layout_init (GtkCellLayoutIface *iface)
iface->add_attribute = gtk_tree_view_column_cell_layout_add_attribute; iface->add_attribute = gtk_tree_view_column_cell_layout_add_attribute;
iface->set_cell_data_func = gtk_tree_view_column_cell_layout_set_cell_data_func; iface->set_cell_data_func = gtk_tree_view_column_cell_layout_set_cell_data_func;
iface->clear_attributes = gtk_tree_view_column_cell_layout_clear_attributes; iface->clear_attributes = gtk_tree_view_column_cell_layout_clear_attributes;
iface->reorder = gtk_tree_view_column_cell_layout_reorder;
} }
static void static void
@ -739,6 +743,33 @@ gtk_tree_view_column_cell_layout_clear_attributes (GtkCellLayout *cell_layout
gtk_tree_view_column_clear_attributes_by_info (column, info); gtk_tree_view_column_clear_attributes_by_info (column, info);
} }
static void
gtk_tree_view_column_cell_layout_reorder (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
gint position)
{
GList *link;
GtkTreeViewColumn *column;
GtkTreeViewColumnCellInfo *info;
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (cell_layout));
column = GTK_TREE_VIEW_COLUMN (cell_layout);
info = gtk_tree_view_column_get_cell_info (column, cell);
g_return_if_fail (info != NULL);
g_return_if_fail (position >= 0);
link = g_list_find (column->cell_list, info);
g_return_if_fail (link != NULL);
column->cell_list = g_list_remove_link (column->cell_list, link);
column->cell_list = g_list_insert (column->cell_list, info, position);
gtk_widget_queue_draw (column->tree_view);
}
static void static void
gtk_tree_view_column_clear_attributes_by_info (GtkTreeViewColumn *tree_column, gtk_tree_view_column_clear_attributes_by_info (GtkTreeViewColumn *tree_column,
GtkTreeViewColumnCellInfo *info) GtkTreeViewColumnCellInfo *info)