mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
Fixes #108458.
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:
parent
30d9f88996
commit
2f4326e406
18
ChangeLog
18
ChangeLog
@ -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>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr
|
||||
|
@ -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>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr
|
||||
|
@ -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>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr
|
||||
|
@ -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>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr
|
||||
|
@ -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>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_search_equal_func): use strstr
|
||||
|
@ -250,3 +250,27 @@ gtk_cell_layout_clear_attributes (GtkCellLayout *cell_layout,
|
||||
(* GTK_CELL_LAYOUT_GET_IFACE (cell_layout)->clear_attributes) (cell_layout,
|
||||
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);
|
||||
}
|
||||
|
@ -65,6 +65,9 @@ struct _GtkCellLayoutIface
|
||||
GDestroyNotify destroy);
|
||||
void (* clear_attributes) (GtkCellLayout *cell_layout,
|
||||
GtkCellRenderer *cell);
|
||||
void (* reorder) (GtkCellLayout *cell_layout,
|
||||
GtkCellRenderer *cell,
|
||||
gint position);
|
||||
};
|
||||
|
||||
GType gtk_cell_layout_get_type (void);
|
||||
@ -89,6 +92,9 @@ void gtk_cell_layout_set_cell_data_func (GtkCellLayout *cell_layout,
|
||||
GDestroyNotify destroy);
|
||||
void gtk_cell_layout_clear_attributes (GtkCellLayout *cell_layout,
|
||||
GtkCellRenderer *cell);
|
||||
void gtk_cell_layout_reorder (GtkCellLayout *cell_layout,
|
||||
GtkCellRenderer *cell,
|
||||
gint position);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -100,6 +100,9 @@ static void gtk_cell_view_cell_layout_set_cell_data_func (GtkCellLayout
|
||||
GtkCellLayoutDataFunc func,
|
||||
gpointer func_data,
|
||||
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))
|
||||
@ -203,6 +206,7 @@ gtk_cell_view_cell_layout_init (GtkCellLayoutIface *iface)
|
||||
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;
|
||||
iface->reorder = gtk_cell_view_cell_layout_reorder;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -698,6 +702,34 @@ gtk_cell_view_cell_layout_clear_attributes (GtkCellLayout *layout,
|
||||
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 */
|
||||
GtkWidget *
|
||||
|
@ -252,6 +252,9 @@ static void gtk_combo_box_cell_layout_set_cell_data_func (GtkCellLayout
|
||||
GDestroyNotify destroy);
|
||||
static void gtk_combo_box_cell_layout_clear_attributes (GtkCellLayout *layout,
|
||||
GtkCellRenderer *cell);
|
||||
static void gtk_combo_box_cell_layout_reorder (GtkCellLayout *layout,
|
||||
GtkCellRenderer *cell,
|
||||
gint position);
|
||||
|
||||
|
||||
GType
|
||||
@ -399,6 +402,7 @@ gtk_combo_box_cell_layout_init (GtkCellLayoutIface *iface)
|
||||
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;
|
||||
iface->reorder = gtk_combo_box_cell_layout_reorder;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2294,6 +2298,63 @@ gtk_combo_box_cell_layout_clear_attributes (GtkCellLayout *layout,
|
||||
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
|
||||
*/
|
||||
|
@ -84,6 +84,9 @@ static void gtk_entry_completion_set_cell_data_func (GtkCellLayout
|
||||
GDestroyNotify destroy);
|
||||
static void gtk_entry_completion_clear_attributes (GtkCellLayout *cell_layout,
|
||||
GtkCellRenderer *cell);
|
||||
static void gtk_entry_completion_reorder (GtkCellLayout *cell_layout,
|
||||
GtkCellRenderer *cell,
|
||||
gint position);
|
||||
|
||||
static gboolean gtk_entry_completion_visible_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
@ -216,6 +219,7 @@ gtk_entry_completion_cell_layout_init (GtkCellLayoutIface *iface)
|
||||
iface->add_attribute = gtk_entry_completion_add_attribute;
|
||||
iface->set_cell_data_func = gtk_entry_completion_set_cell_data_func;
|
||||
iface->clear_attributes = gtk_entry_completion_clear_attributes;
|
||||
iface->reorder = gtk_entry_completion_reorder;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -467,6 +471,20 @@ gtk_entry_completion_clear_attributes (GtkCellLayout *cell_layout,
|
||||
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 */
|
||||
static gboolean
|
||||
gtk_entry_completion_default_completion_func (GtkEntryCompletion *completion,
|
||||
|
@ -107,6 +107,9 @@ static void gtk_tree_view_column_cell_layout_set_cell_data_func (GtkCellLayout
|
||||
GDestroyNotify destroy);
|
||||
static void gtk_tree_view_column_cell_layout_clear_attributes (GtkCellLayout *cell_layout,
|
||||
GtkCellRenderer *cell);
|
||||
static void gtk_tree_view_column_cell_layout_reorder (GtkCellLayout *cell_layout,
|
||||
GtkCellRenderer *cell,
|
||||
gint position);
|
||||
|
||||
/* Button handling code */
|
||||
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->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->reorder = gtk_tree_view_column_cell_layout_reorder;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
gtk_tree_view_column_clear_attributes_by_info (GtkTreeViewColumn *tree_column,
|
||||
GtkTreeViewColumnCellInfo *info)
|
||||
|
Loading…
Reference in New Issue
Block a user