+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
+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
+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
+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
+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
(* 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);
+}
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);
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
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))
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
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 *
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
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
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
*/
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,
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
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,
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);
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
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)