2000-10-05 01:04:57 +00:00
|
|
|
/* gtktreestore.c
|
2001-10-19 20:46:43 +00:00
|
|
|
* Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
|
2000-10-05 01:04:57 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2004-03-06 03:38:59 +00:00
|
|
|
#include <config.h>
|
2002-10-10 22:20:48 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <gobject/gvaluecollector.h>
|
2000-10-05 01:04:57 +00:00
|
|
|
#include "gtktreemodel.h"
|
|
|
|
#include "gtktreestore.h"
|
|
|
|
#include "gtktreedatalist.h"
|
2001-01-31 00:57:49 +00:00
|
|
|
#include "gtktreednd.h"
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
#include "gtkbuildable.h"
|
2005-09-01 05:11:46 +00:00
|
|
|
#include "gtkintl.h"
|
2005-03-20 07:01:23 +00:00
|
|
|
#include "gtkalias.h"
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
#define G_NODE(node) ((GNode *)node)
|
2005-12-29 07:14:19 +00:00
|
|
|
#define GTK_TREE_STORE_IS_SORTED(tree) (((GtkTreeStore*)(tree))->sort_column_id != GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID)
|
|
|
|
#define VALID_ITER(iter, tree_store) ((iter)!= NULL && (iter)->user_data != NULL && ((GtkTreeStore*)(tree_store))->stamp == (iter)->stamp)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
static void gtk_tree_store_tree_model_init (GtkTreeModelIface *iface);
|
2001-01-31 00:57:49 +00:00
|
|
|
static void gtk_tree_store_drag_source_init(GtkTreeDragSourceIface *iface);
|
|
|
|
static void gtk_tree_store_drag_dest_init (GtkTreeDragDestIface *iface);
|
2001-03-23 00:35:19 +00:00
|
|
|
static void gtk_tree_store_sortable_init (GtkTreeSortableIface *iface);
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
static void gtk_tree_store_buildable_init (GtkBuildableIface *iface);
|
2001-10-01 20:12:47 +00:00
|
|
|
static void gtk_tree_store_finalize (GObject *object);
|
2002-07-05 17:25:16 +00:00
|
|
|
static GtkTreeModelFlags gtk_tree_store_get_flags (GtkTreeModel *tree_model);
|
2000-10-26 00:36:47 +00:00
|
|
|
static gint gtk_tree_store_get_n_columns (GtkTreeModel *tree_model);
|
2000-11-10 19:38:53 +00:00
|
|
|
static GType gtk_tree_store_get_column_type (GtkTreeModel *tree_model,
|
|
|
|
gint index);
|
2001-06-20 23:21:46 +00:00
|
|
|
static gboolean gtk_tree_store_get_iter (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreePath *path);
|
2000-10-26 00:36:47 +00:00
|
|
|
static GtkTreePath *gtk_tree_store_get_path (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter);
|
2000-10-27 23:34:58 +00:00
|
|
|
static void gtk_tree_store_get_value (GtkTreeModel *tree_model,
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkTreeIter *iter,
|
|
|
|
gint column,
|
|
|
|
GValue *value);
|
|
|
|
static gboolean gtk_tree_store_iter_next (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter);
|
|
|
|
static gboolean gtk_tree_store_iter_children (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *parent);
|
|
|
|
static gboolean gtk_tree_store_iter_has_child (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter);
|
|
|
|
static gint gtk_tree_store_iter_n_children (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter);
|
|
|
|
static gboolean gtk_tree_store_iter_nth_child (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter,
|
2000-11-09 16:52:17 +00:00
|
|
|
GtkTreeIter *parent,
|
2000-10-26 00:36:47 +00:00
|
|
|
gint n);
|
|
|
|
static gboolean gtk_tree_store_iter_parent (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter,
|
2000-11-09 16:52:17 +00:00
|
|
|
GtkTreeIter *child);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
2001-06-30 02:38:17 +00:00
|
|
|
static void gtk_tree_store_set_n_columns (GtkTreeStore *tree_store,
|
|
|
|
gint n_columns);
|
|
|
|
static void gtk_tree_store_set_column_type (GtkTreeStore *tree_store,
|
|
|
|
gint column,
|
|
|
|
GType type);
|
|
|
|
|
2005-08-11 18:07:47 +00:00
|
|
|
static void gtk_tree_store_increment_stamp (GtkTreeStore *tree_store);
|
|
|
|
|
2001-06-30 02:38:17 +00:00
|
|
|
|
2001-03-23 00:35:19 +00:00
|
|
|
/* DND interfaces */
|
2003-01-14 22:57:37 +00:00
|
|
|
static gboolean real_gtk_tree_store_row_draggable (GtkTreeDragSource *drag_source,
|
|
|
|
GtkTreePath *path);
|
2001-01-31 00:57:49 +00:00
|
|
|
static gboolean gtk_tree_store_drag_data_delete (GtkTreeDragSource *drag_source,
|
2001-03-23 00:35:19 +00:00
|
|
|
GtkTreePath *path);
|
2001-01-31 00:57:49 +00:00
|
|
|
static gboolean gtk_tree_store_drag_data_get (GtkTreeDragSource *drag_source,
|
2001-03-23 00:35:19 +00:00
|
|
|
GtkTreePath *path,
|
|
|
|
GtkSelectionData *selection_data);
|
2001-01-31 00:57:49 +00:00
|
|
|
static gboolean gtk_tree_store_drag_data_received (GtkTreeDragDest *drag_dest,
|
2001-03-23 00:35:19 +00:00
|
|
|
GtkTreePath *dest,
|
|
|
|
GtkSelectionData *selection_data);
|
2001-01-31 00:57:49 +00:00
|
|
|
static gboolean gtk_tree_store_row_drop_possible (GtkTreeDragDest *drag_dest,
|
2001-11-06 19:10:03 +00:00
|
|
|
GtkTreePath *dest_path,
|
|
|
|
GtkSelectionData *selection_data);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
|
|
|
/* Sortable Interfaces */
|
|
|
|
|
2001-04-01 05:52:23 +00:00
|
|
|
static void gtk_tree_store_sort (GtkTreeStore *tree_store);
|
|
|
|
static void gtk_tree_store_sort_iter_changed (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
2006-01-15 20:12:49 +00:00
|
|
|
gint column,
|
|
|
|
gboolean emit_signal);
|
2001-04-01 05:52:23 +00:00
|
|
|
static gboolean gtk_tree_store_get_sort_column_id (GtkTreeSortable *sortable,
|
|
|
|
gint *sort_column_id,
|
2001-08-23 18:33:37 +00:00
|
|
|
GtkSortType *order);
|
2001-04-01 05:52:23 +00:00
|
|
|
static void gtk_tree_store_set_sort_column_id (GtkTreeSortable *sortable,
|
|
|
|
gint sort_column_id,
|
2001-08-23 18:33:37 +00:00
|
|
|
GtkSortType order);
|
2001-09-03 23:37:39 +00:00
|
|
|
static void gtk_tree_store_set_sort_func (GtkTreeSortable *sortable,
|
2001-04-01 05:52:23 +00:00
|
|
|
gint sort_column_id,
|
|
|
|
GtkTreeIterCompareFunc func,
|
|
|
|
gpointer data,
|
2008-06-18 09:12:32 +00:00
|
|
|
GDestroyNotify destroy);
|
2001-09-03 23:37:39 +00:00
|
|
|
static void gtk_tree_store_set_default_sort_func (GtkTreeSortable *sortable,
|
|
|
|
GtkTreeIterCompareFunc func,
|
|
|
|
gpointer data,
|
2008-06-18 09:12:32 +00:00
|
|
|
GDestroyNotify destroy);
|
2001-09-03 23:37:39 +00:00
|
|
|
static gboolean gtk_tree_store_has_default_sort_func (GtkTreeSortable *sortable);
|
2001-01-31 00:57:49 +00:00
|
|
|
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
|
|
|
/* buildable */
|
|
|
|
|
|
|
|
static gboolean gtk_tree_store_buildable_custom_tag_start (GtkBuildable *buildable,
|
|
|
|
GtkBuilder *builder,
|
|
|
|
GObject *child,
|
|
|
|
const gchar *tagname,
|
|
|
|
GMarkupParser *parser,
|
|
|
|
gpointer *data);
|
|
|
|
static void gtk_tree_store_buildable_custom_finished (GtkBuildable *buildable,
|
|
|
|
GtkBuilder *builder,
|
|
|
|
GObject *child,
|
|
|
|
const gchar *tagname,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2001-10-09 22:24:23 +00:00
|
|
|
static void validate_gnode (GNode *node);
|
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
static void gtk_tree_store_move (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *position,
|
|
|
|
gboolean before);
|
|
|
|
|
2001-10-09 22:24:23 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
static inline void
|
|
|
|
validate_tree (GtkTreeStore *tree_store)
|
|
|
|
{
|
|
|
|
if (gtk_debug_flags & GTK_DEBUG_TREE)
|
|
|
|
{
|
|
|
|
g_assert (G_NODE (tree_store->root)->parent == NULL);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
validate_gnode (G_NODE (tree_store->root));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GtkTreeStore, gtk_tree_store, G_TYPE_OBJECT,
|
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL,
|
|
|
|
gtk_tree_store_tree_model_init)
|
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE,
|
|
|
|
gtk_tree_store_drag_source_init)
|
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_DEST,
|
|
|
|
gtk_tree_store_drag_dest_init)
|
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_SORTABLE,
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
gtk_tree_store_sortable_init)
|
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
|
|
|
gtk_tree_store_buildable_init))
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
static void
|
2001-10-09 22:24:23 +00:00
|
|
|
gtk_tree_store_class_init (GtkTreeStoreClass *class)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2001-02-21 23:49:22 +00:00
|
|
|
GObjectClass *object_class;
|
|
|
|
|
2001-10-09 22:24:23 +00:00
|
|
|
object_class = (GObjectClass *) class;
|
2001-02-21 23:49:22 +00:00
|
|
|
|
2001-10-01 20:12:47 +00:00
|
|
|
object_class->finalize = gtk_tree_store_finalize;
|
2000-10-16 23:11:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tree_store_tree_model_init (GtkTreeModelIface *iface)
|
|
|
|
{
|
2000-11-09 16:52:17 +00:00
|
|
|
iface->get_flags = gtk_tree_store_get_flags;
|
2000-10-16 23:11:55 +00:00
|
|
|
iface->get_n_columns = gtk_tree_store_get_n_columns;
|
2000-11-10 19:38:53 +00:00
|
|
|
iface->get_column_type = gtk_tree_store_get_column_type;
|
2001-06-20 23:21:46 +00:00
|
|
|
iface->get_iter = gtk_tree_store_get_iter;
|
2000-10-16 23:11:55 +00:00
|
|
|
iface->get_path = gtk_tree_store_get_path;
|
2000-10-27 23:34:58 +00:00
|
|
|
iface->get_value = gtk_tree_store_get_value;
|
2000-10-26 00:36:47 +00:00
|
|
|
iface->iter_next = gtk_tree_store_iter_next;
|
|
|
|
iface->iter_children = gtk_tree_store_iter_children;
|
|
|
|
iface->iter_has_child = gtk_tree_store_iter_has_child;
|
|
|
|
iface->iter_n_children = gtk_tree_store_iter_n_children;
|
|
|
|
iface->iter_nth_child = gtk_tree_store_iter_nth_child;
|
|
|
|
iface->iter_parent = gtk_tree_store_iter_parent;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
static void
|
|
|
|
gtk_tree_store_drag_source_init (GtkTreeDragSourceIface *iface)
|
|
|
|
{
|
2003-01-14 22:57:37 +00:00
|
|
|
iface->row_draggable = real_gtk_tree_store_row_draggable;
|
2001-01-31 00:57:49 +00:00
|
|
|
iface->drag_data_delete = gtk_tree_store_drag_data_delete;
|
|
|
|
iface->drag_data_get = gtk_tree_store_drag_data_get;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-03-23 00:35:19 +00:00
|
|
|
gtk_tree_store_drag_dest_init (GtkTreeDragDestIface *iface)
|
2001-01-31 00:57:49 +00:00
|
|
|
{
|
|
|
|
iface->drag_data_received = gtk_tree_store_drag_data_received;
|
|
|
|
iface->row_drop_possible = gtk_tree_store_row_drop_possible;
|
|
|
|
}
|
|
|
|
|
2001-03-23 00:35:19 +00:00
|
|
|
static void
|
|
|
|
gtk_tree_store_sortable_init (GtkTreeSortableIface *iface)
|
|
|
|
{
|
2001-04-01 05:52:23 +00:00
|
|
|
iface->get_sort_column_id = gtk_tree_store_get_sort_column_id;
|
|
|
|
iface->set_sort_column_id = gtk_tree_store_set_sort_column_id;
|
2001-06-15 23:03:27 +00:00
|
|
|
iface->set_sort_func = gtk_tree_store_set_sort_func;
|
2001-09-03 23:37:39 +00:00
|
|
|
iface->set_default_sort_func = gtk_tree_store_set_default_sort_func;
|
|
|
|
iface->has_default_sort_func = gtk_tree_store_has_default_sort_func;
|
2001-03-23 00:35:19 +00:00
|
|
|
}
|
|
|
|
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
void
|
|
|
|
gtk_tree_store_buildable_init (GtkBuildableIface *iface)
|
|
|
|
{
|
|
|
|
iface->custom_tag_start = gtk_tree_store_buildable_custom_tag_start;
|
|
|
|
iface->custom_finished = gtk_tree_store_buildable_custom_finished;
|
|
|
|
}
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
static void
|
|
|
|
gtk_tree_store_init (GtkTreeStore *tree_store)
|
|
|
|
{
|
2000-10-26 00:36:47 +00:00
|
|
|
tree_store->root = g_node_new (NULL);
|
2001-11-14 02:06:28 +00:00
|
|
|
/* While the odds are against us getting 0...
|
|
|
|
*/
|
2001-09-08 18:23:47 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
tree_store->stamp = g_random_int ();
|
|
|
|
}
|
2001-09-10 15:37:03 +00:00
|
|
|
while (tree_store->stamp == 0);
|
2001-11-14 02:06:28 +00:00
|
|
|
|
2001-03-23 00:35:19 +00:00
|
|
|
tree_store->sort_list = NULL;
|
2001-09-04 22:15:18 +00:00
|
|
|
tree_store->sort_column_id = -2;
|
2001-11-14 02:06:28 +00:00
|
|
|
tree_store->columns_dirty = FALSE;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2001-06-30 21:15:27 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_new:
|
|
|
|
* @n_columns: number of columns in the tree store
|
|
|
|
* @Varargs: all #GType types for the columns, from first to last
|
|
|
|
*
|
|
|
|
* Creates a new tree store as with @n_columns columns each of the types passed
|
2003-06-04 23:53:35 +00:00
|
|
|
* in. Note that only types derived from standard GObject fundamental types
|
|
|
|
* are supported.
|
|
|
|
*
|
|
|
|
* As an example, <literal>gtk_tree_store_new (3, G_TYPE_INT, G_TYPE_STRING,
|
2001-11-12 22:29:13 +00:00
|
|
|
* GDK_TYPE_PIXBUF);</literal> will create a new #GtkTreeStore with three columns, of type
|
|
|
|
* <type>int</type>, <type>string</type> and #GdkPixbuf respectively.
|
2001-06-30 21:15:27 +00:00
|
|
|
*
|
|
|
|
* Return value: a new #GtkTreeStore
|
|
|
|
**/
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkTreeStore *
|
2001-06-30 02:38:17 +00:00
|
|
|
gtk_tree_store_new (gint n_columns,
|
2000-11-10 19:38:53 +00:00
|
|
|
...)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkTreeStore *retval;
|
2000-10-05 01:04:57 +00:00
|
|
|
va_list args;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_val_if_fail (n_columns > 0, NULL);
|
|
|
|
|
2002-10-10 22:20:48 +00:00
|
|
|
retval = g_object_new (GTK_TYPE_TREE_STORE, NULL);
|
2000-10-26 00:36:47 +00:00
|
|
|
gtk_tree_store_set_n_columns (retval, n_columns);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
va_start (args, n_columns);
|
2000-10-26 00:36:47 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
for (i = 0; i < n_columns; i++)
|
2001-03-10 01:34:48 +00:00
|
|
|
{
|
|
|
|
GType type = va_arg (args, GType);
|
|
|
|
if (! _gtk_tree_data_list_check_type (type))
|
|
|
|
{
|
2006-07-06 05:14:03 +00:00
|
|
|
g_warning ("%s: Invalid type %s\n", G_STRLOC, g_type_name (type));
|
2002-10-10 22:20:48 +00:00
|
|
|
g_object_unref (retval);
|
2001-03-10 01:34:48 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
gtk_tree_store_set_column_type (retval, i, type);
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
va_end (args);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
2001-06-30 21:15:27 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_newv:
|
|
|
|
* @n_columns: number of columns in the tree store
|
|
|
|
* @types: an array of #GType types for the columns, from first to last
|
|
|
|
*
|
|
|
|
* Non vararg creation function. Used primarily by language bindings.
|
|
|
|
*
|
|
|
|
* Return value: a new #GtkTreeStore
|
|
|
|
**/
|
|
|
|
GtkTreeStore *
|
|
|
|
gtk_tree_store_newv (gint n_columns,
|
|
|
|
GType *types)
|
|
|
|
{
|
|
|
|
GtkTreeStore *retval;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_val_if_fail (n_columns > 0, NULL);
|
|
|
|
|
2002-10-10 22:20:48 +00:00
|
|
|
retval = g_object_new (GTK_TYPE_TREE_STORE, NULL);
|
2001-06-30 21:15:27 +00:00
|
|
|
gtk_tree_store_set_n_columns (retval, n_columns);
|
|
|
|
|
|
|
|
for (i = 0; i < n_columns; i++)
|
|
|
|
{
|
|
|
|
if (! _gtk_tree_data_list_check_type (types[i]))
|
|
|
|
{
|
2006-07-06 05:14:03 +00:00
|
|
|
g_warning ("%s: Invalid type %s\n", G_STRLOC, g_type_name (types[i]));
|
2002-10-10 22:20:48 +00:00
|
|
|
g_object_unref (retval);
|
2001-06-30 21:15:27 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
gtk_tree_store_set_column_type (retval, i, types[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-11-14 02:06:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_tree_store_set_column_types:
|
|
|
|
* @tree_store: A #GtkTreeStore
|
|
|
|
* @n_columns: Number of columns for the tree store
|
2001-12-08 21:39:34 +00:00
|
|
|
* @types: An array of #GType types, one for each column
|
2001-11-14 02:06:28 +00:00
|
|
|
*
|
2001-12-08 21:39:34 +00:00
|
|
|
* This function is meant primarily for #GObjects that inherit from
|
|
|
|
* #GtkTreeStore, and should only be used when constructing a new
|
|
|
|
* #GtkTreeStore. It will not function after a row has been added,
|
|
|
|
* or a method on the #GtkTreeModel interface is called.
|
2001-11-14 02:06:28 +00:00
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_tree_store_set_column_types (GtkTreeStore *tree_store,
|
|
|
|
gint n_columns,
|
|
|
|
GType *types)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
|
|
|
g_return_if_fail (tree_store->columns_dirty == 0);
|
|
|
|
|
|
|
|
gtk_tree_store_set_n_columns (tree_store, n_columns);
|
|
|
|
for (i = 0; i < n_columns; i++)
|
|
|
|
{
|
|
|
|
if (! _gtk_tree_data_list_check_type (types[i]))
|
|
|
|
{
|
2006-07-06 05:14:03 +00:00
|
|
|
g_warning ("%s: Invalid type %s\n", G_STRLOC, g_type_name (types[i]));
|
2001-11-14 02:06:28 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
gtk_tree_store_set_column_type (tree_store, i, types[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-30 21:15:27 +00:00
|
|
|
static void
|
2000-10-05 01:04:57 +00:00
|
|
|
gtk_tree_store_set_n_columns (GtkTreeStore *tree_store,
|
|
|
|
gint n_columns)
|
|
|
|
{
|
|
|
|
GType *new_columns;
|
|
|
|
|
|
|
|
if (tree_store->n_columns == n_columns)
|
|
|
|
return;
|
|
|
|
|
|
|
|
new_columns = g_new0 (GType, n_columns);
|
|
|
|
if (tree_store->column_headers)
|
|
|
|
{
|
|
|
|
/* copy the old header orders over */
|
|
|
|
if (n_columns >= tree_store->n_columns)
|
|
|
|
memcpy (new_columns, tree_store->column_headers, tree_store->n_columns * sizeof (gchar *));
|
|
|
|
else
|
|
|
|
memcpy (new_columns, tree_store->column_headers, n_columns * sizeof (GType));
|
|
|
|
|
|
|
|
g_free (tree_store->column_headers);
|
|
|
|
}
|
|
|
|
|
2001-03-23 00:35:19 +00:00
|
|
|
if (tree_store->sort_list)
|
|
|
|
_gtk_tree_data_list_header_free (tree_store->sort_list);
|
|
|
|
|
|
|
|
tree_store->sort_list = _gtk_tree_data_list_header_new (n_columns, tree_store->column_headers);
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
tree_store->column_headers = new_columns;
|
|
|
|
tree_store->n_columns = n_columns;
|
|
|
|
}
|
|
|
|
|
2001-03-10 01:34:48 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_set_column_type:
|
|
|
|
* @tree_store: a #GtkTreeStore
|
|
|
|
* @column: column number
|
|
|
|
* @type: type of the data to be stored in @column
|
2001-03-23 00:35:19 +00:00
|
|
|
*
|
2001-03-10 01:34:48 +00:00
|
|
|
* Supported types include: %G_TYPE_UINT, %G_TYPE_INT, %G_TYPE_UCHAR,
|
|
|
|
* %G_TYPE_CHAR, %G_TYPE_BOOLEAN, %G_TYPE_POINTER, %G_TYPE_FLOAT,
|
|
|
|
* %G_TYPE_DOUBLE, %G_TYPE_STRING, %G_TYPE_OBJECT, and %G_TYPE_BOXED, along with
|
|
|
|
* subclasses of those types such as %GDK_TYPE_PIXBUF.
|
2001-03-23 00:35:19 +00:00
|
|
|
*
|
2001-03-10 01:34:48 +00:00
|
|
|
**/
|
2001-06-30 21:15:27 +00:00
|
|
|
static void
|
2000-10-05 01:04:57 +00:00
|
|
|
gtk_tree_store_set_column_type (GtkTreeStore *tree_store,
|
|
|
|
gint column,
|
|
|
|
GType type)
|
|
|
|
{
|
2001-03-10 01:34:48 +00:00
|
|
|
if (!_gtk_tree_data_list_check_type (type))
|
|
|
|
{
|
2006-07-06 05:14:03 +00:00
|
|
|
g_warning ("%s: Invalid type %s\n", G_STRLOC, g_type_name (type));
|
2001-03-10 01:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
tree_store->column_headers[column] = type;
|
|
|
|
}
|
|
|
|
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
static gboolean
|
2001-10-01 20:12:47 +00:00
|
|
|
node_free (GNode *node, gpointer data)
|
|
|
|
{
|
return a value in the range of [-1, 1] instead [0, 1],
Wed Nov 20 19:29:50 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkrbtree.c (gtk_rbtree_reorder_sort_func): return a value
in the range of [-1, 1] instead [0, 1],
(gtk_rbtree_reorder_invert_func): ditto,
This makes treeview reordering working on platforms as FreeBSD and
solaris, thanks go to Heiner Eichmann for finding this out and
sending in a patch (#98251).
Wed Nov 20 19:27:07 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreestore.c (node_free): only free the data list if
node->data is not NULL,
(gtk_tree_store_remove): free the data list from the node if
needed. (#94728, pointed out by Peter Bloomfield).
Wed Nov 20 19:23:13 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_remove_column): stop editing
and set the edited_column to NULL if edited_column is set.
(#91288, modified patch from Josh Parsons).
Wed Nov 20 19:20:34 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): do a full
redraw if vadjustment->value is bigger than tree_view->priv->height,
(gtk_tree_view_row_deleted): free the row ref if it isn't valid
anymore. (#83726, reported by Robert Kinsella).
2002-11-20 18:15:28 +00:00
|
|
|
if (node->data)
|
|
|
|
_gtk_tree_data_list_free (node->data, (GType*)data);
|
|
|
|
node->data = NULL;
|
|
|
|
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
return FALSE;
|
2001-10-01 20:12:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tree_store_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GtkTreeStore *tree_store = GTK_TREE_STORE (object);
|
|
|
|
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
g_node_traverse (tree_store->root, G_POST_ORDER, G_TRAVERSE_ALL, -1,
|
|
|
|
node_free, tree_store->column_headers);
|
2002-09-11 19:52:31 +00:00
|
|
|
g_node_destroy (tree_store->root);
|
2001-10-01 20:12:47 +00:00
|
|
|
_gtk_tree_data_list_header_free (tree_store->sort_list);
|
|
|
|
g_free (tree_store->column_headers);
|
|
|
|
|
|
|
|
if (tree_store->default_sort_destroy)
|
|
|
|
{
|
2008-06-18 09:12:32 +00:00
|
|
|
GDestroyNotify d = tree_store->default_sort_destroy;
|
2002-03-03 05:41:28 +00:00
|
|
|
|
2001-10-01 20:12:47 +00:00
|
|
|
tree_store->default_sort_destroy = NULL;
|
2002-03-03 05:41:28 +00:00
|
|
|
d (tree_store->default_sort_data);
|
2001-10-01 20:12:47 +00:00
|
|
|
tree_store->default_sort_data = NULL;
|
|
|
|
}
|
2001-10-09 22:24:23 +00:00
|
|
|
|
2002-09-11 19:52:31 +00:00
|
|
|
/* must chain up */
|
2006-05-02 23:56:43 +00:00
|
|
|
G_OBJECT_CLASS (gtk_tree_store_parent_class)->finalize (object);
|
2001-10-01 20:12:47 +00:00
|
|
|
}
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
/* fulfill the GtkTreeModel requirements */
|
|
|
|
/* NOTE: GtkTreeStore::root is a GNode, that acts as the parent node. However,
|
2001-01-31 00:57:49 +00:00
|
|
|
* it is not visible to the tree or to the user., and the path "0" refers to the
|
2000-10-05 01:04:57 +00:00
|
|
|
* first child of GtkTreeStore::root.
|
|
|
|
*/
|
2000-11-09 16:52:17 +00:00
|
|
|
|
|
|
|
|
2002-07-05 17:25:16 +00:00
|
|
|
static GtkTreeModelFlags
|
2000-11-09 16:52:17 +00:00
|
|
|
gtk_tree_store_get_flags (GtkTreeModel *tree_model)
|
|
|
|
{
|
|
|
|
return GTK_TREE_MODEL_ITERS_PERSIST;
|
|
|
|
}
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
static gint
|
|
|
|
gtk_tree_store_get_n_columns (GtkTreeModel *tree_model)
|
|
|
|
{
|
2001-11-14 02:06:28 +00:00
|
|
|
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
|
|
|
|
|
|
|
|
tree_store->columns_dirty = TRUE;
|
|
|
|
|
|
|
|
return tree_store->n_columns;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2000-11-10 19:38:53 +00:00
|
|
|
static GType
|
|
|
|
gtk_tree_store_get_column_type (GtkTreeModel *tree_model,
|
|
|
|
gint index)
|
|
|
|
{
|
2001-11-14 02:06:28 +00:00
|
|
|
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
|
|
|
|
|
2005-12-29 07:14:19 +00:00
|
|
|
g_return_val_if_fail (index < tree_store->n_columns, G_TYPE_INVALID);
|
2000-11-10 19:38:53 +00:00
|
|
|
|
2001-11-14 02:06:28 +00:00
|
|
|
tree_store->columns_dirty = TRUE;
|
|
|
|
|
|
|
|
return tree_store->column_headers[index];
|
2000-11-10 19:38:53 +00:00
|
|
|
}
|
|
|
|
|
2001-06-20 23:21:46 +00:00
|
|
|
static gboolean
|
|
|
|
gtk_tree_store_get_iter (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreePath *path)
|
|
|
|
{
|
|
|
|
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
|
|
|
|
GtkTreeIter parent;
|
|
|
|
gint *indices;
|
|
|
|
gint depth, i;
|
|
|
|
|
2001-11-14 02:06:28 +00:00
|
|
|
tree_store->columns_dirty = TRUE;
|
|
|
|
|
2001-06-20 23:21:46 +00:00
|
|
|
indices = gtk_tree_path_get_indices (path);
|
|
|
|
depth = gtk_tree_path_get_depth (path);
|
|
|
|
|
|
|
|
g_return_val_if_fail (depth > 0, FALSE);
|
|
|
|
|
|
|
|
parent.stamp = tree_store->stamp;
|
|
|
|
parent.user_data = tree_store->root;
|
|
|
|
|
2005-12-30 03:29:36 +00:00
|
|
|
if (!gtk_tree_store_iter_nth_child (tree_model, iter, &parent, indices[0]))
|
2001-06-20 23:21:46 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
for (i = 1; i < depth; i++)
|
|
|
|
{
|
|
|
|
parent = *iter;
|
2005-12-30 03:29:36 +00:00
|
|
|
if (!gtk_tree_store_iter_nth_child (tree_model, iter, &parent, indices[i]))
|
2001-06-20 23:21:46 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
static GtkTreePath *
|
|
|
|
gtk_tree_store_get_path (GtkTreeModel *tree_model,
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2005-12-29 07:14:19 +00:00
|
|
|
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
|
2000-10-05 01:04:57 +00:00
|
|
|
GtkTreePath *retval;
|
|
|
|
GNode *tmp_node;
|
|
|
|
gint i = 0;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
g_return_val_if_fail (iter->user_data != NULL, NULL);
|
2005-12-29 07:14:19 +00:00
|
|
|
g_return_val_if_fail (iter->stamp == tree_store->stamp, NULL);
|
2001-01-10 23:44:22 +00:00
|
|
|
|
2005-12-29 07:14:19 +00:00
|
|
|
validate_tree (tree_store);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-06-15 23:03:27 +00:00
|
|
|
if (G_NODE (iter->user_data)->parent == NULL &&
|
2005-12-29 07:14:19 +00:00
|
|
|
G_NODE (iter->user_data) == tree_store->root)
|
2001-06-15 23:03:27 +00:00
|
|
|
return gtk_tree_path_new ();
|
2001-01-10 23:44:22 +00:00
|
|
|
g_assert (G_NODE (iter->user_data)->parent != NULL);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2005-12-29 07:14:19 +00:00
|
|
|
if (G_NODE (iter->user_data)->parent == G_NODE (tree_store->root))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
retval = gtk_tree_path_new ();
|
2005-12-29 07:14:19 +00:00
|
|
|
tmp_node = G_NODE (tree_store->root)->children;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkTreeIter tmp_iter = *iter;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
tmp_iter.user_data = G_NODE (iter->user_data)->parent;
|
2000-10-26 00:36:47 +00:00
|
|
|
|
2005-12-30 03:29:36 +00:00
|
|
|
retval = gtk_tree_store_get_path (tree_model, &tmp_iter);
|
2001-01-04 23:36:19 +00:00
|
|
|
tmp_node = G_NODE (iter->user_data)->parent->children;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (retval == NULL)
|
|
|
|
return NULL;
|
2000-10-26 00:36:47 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
if (tmp_node == NULL)
|
|
|
|
{
|
|
|
|
gtk_tree_path_free (retval);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (; tmp_node; tmp_node = tmp_node->next)
|
|
|
|
{
|
2001-01-04 23:36:19 +00:00
|
|
|
if (tmp_node == G_NODE (iter->user_data))
|
2000-10-05 01:04:57 +00:00
|
|
|
break;
|
|
|
|
i++;
|
|
|
|
}
|
2000-10-26 00:36:47 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
if (tmp_node == NULL)
|
|
|
|
{
|
|
|
|
/* We couldn't find node, meaning it's prolly not ours */
|
2000-10-26 00:36:47 +00:00
|
|
|
/* Perhaps I should do a g_return_if_fail here. */
|
2000-10-05 01:04:57 +00:00
|
|
|
gtk_tree_path_free (retval);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_path_append_index (retval, i);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2000-10-27 23:34:58 +00:00
|
|
|
gtk_tree_store_get_value (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gint column,
|
|
|
|
GValue *value)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2005-12-29 07:14:19 +00:00
|
|
|
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
|
2000-10-05 01:04:57 +00:00
|
|
|
GtkTreeDataList *list;
|
|
|
|
gint tmp_column = column;
|
|
|
|
|
2005-12-29 07:14:19 +00:00
|
|
|
g_return_if_fail (column < tree_store->n_columns);
|
|
|
|
g_return_if_fail (VALID_ITER (iter, tree_store));
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-01-04 23:36:19 +00:00
|
|
|
list = G_NODE (iter->user_data)->data;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
while (tmp_column-- > 0 && list)
|
|
|
|
list = list->next;
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
if (list)
|
|
|
|
{
|
2000-10-27 23:34:58 +00:00
|
|
|
_gtk_tree_data_list_node_to_value (list,
|
2005-12-29 07:14:19 +00:00
|
|
|
tree_store->column_headers[column],
|
2000-10-27 23:34:58 +00:00
|
|
|
value);
|
2000-10-26 00:36:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We want to return an initialized but empty (default) value */
|
2005-12-29 07:14:19 +00:00
|
|
|
g_value_init (value, tree_store->column_headers[column]);
|
2000-10-26 00:36:47 +00:00
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2000-10-26 00:36:47 +00:00
|
|
|
gtk_tree_store_iter_next (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2001-01-31 00:57:49 +00:00
|
|
|
g_return_val_if_fail (iter->user_data != NULL, FALSE);
|
2002-01-22 00:21:40 +00:00
|
|
|
g_return_val_if_fail (iter->stamp == GTK_TREE_STORE (tree_model)->stamp, FALSE);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
if (G_NODE (iter->user_data)->next)
|
|
|
|
{
|
|
|
|
iter->user_data = G_NODE (iter->user_data)->next;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
2000-10-05 01:04:57 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
static gboolean
|
|
|
|
gtk_tree_store_iter_children (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *parent)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2005-12-29 07:14:19 +00:00
|
|
|
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
|
2001-01-31 00:57:49 +00:00
|
|
|
GNode *children;
|
|
|
|
|
2005-12-29 07:14:19 +00:00
|
|
|
if (parent)
|
|
|
|
g_return_val_if_fail (VALID_ITER (parent, tree_store), FALSE);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
if (parent)
|
2001-01-31 00:57:49 +00:00
|
|
|
children = G_NODE (parent->user_data)->children;
|
2000-11-09 16:52:17 +00:00
|
|
|
else
|
2005-12-29 07:14:19 +00:00
|
|
|
children = G_NODE (tree_store->root)->children;
|
2000-10-26 00:36:47 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
if (children)
|
|
|
|
{
|
2005-12-29 07:14:19 +00:00
|
|
|
iter->stamp = tree_store->stamp;
|
2001-01-31 00:57:49 +00:00
|
|
|
iter->user_data = children;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2000-10-26 00:36:47 +00:00
|
|
|
gtk_tree_store_iter_has_child (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2001-01-31 00:57:49 +00:00
|
|
|
g_return_val_if_fail (iter->user_data != NULL, FALSE);
|
2005-12-29 07:14:19 +00:00
|
|
|
g_return_val_if_fail (VALID_ITER (iter, tree_model), FALSE);
|
2000-10-26 00:36:47 +00:00
|
|
|
|
2001-01-04 23:36:19 +00:00
|
|
|
return G_NODE (iter->user_data)->children != NULL;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2000-10-26 00:36:47 +00:00
|
|
|
gtk_tree_store_iter_n_children (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2000-10-26 00:36:47 +00:00
|
|
|
GNode *node;
|
2000-10-05 01:04:57 +00:00
|
|
|
gint i = 0;
|
|
|
|
|
2004-01-30 19:49:40 +00:00
|
|
|
g_return_val_if_fail (iter == NULL || iter->user_data != NULL, 0);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
if (iter == NULL)
|
|
|
|
node = G_NODE (GTK_TREE_STORE (tree_model)->root)->children;
|
|
|
|
else
|
2001-01-04 23:36:19 +00:00
|
|
|
node = G_NODE (iter->user_data)->children;
|
2001-01-31 00:57:49 +00:00
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
while (node)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
i++;
|
2000-10-26 00:36:47 +00:00
|
|
|
node = node->next;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
static gboolean
|
|
|
|
gtk_tree_store_iter_nth_child (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *parent,
|
2000-10-05 01:04:57 +00:00
|
|
|
gint n)
|
|
|
|
{
|
2005-12-29 07:14:19 +00:00
|
|
|
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
|
2000-10-26 00:36:47 +00:00
|
|
|
GNode *parent_node;
|
2001-01-31 00:57:49 +00:00
|
|
|
GNode *child;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
g_return_val_if_fail (parent == NULL || parent->user_data != NULL, FALSE);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
if (parent == NULL)
|
2005-12-29 07:14:19 +00:00
|
|
|
parent_node = tree_store->root;
|
2000-10-26 00:36:47 +00:00
|
|
|
else
|
2001-01-04 23:36:19 +00:00
|
|
|
parent_node = parent->user_data;
|
2000-10-26 00:36:47 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
child = g_node_nth_child (parent_node, n);
|
2000-10-26 00:36:47 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
if (child)
|
|
|
|
{
|
|
|
|
iter->user_data = child;
|
2005-12-29 07:14:19 +00:00
|
|
|
iter->stamp = tree_store->stamp;
|
2001-01-31 00:57:49 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2000-10-26 00:36:47 +00:00
|
|
|
else
|
2001-01-31 00:57:49 +00:00
|
|
|
return FALSE;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
static gboolean
|
|
|
|
gtk_tree_store_iter_parent (GtkTreeModel *tree_model,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *child)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2005-12-29 07:14:19 +00:00
|
|
|
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
|
2001-01-31 00:57:49 +00:00
|
|
|
GNode *parent;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
2005-12-29 07:14:19 +00:00
|
|
|
g_return_val_if_fail (VALID_ITER (child, tree_store), FALSE);
|
2001-01-31 00:57:49 +00:00
|
|
|
|
|
|
|
parent = G_NODE (child->user_data)->parent;
|
|
|
|
|
2001-03-23 00:35:19 +00:00
|
|
|
g_assert (parent != NULL);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2005-12-29 07:14:19 +00:00
|
|
|
if (parent != tree_store->root)
|
2000-10-26 00:36:47 +00:00
|
|
|
{
|
2001-01-31 00:57:49 +00:00
|
|
|
iter->user_data = parent;
|
2005-12-29 07:14:19 +00:00
|
|
|
iter->stamp = tree_store->stamp;
|
2001-01-31 00:57:49 +00:00
|
|
|
return TRUE;
|
2000-10-26 00:36:47 +00:00
|
|
|
}
|
2001-01-31 00:57:49 +00:00
|
|
|
else
|
|
|
|
return FALSE;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2001-09-27 00:09:41 +00:00
|
|
|
|
|
|
|
/* Does not emit a signal */
|
2001-10-27 00:41:12 +00:00
|
|
|
static gboolean
|
2001-09-27 00:09:41 +00:00
|
|
|
gtk_tree_store_real_set_value (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gint column,
|
2002-01-30 23:51:04 +00:00
|
|
|
GValue *value,
|
|
|
|
gboolean sort)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GtkTreeDataList *list;
|
|
|
|
GtkTreeDataList *prev;
|
2002-07-01 21:15:35 +00:00
|
|
|
gint old_column = column;
|
2001-03-10 01:34:48 +00:00
|
|
|
GValue real_value = {0, };
|
|
|
|
gboolean converted = FALSE;
|
2001-09-27 00:09:41 +00:00
|
|
|
gboolean retval = FALSE;
|
2001-03-10 01:34:48 +00:00
|
|
|
|
2001-03-10 17:13:46 +00:00
|
|
|
if (! g_type_is_a (G_VALUE_TYPE (value), tree_store->column_headers[column]))
|
2001-03-10 01:34:48 +00:00
|
|
|
{
|
2001-03-10 17:13:46 +00:00
|
|
|
if (! (g_value_type_compatible (G_VALUE_TYPE (value), tree_store->column_headers[column]) &&
|
|
|
|
g_value_type_compatible (tree_store->column_headers[column], G_VALUE_TYPE (value))))
|
2001-03-10 01:34:48 +00:00
|
|
|
{
|
|
|
|
g_warning ("%s: Unable to convert from %s to %s\n",
|
|
|
|
G_STRLOC,
|
|
|
|
g_type_name (G_VALUE_TYPE (value)),
|
2001-03-10 17:13:46 +00:00
|
|
|
g_type_name (tree_store->column_headers[column]));
|
2001-09-27 00:09:41 +00:00
|
|
|
return retval;
|
2001-03-10 01:34:48 +00:00
|
|
|
}
|
|
|
|
if (!g_value_transform (value, &real_value))
|
|
|
|
{
|
|
|
|
g_warning ("%s: Unable to make conversion from %s to %s\n",
|
|
|
|
G_STRLOC,
|
|
|
|
g_type_name (G_VALUE_TYPE (value)),
|
2001-03-10 17:13:46 +00:00
|
|
|
g_type_name (tree_store->column_headers[column]));
|
2001-03-10 01:34:48 +00:00
|
|
|
g_value_unset (&real_value);
|
2001-09-27 00:09:41 +00:00
|
|
|
return retval;
|
2001-03-10 01:34:48 +00:00
|
|
|
}
|
|
|
|
converted = TRUE;
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-01-04 23:36:19 +00:00
|
|
|
prev = list = G_NODE (iter->user_data)->data;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
while (list != NULL)
|
|
|
|
{
|
|
|
|
if (column == 0)
|
|
|
|
{
|
2001-03-10 01:34:48 +00:00
|
|
|
if (converted)
|
|
|
|
_gtk_tree_data_list_value_to_node (list, &real_value);
|
|
|
|
else
|
|
|
|
_gtk_tree_data_list_value_to_node (list, value);
|
2001-09-27 00:09:41 +00:00
|
|
|
retval = TRUE;
|
2001-03-10 01:34:48 +00:00
|
|
|
if (converted)
|
|
|
|
g_value_unset (&real_value);
|
add a gtk_list_store_sort_iter_changed line for some special case ...
Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value):
add a gtk_list_store_sort_iter_changed line for some special
case ... (#96647 (issue 1), testcases from Soeren Sandmann and
Daniel Elstner).
Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org>
Inconsistent state for toggle renderers, requested by Paolo Bacchilega
in #88130.
* gtk/gtktreeprivate.h: move GtkCellRendererInfo here.
* gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away,
fix some indentation issues.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_render): add an inconsistent property.
* gtk/gtkstyle.c (gtk_default_draw_check),
(gtk_default_draw_option): support drawing inconsistent
options/checks for cells.
Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid
calling _editing_done twice (which has nasty side-effects). (#96647,
(issue 2) testcase from Soeren Sandmann).
Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org>
#82739, patch from Padraig O'Briain.
* gtk/gtktreeviewcolumn.[ch]: add
gtk_tree_view_column_cell_get_position()
Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org>
Yes, this chunk breaks ABI compatibility. Owen knows about it and
agreed with it. It doesn't break ABI that bad though, things will
still work. Please keep it silent :P.
This patch fixes some keynav issues reported by Narayana Pattipati
in #81633. (Also mentioned in #92037 (Sun tracking bug)).
* gtk/gtkmarshalers.list: add two silly marshalers
* gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all),
(gtk_tree_view_real_unselect_all),
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_expand_collapse_cursor_row),
(gtk_tree_view_real_start_interactive_search): change the return
type from void to gboolean, update prototypes, functions, signals and
entries in GtkTreeViewClass,
(gtk_tree_view_class_init): add select_cursor_row binding for
enter key,
(gtk_tree_view_key_press): only navigate the header button if the
header is also visible ...
Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org>
API bit of #75745, reported by Richard Hult.
* gtk/gtkcellrenderer.h (GtkCellRendererState): add
GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
|
|
|
if (sort && GTK_TREE_STORE_IS_SORTED (tree_store))
|
2006-01-15 20:12:49 +00:00
|
|
|
gtk_tree_store_sort_iter_changed (tree_store, iter, old_column, TRUE);
|
2001-09-27 00:09:41 +00:00
|
|
|
return retval;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
column--;
|
|
|
|
prev = list;
|
|
|
|
list = list->next;
|
|
|
|
}
|
|
|
|
|
2001-01-04 23:36:19 +00:00
|
|
|
if (G_NODE (iter->user_data)->data == NULL)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2001-01-04 23:36:19 +00:00
|
|
|
G_NODE (iter->user_data)->data = list = _gtk_tree_data_list_alloc ();
|
2000-10-05 01:04:57 +00:00
|
|
|
list->next = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-10-27 23:34:58 +00:00
|
|
|
list = prev->next = _gtk_tree_data_list_alloc ();
|
2000-10-05 01:04:57 +00:00
|
|
|
list->next = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (column != 0)
|
|
|
|
{
|
2000-10-27 23:34:58 +00:00
|
|
|
list->next = _gtk_tree_data_list_alloc ();
|
2000-10-05 01:04:57 +00:00
|
|
|
list = list->next;
|
|
|
|
list->next = NULL;
|
|
|
|
column --;
|
|
|
|
}
|
2002-07-01 21:15:35 +00:00
|
|
|
|
2001-03-10 01:34:48 +00:00
|
|
|
if (converted)
|
2001-03-10 17:13:46 +00:00
|
|
|
_gtk_tree_data_list_value_to_node (list, &real_value);
|
2001-03-10 01:34:48 +00:00
|
|
|
else
|
|
|
|
_gtk_tree_data_list_value_to_node (list, value);
|
2001-11-18 21:00:53 +00:00
|
|
|
|
|
|
|
retval = TRUE;
|
2001-03-10 01:34:48 +00:00
|
|
|
if (converted)
|
|
|
|
g_value_unset (&real_value);
|
2001-04-01 05:52:23 +00:00
|
|
|
|
2002-07-01 21:15:35 +00:00
|
|
|
if (sort && GTK_TREE_STORE_IS_SORTED (tree_store))
|
2006-01-15 20:12:49 +00:00
|
|
|
gtk_tree_store_sort_iter_changed (tree_store, iter, old_column, TRUE);
|
2002-07-01 21:15:35 +00:00
|
|
|
|
2001-09-27 00:09:41 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_tree_store_set_value:
|
|
|
|
* @tree_store: a #GtkTreeStore
|
|
|
|
* @iter: A valid #GtkTreeIter for the row being modified
|
|
|
|
* @column: column number to modify
|
|
|
|
* @value: new value for the cell
|
|
|
|
*
|
|
|
|
* Sets the data in the cell specified by @iter and @column.
|
|
|
|
* The type of @value must be convertible to the type of the
|
|
|
|
* column.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_tree_store_set_value (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gint column,
|
|
|
|
GValue *value)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
|
|
|
g_return_if_fail (VALID_ITER (iter, tree_store));
|
|
|
|
g_return_if_fail (column >= 0 && column < tree_store->n_columns);
|
|
|
|
g_return_if_fail (G_IS_VALUE (value));
|
|
|
|
|
2002-01-30 23:51:04 +00:00
|
|
|
if (gtk_tree_store_real_set_value (tree_store, iter, column, value, TRUE))
|
2001-09-27 00:09:41 +00:00
|
|
|
{
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
2005-12-30 03:29:36 +00:00
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
|
2001-09-27 00:09:41 +00:00
|
|
|
gtk_tree_model_row_changed (GTK_TREE_MODEL (tree_store), path, iter);
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2006-05-27 21:43:10 +00:00
|
|
|
static GtkTreeIterCompareFunc
|
|
|
|
gtk_tree_store_get_compare_func (GtkTreeStore *tree_store)
|
2000-10-26 00:36:47 +00:00
|
|
|
{
|
2002-01-31 01:17:21 +00:00
|
|
|
GtkTreeIterCompareFunc func = NULL;
|
2000-10-26 00:36:47 +00:00
|
|
|
|
2002-01-31 01:17:21 +00:00
|
|
|
if (GTK_TREE_STORE_IS_SORTED (tree_store))
|
2002-01-30 23:51:04 +00:00
|
|
|
{
|
2002-01-31 01:17:21 +00:00
|
|
|
if (tree_store->sort_column_id != -1)
|
|
|
|
{
|
|
|
|
GtkTreeDataSortHeader *header;
|
|
|
|
header = _gtk_tree_data_list_get_header (tree_store->sort_list,
|
|
|
|
tree_store->sort_column_id);
|
2006-05-27 21:43:10 +00:00
|
|
|
g_return_val_if_fail (header != NULL, NULL);
|
|
|
|
g_return_val_if_fail (header->func != NULL, NULL);
|
2002-01-31 01:17:21 +00:00
|
|
|
func = header->func;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
func = tree_store->default_sort_func;
|
|
|
|
}
|
2002-01-30 23:51:04 +00:00
|
|
|
}
|
|
|
|
|
2006-05-27 21:43:10 +00:00
|
|
|
return func;
|
|
|
|
}
|
|
|
|
|
2007-06-04 23:48:38 +00:00
|
|
|
static void
|
|
|
|
gtk_tree_store_set_vector_internal (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gboolean *emit_signal,
|
|
|
|
gboolean *maybe_need_sort,
|
|
|
|
gint *columns,
|
|
|
|
GValue *values,
|
|
|
|
gint n_values)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
GtkTreeIterCompareFunc func = NULL;
|
|
|
|
|
|
|
|
func = gtk_tree_store_get_compare_func (tree_store);
|
|
|
|
if (func != _gtk_tree_data_list_compare_func)
|
|
|
|
*maybe_need_sort = TRUE;
|
|
|
|
|
|
|
|
for (i = 0; i < n_values; i++)
|
|
|
|
{
|
|
|
|
*emit_signal = gtk_tree_store_real_set_value (tree_store, iter,
|
|
|
|
columns[i], &values[i],
|
|
|
|
FALSE) || *emit_signal;
|
|
|
|
|
|
|
|
if (func == _gtk_tree_data_list_compare_func &&
|
|
|
|
columns[i] == tree_store->sort_column_id)
|
|
|
|
*maybe_need_sort = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-27 21:43:10 +00:00
|
|
|
static void
|
|
|
|
gtk_tree_store_set_valist_internal (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gboolean *emit_signal,
|
|
|
|
gboolean *maybe_need_sort,
|
|
|
|
va_list var_args)
|
|
|
|
{
|
|
|
|
gint column;
|
|
|
|
GtkTreeIterCompareFunc func = NULL;
|
|
|
|
|
|
|
|
column = va_arg (var_args, gint);
|
|
|
|
|
|
|
|
func = gtk_tree_store_get_compare_func (tree_store);
|
2004-08-11 15:08:24 +00:00
|
|
|
if (func != _gtk_tree_data_list_compare_func)
|
2006-01-15 20:12:49 +00:00
|
|
|
*maybe_need_sort = TRUE;
|
2002-01-30 23:51:04 +00:00
|
|
|
|
2001-01-08 18:26:05 +00:00
|
|
|
while (column != -1)
|
2000-10-26 00:36:47 +00:00
|
|
|
{
|
|
|
|
GValue value = { 0, };
|
|
|
|
gchar *error = NULL;
|
|
|
|
|
2007-04-28 21:29:05 +00:00
|
|
|
if (column < 0 || column >= tree_store->n_columns)
|
2000-10-26 00:36:47 +00:00
|
|
|
{
|
2001-01-08 18:26:05 +00:00
|
|
|
g_warning ("%s: Invalid column number %d added to iter (remember to end your list of columns with a -1)", G_STRLOC, column);
|
2000-10-26 00:36:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
g_value_init (&value, tree_store->column_headers[column]);
|
|
|
|
|
2001-02-17 06:04:40 +00:00
|
|
|
G_VALUE_COLLECT (&value, var_args, 0, &error);
|
2000-10-26 00:36:47 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2006-01-15 20:12:49 +00:00
|
|
|
*emit_signal = gtk_tree_store_real_set_value (tree_store,
|
|
|
|
iter,
|
|
|
|
column,
|
|
|
|
&value,
|
|
|
|
FALSE) || *emit_signal;
|
2002-01-30 23:51:04 +00:00
|
|
|
|
2004-08-11 15:08:24 +00:00
|
|
|
if (func == _gtk_tree_data_list_compare_func &&
|
2002-01-30 23:51:04 +00:00
|
|
|
column == tree_store->sort_column_id)
|
2006-01-15 20:12:49 +00:00
|
|
|
*maybe_need_sort = TRUE;
|
2000-10-26 00:36:47 +00:00
|
|
|
|
|
|
|
g_value_unset (&value);
|
|
|
|
|
|
|
|
column = va_arg (var_args, gint);
|
|
|
|
}
|
2006-01-15 20:12:49 +00:00
|
|
|
}
|
|
|
|
|
2007-06-04 23:48:38 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_set_valuesv:
|
|
|
|
* @tree_store: A #GtkTreeStore
|
|
|
|
* @iter: A valid #GtkTreeIter for the row being modified
|
|
|
|
* @columns: an array of column numbers
|
|
|
|
* @values: an array of GValues
|
|
|
|
* @n_values: the length of the @columns and @values arrays
|
|
|
|
*
|
|
|
|
* A variant of gtk_tree_store_set_valist() which takes
|
|
|
|
* the columns and values as two arrays, instead of varargs. This
|
|
|
|
* function is mainly intended for language bindings or in case
|
|
|
|
* the number of columns to change is not known until run-time.
|
|
|
|
*
|
|
|
|
* Since: 2.12
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_tree_store_set_valuesv (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gint *columns,
|
|
|
|
GValue *values,
|
|
|
|
gint n_values)
|
|
|
|
{
|
|
|
|
gboolean emit_signal = FALSE;
|
|
|
|
gboolean maybe_need_sort = FALSE;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
|
|
|
g_return_if_fail (VALID_ITER (iter, tree_store));
|
|
|
|
|
|
|
|
gtk_tree_store_set_vector_internal (tree_store, iter,
|
|
|
|
&emit_signal,
|
|
|
|
&maybe_need_sort,
|
|
|
|
columns, values, n_values);
|
|
|
|
|
|
|
|
if (maybe_need_sort && GTK_TREE_STORE_IS_SORTED (tree_store))
|
|
|
|
gtk_tree_store_sort_iter_changed (tree_store, iter, tree_store->sort_column_id, TRUE);
|
|
|
|
|
|
|
|
if (emit_signal)
|
|
|
|
{
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
|
|
|
|
gtk_tree_model_row_changed (GTK_TREE_MODEL (tree_store), path, iter);
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-15 20:12:49 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_set_valist:
|
|
|
|
* @tree_store: A #GtkTreeStore
|
|
|
|
* @iter: A valid #GtkTreeIter for the row being modified
|
|
|
|
* @var_args: <type>va_list</type> of column/value pairs
|
|
|
|
*
|
|
|
|
* See gtk_tree_store_set(); this version takes a <type>va_list</type> for
|
|
|
|
* use by language bindings.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_tree_store_set_valist (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
va_list var_args)
|
|
|
|
{
|
|
|
|
gboolean emit_signal = FALSE;
|
|
|
|
gboolean maybe_need_sort = FALSE;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
|
|
|
g_return_if_fail (VALID_ITER (iter, tree_store));
|
|
|
|
|
|
|
|
gtk_tree_store_set_valist_internal (tree_store, iter,
|
|
|
|
&emit_signal,
|
|
|
|
&maybe_need_sort,
|
|
|
|
var_args);
|
2002-01-30 23:51:04 +00:00
|
|
|
|
|
|
|
if (maybe_need_sort && GTK_TREE_STORE_IS_SORTED (tree_store))
|
2006-01-15 20:12:49 +00:00
|
|
|
gtk_tree_store_sort_iter_changed (tree_store, iter, tree_store->sort_column_id, TRUE);
|
2002-01-30 23:51:04 +00:00
|
|
|
|
2001-09-27 00:09:41 +00:00
|
|
|
if (emit_signal)
|
|
|
|
{
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
2005-12-30 03:29:36 +00:00
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
|
2001-09-27 00:09:41 +00:00
|
|
|
gtk_tree_model_row_changed (GTK_TREE_MODEL (tree_store), path, iter);
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|
2000-10-26 00:36:47 +00:00
|
|
|
}
|
|
|
|
|
2001-01-08 18:26:05 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_set:
|
2001-09-08 18:23:47 +00:00
|
|
|
* @tree_store: A #GtkTreeStore
|
|
|
|
* @iter: A valid #GtkTreeIter for the row being modified
|
2001-01-08 18:26:05 +00:00
|
|
|
* @Varargs: pairs of column number and value, terminated with -1
|
2001-03-23 00:35:19 +00:00
|
|
|
*
|
2001-01-08 18:26:05 +00:00
|
|
|
* Sets the value of one or more cells in the row referenced by @iter.
|
|
|
|
* The variable argument list should contain integer column numbers,
|
2001-11-12 22:29:13 +00:00
|
|
|
* each column number followed by the value to be set.
|
2001-01-08 18:26:05 +00:00
|
|
|
* The list is terminated by a -1. For example, to set column 0 with type
|
2001-12-08 21:39:34 +00:00
|
|
|
* %G_TYPE_STRING to "Foo", you would write
|
|
|
|
* <literal>gtk_tree_store_set (store, iter, 0, "Foo", -1)</literal>.
|
2001-01-08 18:26:05 +00:00
|
|
|
**/
|
2000-10-26 00:36:47 +00:00
|
|
|
void
|
2000-10-27 23:34:58 +00:00
|
|
|
gtk_tree_store_set (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
...)
|
2000-10-26 00:36:47 +00:00
|
|
|
{
|
|
|
|
va_list var_args;
|
|
|
|
|
|
|
|
va_start (var_args, iter);
|
2001-01-08 18:26:05 +00:00
|
|
|
gtk_tree_store_set_valist (tree_store, iter, var_args);
|
2000-10-26 00:36:47 +00:00
|
|
|
va_end (var_args);
|
|
|
|
}
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_remove:
|
|
|
|
* @tree_store: A #GtkTreeStore
|
|
|
|
* @iter: A valid #GtkTreeIter
|
|
|
|
*
|
|
|
|
* Removes @iter from @tree_store. After being removed, @iter is set to the
|
2001-11-12 22:29:13 +00:00
|
|
|
* next valid row at that level, or invalidated if it previously pointed to the
|
2001-10-18 18:39:36 +00:00
|
|
|
* last one.
|
2002-06-04 17:17:49 +00:00
|
|
|
*
|
|
|
|
* Return value: %TRUE if @iter is still valid, %FALSE if not.
|
2001-09-08 18:23:47 +00:00
|
|
|
**/
|
2002-06-04 17:17:49 +00:00
|
|
|
gboolean
|
2001-09-08 18:23:47 +00:00
|
|
|
gtk_tree_store_remove (GtkTreeStore *tree_store,
|
2000-10-27 23:34:58 +00:00
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GtkTreePath *path;
|
2001-02-22 01:56:08 +00:00
|
|
|
GtkTreeIter new_iter = {0,};
|
2000-10-05 01:04:57 +00:00
|
|
|
GNode *parent;
|
2001-09-08 18:23:47 +00:00
|
|
|
GNode *next_node;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2002-06-04 17:17:49 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_TREE_STORE (tree_store), FALSE);
|
|
|
|
g_return_val_if_fail (VALID_ITER (iter, tree_store), FALSE);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-01-04 23:36:19 +00:00
|
|
|
parent = G_NODE (iter->user_data)->parent;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-01-10 23:44:22 +00:00
|
|
|
g_assert (parent != NULL);
|
2001-10-18 18:39:36 +00:00
|
|
|
next_node = G_NODE (iter->user_data)->next;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-04 23:36:19 +00:00
|
|
|
if (G_NODE (iter->user_data)->data)
|
return a value in the range of [-1, 1] instead [0, 1],
Wed Nov 20 19:29:50 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkrbtree.c (gtk_rbtree_reorder_sort_func): return a value
in the range of [-1, 1] instead [0, 1],
(gtk_rbtree_reorder_invert_func): ditto,
This makes treeview reordering working on platforms as FreeBSD and
solaris, thanks go to Heiner Eichmann for finding this out and
sending in a patch (#98251).
Wed Nov 20 19:27:07 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreestore.c (node_free): only free the data list if
node->data is not NULL,
(gtk_tree_store_remove): free the data list from the node if
needed. (#94728, pointed out by Peter Bloomfield).
Wed Nov 20 19:23:13 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_remove_column): stop editing
and set the edited_column to NULL if edited_column is set.
(#91288, modified patch from Josh Parsons).
Wed Nov 20 19:20:34 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): do a full
redraw if vadjustment->value is bigger than tree_view->priv->height,
(gtk_tree_view_row_deleted): free the row ref if it isn't valid
anymore. (#83726, reported by Robert Kinsella).
2002-11-20 18:15:28 +00:00
|
|
|
g_node_traverse (G_NODE (iter->user_data), G_POST_ORDER, G_TRAVERSE_ALL,
|
|
|
|
-1, node_free, tree_store->column_headers);
|
2000-10-27 23:34:58 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
|
2001-01-04 23:36:19 +00:00
|
|
|
g_node_destroy (G_NODE (iter->user_data));
|
2000-10-27 23:34:58 +00:00
|
|
|
|
2001-09-12 23:16:18 +00:00
|
|
|
gtk_tree_model_row_deleted (GTK_TREE_MODEL (tree_store), path);
|
2001-02-22 01:56:08 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
if (parent != G_NODE (tree_store->root))
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2001-07-09 17:09:35 +00:00
|
|
|
/* child_toggled */
|
|
|
|
if (parent->children == NULL)
|
|
|
|
{
|
|
|
|
gtk_tree_path_up (path);
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
new_iter.stamp = tree_store->stamp;
|
2001-07-09 17:09:35 +00:00
|
|
|
new_iter.user_data = parent;
|
2001-09-12 23:16:18 +00:00
|
|
|
gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (tree_store), path, &new_iter);
|
2001-07-09 17:09:35 +00:00
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
gtk_tree_path_free (path);
|
2001-09-08 18:23:47 +00:00
|
|
|
|
|
|
|
/* revalidate iter */
|
|
|
|
if (next_node != NULL)
|
|
|
|
{
|
|
|
|
iter->stamp = tree_store->stamp;
|
|
|
|
iter->user_data = next_node;
|
2002-06-04 17:17:49 +00:00
|
|
|
return TRUE;
|
2001-09-08 18:23:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
iter->stamp = 0;
|
2001-10-18 18:39:36 +00:00
|
|
|
iter->user_data = NULL;
|
2001-09-08 18:23:47 +00:00
|
|
|
}
|
2002-06-04 17:17:49 +00:00
|
|
|
|
|
|
|
return FALSE;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_insert:
|
2001-12-04 20:12:42 +00:00
|
|
|
* @tree_store: A #GtkTreeStore
|
2001-09-08 18:23:47 +00:00
|
|
|
* @iter: An unset #GtkTreeIter to set to the new row
|
|
|
|
* @parent: A valid #GtkTreeIter, or %NULL
|
|
|
|
* @position: position to insert the new row
|
|
|
|
*
|
2001-11-12 22:29:13 +00:00
|
|
|
* Creates a new row at @position. If parent is non-%NULL, then the row will be
|
2001-09-08 18:23:47 +00:00
|
|
|
* made a child of @parent. Otherwise, the row will be created at the toplevel.
|
|
|
|
* If @position is larger than the number of rows at that level, then the new
|
|
|
|
* row will be inserted to the end of the list. @iter will be changed to point
|
2002-02-22 00:26:54 +00:00
|
|
|
* to this new row. The row will be empty after this function is called. To
|
2001-12-04 20:12:42 +00:00
|
|
|
* fill in values, you need to call gtk_tree_store_set() or
|
|
|
|
* gtk_tree_store_set_value().
|
2001-09-08 18:23:47 +00:00
|
|
|
*
|
|
|
|
**/
|
2000-10-26 00:36:47 +00:00
|
|
|
void
|
2001-09-08 18:23:47 +00:00
|
|
|
gtk_tree_store_insert (GtkTreeStore *tree_store,
|
2000-10-27 23:34:58 +00:00
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *parent,
|
|
|
|
gint position)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GtkTreePath *path;
|
2001-01-31 00:57:49 +00:00
|
|
|
GNode *parent_node;
|
2005-07-09 20:31:36 +00:00
|
|
|
GNode *new_node;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
2005-07-09 20:31:36 +00:00
|
|
|
g_return_if_fail (iter != NULL);
|
2001-07-09 17:09:35 +00:00
|
|
|
if (parent)
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_if_fail (VALID_ITER (parent, tree_store));
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
if (parent)
|
|
|
|
parent_node = parent->user_data;
|
|
|
|
else
|
2001-09-08 18:23:47 +00:00
|
|
|
parent_node = tree_store->root;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-11-14 02:06:28 +00:00
|
|
|
tree_store->columns_dirty = TRUE;
|
|
|
|
|
2005-07-09 20:31:36 +00:00
|
|
|
new_node = g_node_new (NULL);
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
iter->stamp = tree_store->stamp;
|
2005-07-09 20:31:36 +00:00
|
|
|
iter->user_data = new_node;
|
|
|
|
g_node_insert (parent_node, position, new_node);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
|
2001-09-12 23:16:18 +00:00
|
|
|
gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter);
|
2001-02-22 01:56:08 +00:00
|
|
|
|
2005-07-09 20:31:36 +00:00
|
|
|
if (parent_node != tree_store->root)
|
|
|
|
{
|
|
|
|
if (new_node->prev == NULL && new_node->next == NULL)
|
|
|
|
{
|
|
|
|
gtk_tree_path_up (path);
|
|
|
|
gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (tree_store), path, parent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
gtk_tree_path_free (path);
|
2001-01-31 00:57:49 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
validate_tree ((GtkTreeStore*)tree_store);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_insert_before:
|
|
|
|
* @tree_store: A #GtkTreeStore
|
|
|
|
* @iter: An unset #GtkTreeIter to set to the new row
|
2001-09-24 16:54:41 +00:00
|
|
|
* @parent: A valid #GtkTreeIter, or %NULL
|
2001-09-08 18:23:47 +00:00
|
|
|
* @sibling: A valid #GtkTreeIter, or %NULL
|
|
|
|
*
|
|
|
|
* Inserts a new row before @sibling. If @sibling is %NULL, then the row will
|
2002-04-16 22:15:27 +00:00
|
|
|
* be appended to @parent 's children. If @parent and @sibling are %NULL, then
|
|
|
|
* the row will be appended to the toplevel. If both @sibling and @parent are
|
|
|
|
* set, then @parent must be the parent of @sibling. When @sibling is set,
|
|
|
|
* @parent is optional.
|
2001-09-08 18:23:47 +00:00
|
|
|
*
|
|
|
|
* @iter will be changed to point to this new row. The row will be empty after
|
|
|
|
* this function is called. To fill in values, you need to call
|
2001-11-12 22:29:13 +00:00
|
|
|
* gtk_tree_store_set() or gtk_tree_store_set_value().
|
2001-09-08 18:23:47 +00:00
|
|
|
*
|
|
|
|
**/
|
2000-10-26 00:36:47 +00:00
|
|
|
void
|
2001-09-08 18:23:47 +00:00
|
|
|
gtk_tree_store_insert_before (GtkTreeStore *tree_store,
|
2000-10-27 23:34:58 +00:00
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *parent,
|
|
|
|
GtkTreeIter *sibling)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GtkTreePath *path;
|
2001-01-31 00:57:49 +00:00
|
|
|
GNode *parent_node = NULL;
|
2001-01-10 23:44:22 +00:00
|
|
|
GNode *new_node;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
2000-10-26 00:36:47 +00:00
|
|
|
g_return_if_fail (iter != NULL);
|
2001-07-09 17:09:35 +00:00
|
|
|
if (parent != NULL)
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_if_fail (VALID_ITER (parent, tree_store));
|
2001-07-09 17:09:35 +00:00
|
|
|
if (sibling != NULL)
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_if_fail (VALID_ITER (sibling, tree_store));
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
if (parent == NULL && sibling == NULL)
|
2001-09-08 18:23:47 +00:00
|
|
|
parent_node = tree_store->root;
|
2000-10-26 00:36:47 +00:00
|
|
|
else if (parent == NULL)
|
2001-01-04 23:36:19 +00:00
|
|
|
parent_node = G_NODE (sibling->user_data)->parent;
|
2001-01-10 23:44:22 +00:00
|
|
|
else if (sibling == NULL)
|
2001-01-04 23:36:19 +00:00
|
|
|
parent_node = G_NODE (parent->user_data);
|
2001-01-10 23:44:22 +00:00
|
|
|
else
|
|
|
|
{
|
2001-07-09 17:09:35 +00:00
|
|
|
g_return_if_fail (G_NODE (sibling->user_data)->parent == G_NODE (parent->user_data));
|
2001-01-10 23:44:22 +00:00
|
|
|
parent_node = G_NODE (parent->user_data);
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2005-07-09 20:31:36 +00:00
|
|
|
tree_store->columns_dirty = TRUE;
|
|
|
|
|
|
|
|
new_node = g_node_new (NULL);
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
g_node_insert_before (parent_node,
|
2001-01-04 23:36:19 +00:00
|
|
|
sibling ? G_NODE (sibling->user_data) : NULL,
|
2001-01-10 23:44:22 +00:00
|
|
|
new_node);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
iter->stamp = tree_store->stamp;
|
2001-01-10 23:44:22 +00:00
|
|
|
iter->user_data = new_node;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
|
2001-09-12 23:16:18 +00:00
|
|
|
gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter);
|
2001-02-22 01:56:08 +00:00
|
|
|
|
2005-07-09 20:31:36 +00:00
|
|
|
if (parent_node != tree_store->root)
|
|
|
|
{
|
|
|
|
if (new_node->prev == NULL && new_node->next == NULL)
|
|
|
|
{
|
|
|
|
GtkTreeIter parent_iter;
|
|
|
|
|
|
|
|
parent_iter.stamp = tree_store->stamp;
|
|
|
|
parent_iter.user_data = parent_node;
|
|
|
|
|
|
|
|
gtk_tree_path_up (path);
|
|
|
|
gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (tree_store), path, &parent_iter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
gtk_tree_path_free (path);
|
2001-01-31 00:57:49 +00:00
|
|
|
|
2005-12-29 07:14:19 +00:00
|
|
|
validate_tree (tree_store);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_insert_after:
|
|
|
|
* @tree_store: A #GtkTreeStore
|
|
|
|
* @iter: An unset #GtkTreeIter to set to the new row
|
2001-09-24 16:54:41 +00:00
|
|
|
* @parent: A valid #GtkTreeIter, or %NULL
|
2001-09-08 18:23:47 +00:00
|
|
|
* @sibling: A valid #GtkTreeIter, or %NULL
|
|
|
|
*
|
|
|
|
* Inserts a new row after @sibling. If @sibling is %NULL, then the row will be
|
Minor documentation fixes
2002-08-10 Soren Sandmann <sandmann@daimi.au.dk>
* docs/reference/gtk/tree_widget.sgml,
docs/reference/gtk/tmpl/gtkdialog.sgml,
docs/reference/gtk/tmpl/gtkentry.sgml,
docs/reference/gtk/tmpl/gtkfilesel.sgml,
docs/reference/gtk/tmpl/gtkfontsel.sgml,
docs/reference/gtk/tmpl/gtkfontseldlg.sgml,
docs/reference/gtk/tmpl/gtktreemodel.sgml,
docs/reference/gtk/tmpl/gtkwidget.sgml, gdk/x11/gdkdisplay-x11.c,
gtk/gtkbbox.c, gtk/gtkbox.c, gtk/gtkbutton.c, gtk/gtkcellrenderer.c,
gtk/gtkcellrendererpixbuf.c, gtk/gtkcellrenderertext.c,
gtk/gtkcheckmenuitem.c, gtk/gtkcontainer.c, gtk/gtkcurve.c,
gtk/gtkdialog.h, gtk/gtkentry.c, gtk/gtkfilesel.c, gtk/gtkfontsel.c,
gtk/gtkframe.c, gtk/gtkhandlebox.c, gtk/gtkiconfactory.c,
gtk/gtkimage.c, gtk/gtkinvisible.c, gtk/gtkitemfactory.c,
gtk/gtklabel.c, gtk/gtklayout.c, gtk/gtkmenu.c, gtk/gtkprogress.c,
gtk/gtkprogressbar.c, gtk/gtkscrolledwindow.c, gtk/gtksizegroup.c,
gtk/gtktable.c, gtk/gtktextiter.c, gtk/gtktexttag.c,
gtk/gtktexttag.h, gtk/gtktextview.c, gtk/gtktogglebutton.c,
gtk/gtktoolbar.c, gtk/gtktreemodel.c, gtk/gtktreeselection.c,
gtk/gtktreestore.c, gtk/gtktreeview.c, gtk/gtktreeviewcolumn.c,
gtk/gtkviewport.c, gtk/gtkwidget.c, gtk/gtkwidget.h,
gtk/gtkwindow.c:
Minor documentation fixes
(#89254, patch from Brett Nash;
#85809, patch from daten@dnetc.org;
#76391, patch from Ross Burton;
#74559, Manuel Clos;
#73569, #72005, Alexey A. Malyshev;
#70061, patch from Dennis Bj"orklund;
#64566, #63388, #58328, #57499, #81007, #77349, Vitaly Tishkov;
#78932, Vitaly Tishkov, patch from Ross Burton;
#73306)
2002-08-10 09:55:41 +00:00
|
|
|
* prepended to @parent 's children. If @parent and @sibling are %NULL, then
|
|
|
|
* the row will be prepended to the toplevel. If both @sibling and @parent are
|
|
|
|
* set, then @parent must be the parent of @sibling. When @sibling is set,
|
|
|
|
* @parent is optional.
|
2001-09-08 18:23:47 +00:00
|
|
|
*
|
|
|
|
* @iter will be changed to point to this new row. The row will be empty after
|
|
|
|
* this function is called. To fill in values, you need to call
|
2001-11-12 22:29:13 +00:00
|
|
|
* gtk_tree_store_set() or gtk_tree_store_set_value().
|
2001-09-08 18:23:47 +00:00
|
|
|
*
|
|
|
|
**/
|
2000-10-26 00:36:47 +00:00
|
|
|
void
|
2001-09-08 18:23:47 +00:00
|
|
|
gtk_tree_store_insert_after (GtkTreeStore *tree_store,
|
2000-10-27 23:34:58 +00:00
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *parent,
|
|
|
|
GtkTreeIter *sibling)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GtkTreePath *path;
|
2000-10-26 00:36:47 +00:00
|
|
|
GNode *parent_node;
|
2001-01-10 23:44:22 +00:00
|
|
|
GNode *new_node;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
2000-10-26 00:36:47 +00:00
|
|
|
g_return_if_fail (iter != NULL);
|
2001-07-09 17:09:35 +00:00
|
|
|
if (parent != NULL)
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_if_fail (VALID_ITER (parent, tree_store));
|
2001-07-09 17:09:35 +00:00
|
|
|
if (sibling != NULL)
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_if_fail (VALID_ITER (sibling, tree_store));
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
if (parent == NULL && sibling == NULL)
|
2001-09-08 18:23:47 +00:00
|
|
|
parent_node = tree_store->root;
|
2000-10-26 00:36:47 +00:00
|
|
|
else if (parent == NULL)
|
2001-01-04 23:36:19 +00:00
|
|
|
parent_node = G_NODE (sibling->user_data)->parent;
|
2001-01-10 23:44:22 +00:00
|
|
|
else if (sibling == NULL)
|
2001-01-04 23:36:19 +00:00
|
|
|
parent_node = G_NODE (parent->user_data);
|
2001-01-10 23:44:22 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
g_return_if_fail (G_NODE (sibling->user_data)->parent ==
|
|
|
|
G_NODE (parent->user_data));
|
|
|
|
parent_node = G_NODE (parent->user_data);
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2005-07-09 20:31:36 +00:00
|
|
|
tree_store->columns_dirty = TRUE;
|
|
|
|
|
|
|
|
new_node = g_node_new (NULL);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
g_node_insert_after (parent_node,
|
2001-01-04 23:36:19 +00:00
|
|
|
sibling ? G_NODE (sibling->user_data) : NULL,
|
2001-01-10 23:44:22 +00:00
|
|
|
new_node);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
iter->stamp = tree_store->stamp;
|
2001-01-10 23:44:22 +00:00
|
|
|
iter->user_data = new_node;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
|
2001-09-12 23:16:18 +00:00
|
|
|
gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter);
|
2001-02-22 01:56:08 +00:00
|
|
|
|
2005-07-09 20:31:36 +00:00
|
|
|
if (parent_node != tree_store->root)
|
|
|
|
{
|
|
|
|
if (new_node->prev == NULL && new_node->next == NULL)
|
|
|
|
{
|
|
|
|
GtkTreeIter parent_iter;
|
|
|
|
|
|
|
|
parent_iter.stamp = tree_store->stamp;
|
|
|
|
parent_iter.user_data = parent_node;
|
|
|
|
|
|
|
|
gtk_tree_path_up (path);
|
|
|
|
gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (tree_store), path, &parent_iter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
gtk_tree_path_free (path);
|
2001-01-31 00:57:49 +00:00
|
|
|
|
2005-12-29 07:14:19 +00:00
|
|
|
validate_tree (tree_store);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2006-01-15 20:12:49 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_insert_with_values:
|
|
|
|
* @tree_store: A #GtkTreeStore
|
2006-06-26 15:49:43 +00:00
|
|
|
* @iter: An unset #GtkTreeIter to set the new row, or %NULL.
|
2006-01-15 20:12:49 +00:00
|
|
|
* @parent: A valid #GtkTreeIter, or %NULL
|
|
|
|
* @position: position to insert the new row
|
|
|
|
* @Varargs: pairs of column number and value, terminated with -1
|
|
|
|
*
|
|
|
|
* Creates a new row at @position. @iter will be changed to point to this
|
|
|
|
* new row. If @position is larger than the number of rows on the list, then
|
|
|
|
* the new row will be appended to the list. The row will be filled with
|
|
|
|
* the values given to this function.
|
|
|
|
*
|
|
|
|
* Calling
|
|
|
|
* <literal>gtk_tree_store_insert_with_values (tree_store, iter, position, ...)</literal>
|
|
|
|
* has the same effect as calling
|
2007-11-25 06:51:19 +00:00
|
|
|
* |[
|
2006-01-15 20:12:49 +00:00
|
|
|
* gtk_tree_store_insert (tree_store, iter, position);
|
|
|
|
* gtk_tree_store_set (tree_store, iter, ...);
|
2007-11-25 06:51:19 +00:00
|
|
|
* ]|
|
2006-01-15 20:12:49 +00:00
|
|
|
* with the different that the former will only emit a row_inserted signal,
|
|
|
|
* while the latter will emit row_inserted, row_changed and if the tree store
|
|
|
|
* is sorted, rows_reordered. Since emitting the rows_reordered signal
|
|
|
|
* repeatedly can affect the performance of the program,
|
|
|
|
* gtk_tree_store_insert_with_values() should generally be preferred when
|
|
|
|
* inserting rows in a sorted tree store.
|
|
|
|
*
|
|
|
|
* Since: 2.10
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_tree_store_insert_with_values (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *parent,
|
|
|
|
gint position,
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
GtkTreePath *path;
|
|
|
|
GNode *parent_node;
|
|
|
|
GNode *new_node;
|
2006-06-26 15:49:43 +00:00
|
|
|
GtkTreeIter tmp_iter;
|
2006-01-15 20:12:49 +00:00
|
|
|
va_list var_args;
|
|
|
|
gboolean changed = FALSE;
|
|
|
|
gboolean maybe_need_sort = FALSE;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
2006-06-26 15:49:43 +00:00
|
|
|
|
|
|
|
if (!iter)
|
|
|
|
iter = &tmp_iter;
|
|
|
|
|
2006-01-15 20:12:49 +00:00
|
|
|
if (parent)
|
|
|
|
g_return_if_fail (VALID_ITER (parent, tree_store));
|
|
|
|
|
|
|
|
if (parent)
|
|
|
|
parent_node = parent->user_data;
|
|
|
|
else
|
|
|
|
parent_node = tree_store->root;
|
|
|
|
|
|
|
|
tree_store->columns_dirty = TRUE;
|
|
|
|
|
|
|
|
new_node = g_node_new (NULL);
|
|
|
|
|
|
|
|
iter->stamp = tree_store->stamp;
|
|
|
|
iter->user_data = new_node;
|
|
|
|
g_node_insert (parent_node, position, new_node);
|
|
|
|
|
|
|
|
va_start (var_args, position);
|
|
|
|
gtk_tree_store_set_valist_internal (tree_store, iter,
|
|
|
|
&changed, &maybe_need_sort,
|
|
|
|
var_args);
|
|
|
|
va_end (var_args);
|
|
|
|
|
|
|
|
if (maybe_need_sort && GTK_TREE_STORE_IS_SORTED (tree_store))
|
|
|
|
gtk_tree_store_sort_iter_changed (tree_store, iter, tree_store->sort_column_id, FALSE);
|
|
|
|
|
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
|
|
|
|
gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter);
|
|
|
|
|
|
|
|
if (parent_node != tree_store->root)
|
|
|
|
{
|
|
|
|
if (new_node->prev == NULL && new_node->next == NULL)
|
|
|
|
{
|
|
|
|
gtk_tree_path_up (path);
|
|
|
|
gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (tree_store), path, parent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
|
|
|
validate_tree ((GtkTreeStore *)tree_store);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_tree_store_insert_with_valuesv:
|
|
|
|
* @tree_store: A #GtkTreeStore
|
2006-06-26 15:49:43 +00:00
|
|
|
* @iter: An unset #GtkTreeIter to set the new row, or %NULL.
|
2006-01-15 20:12:49 +00:00
|
|
|
* @parent: A valid #GtkTreeIter, or %NULL
|
|
|
|
* @position: position to insert the new row
|
|
|
|
* @columns: an array of column numbers
|
|
|
|
* @values: an array of GValues
|
|
|
|
* @n_values: the length of the @columns and @values arrays
|
|
|
|
*
|
|
|
|
* A variant of gtk_tree_store_insert_with_values() which takes
|
|
|
|
* the columns and values as two arrays, instead of varargs. This
|
|
|
|
* function is mainly intended for language bindings.
|
|
|
|
*
|
|
|
|
* Since: 2.10
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_tree_store_insert_with_valuesv (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *parent,
|
|
|
|
gint position,
|
|
|
|
gint *columns,
|
|
|
|
GValue *values,
|
|
|
|
gint n_values)
|
|
|
|
{
|
|
|
|
GtkTreePath *path;
|
|
|
|
GNode *parent_node;
|
|
|
|
GNode *new_node;
|
2006-06-26 15:49:43 +00:00
|
|
|
GtkTreeIter tmp_iter;
|
2006-01-15 20:12:49 +00:00
|
|
|
gboolean changed = FALSE;
|
|
|
|
gboolean maybe_need_sort = FALSE;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
2006-06-26 15:49:43 +00:00
|
|
|
|
|
|
|
if (!iter)
|
|
|
|
iter = &tmp_iter;
|
|
|
|
|
2006-01-15 20:12:49 +00:00
|
|
|
if (parent)
|
|
|
|
g_return_if_fail (VALID_ITER (parent, tree_store));
|
|
|
|
|
|
|
|
if (parent)
|
|
|
|
parent_node = parent->user_data;
|
|
|
|
else
|
|
|
|
parent_node = tree_store->root;
|
|
|
|
|
|
|
|
tree_store->columns_dirty = TRUE;
|
|
|
|
|
|
|
|
new_node = g_node_new (NULL);
|
|
|
|
|
|
|
|
iter->stamp = tree_store->stamp;
|
|
|
|
iter->user_data = new_node;
|
|
|
|
g_node_insert (parent_node, position, new_node);
|
|
|
|
|
2007-06-04 23:48:38 +00:00
|
|
|
gtk_tree_store_set_vector_internal (tree_store, iter,
|
|
|
|
&changed, &maybe_need_sort,
|
|
|
|
columns, values, n_values);
|
2006-01-15 20:12:49 +00:00
|
|
|
|
|
|
|
if (maybe_need_sort && GTK_TREE_STORE_IS_SORTED (tree_store))
|
|
|
|
gtk_tree_store_sort_iter_changed (tree_store, iter, tree_store->sort_column_id, FALSE);
|
|
|
|
|
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
|
|
|
|
gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter);
|
|
|
|
|
|
|
|
if (parent_node != tree_store->root)
|
|
|
|
{
|
|
|
|
if (new_node->prev == NULL && new_node->next == NULL)
|
|
|
|
{
|
|
|
|
gtk_tree_path_up (path);
|
|
|
|
gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (tree_store), path, parent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
|
|
|
validate_tree ((GtkTreeStore *)tree_store);
|
|
|
|
}
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_prepend:
|
|
|
|
* @tree_store: A #GtkTreeStore
|
|
|
|
* @iter: An unset #GtkTreeIter to set to the prepended row
|
|
|
|
* @parent: A valid #GtkTreeIter, or %NULL
|
|
|
|
*
|
2001-11-12 22:29:13 +00:00
|
|
|
* Prepends a new row to @tree_store. If @parent is non-%NULL, then it will prepend
|
2001-10-24 22:54:59 +00:00
|
|
|
* the new row before the first child of @parent, otherwise it will prepend a row
|
2001-09-08 18:23:47 +00:00
|
|
|
* to the top level. @iter will be changed to point to this new row. The row
|
|
|
|
* will be empty after this function is called. To fill in values, you need to
|
2001-11-12 22:29:13 +00:00
|
|
|
* call gtk_tree_store_set() or gtk_tree_store_set_value().
|
2001-09-08 18:23:47 +00:00
|
|
|
**/
|
2000-10-26 00:36:47 +00:00
|
|
|
void
|
2001-09-08 18:23:47 +00:00
|
|
|
gtk_tree_store_prepend (GtkTreeStore *tree_store,
|
2000-10-27 23:34:58 +00:00
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *parent)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2000-10-26 00:36:47 +00:00
|
|
|
GNode *parent_node;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
2000-10-26 00:36:47 +00:00
|
|
|
g_return_if_fail (iter != NULL);
|
2001-07-09 17:09:35 +00:00
|
|
|
if (parent != NULL)
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_if_fail (VALID_ITER (parent, tree_store));
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-11-14 02:06:28 +00:00
|
|
|
tree_store->columns_dirty = TRUE;
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
if (parent == NULL)
|
2001-09-08 18:23:47 +00:00
|
|
|
parent_node = tree_store->root;
|
2000-10-26 00:36:47 +00:00
|
|
|
else
|
2001-01-04 23:36:19 +00:00
|
|
|
parent_node = parent->user_data;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
if (parent_node->children == NULL)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GtkTreePath *path;
|
2001-10-01 18:12:34 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
iter->stamp = tree_store->stamp;
|
2001-01-10 23:44:22 +00:00
|
|
|
iter->user_data = g_node_new (NULL);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2002-01-22 00:21:40 +00:00
|
|
|
g_node_prepend (parent_node, G_NODE (iter->user_data));
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-10-01 18:12:34 +00:00
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
|
|
|
|
gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter);
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
if (parent_node != tree_store->root)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2001-10-01 18:12:34 +00:00
|
|
|
gtk_tree_path_up (path);
|
2001-09-12 23:16:18 +00:00
|
|
|
gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (tree_store), path, parent);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-09-08 18:23:47 +00:00
|
|
|
gtk_tree_store_insert_after (tree_store, iter, parent, NULL);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
2001-01-31 00:57:49 +00:00
|
|
|
|
2005-12-29 07:14:19 +00:00
|
|
|
validate_tree (tree_store);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_append:
|
|
|
|
* @tree_store: A #GtkTreeStore
|
|
|
|
* @iter: An unset #GtkTreeIter to set to the appended row
|
|
|
|
* @parent: A valid #GtkTreeIter, or %NULL
|
|
|
|
*
|
2001-11-12 22:29:13 +00:00
|
|
|
* Appends a new row to @tree_store. If @parent is non-%NULL, then it will append the
|
2001-09-08 18:23:47 +00:00
|
|
|
* new row after the last child of @parent, otherwise it will append a row to
|
|
|
|
* the top level. @iter will be changed to point to this new row. The row will
|
|
|
|
* be empty after this function is called. To fill in values, you need to call
|
2001-11-12 22:29:13 +00:00
|
|
|
* gtk_tree_store_set() or gtk_tree_store_set_value().
|
2001-09-08 18:23:47 +00:00
|
|
|
**/
|
2000-10-26 00:36:47 +00:00
|
|
|
void
|
2001-09-08 18:23:47 +00:00
|
|
|
gtk_tree_store_append (GtkTreeStore *tree_store,
|
2000-10-27 23:34:58 +00:00
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *parent)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2000-10-26 00:36:47 +00:00
|
|
|
GNode *parent_node;
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
2000-10-26 00:36:47 +00:00
|
|
|
g_return_if_fail (iter != NULL);
|
2001-07-09 17:09:35 +00:00
|
|
|
if (parent != NULL)
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_if_fail (VALID_ITER (parent, tree_store));
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
if (parent == NULL)
|
2001-09-08 18:23:47 +00:00
|
|
|
parent_node = tree_store->root;
|
2000-10-26 00:36:47 +00:00
|
|
|
else
|
2001-01-04 23:36:19 +00:00
|
|
|
parent_node = parent->user_data;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-11-14 02:06:28 +00:00
|
|
|
tree_store->columns_dirty = TRUE;
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
if (parent_node->children == NULL)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GtkTreePath *path;
|
2000-10-26 00:36:47 +00:00
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
iter->stamp = tree_store->stamp;
|
2001-01-31 00:57:49 +00:00
|
|
|
iter->user_data = g_node_new (NULL);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-04 23:36:19 +00:00
|
|
|
g_node_append (parent_node, G_NODE (iter->user_data));
|
2000-10-26 00:36:47 +00:00
|
|
|
|
2001-10-01 18:12:34 +00:00
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
|
|
|
|
gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter);
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
if (parent_node != tree_store->root)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2001-10-01 18:12:34 +00:00
|
|
|
gtk_tree_path_up (path);
|
2001-09-12 23:16:18 +00:00
|
|
|
gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (tree_store), path, parent);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-09-08 18:23:47 +00:00
|
|
|
gtk_tree_store_insert_before (tree_store, iter, parent, NULL);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
2001-01-31 00:57:49 +00:00
|
|
|
|
2005-12-29 07:14:19 +00:00
|
|
|
validate_tree (tree_store);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_is_ancestor:
|
|
|
|
* @tree_store: A #GtkTreeStore
|
|
|
|
* @iter: A valid #GtkTreeIter
|
|
|
|
* @descendant: A valid #GtkTreeIter
|
|
|
|
*
|
|
|
|
* Returns %TRUE if @iter is an ancestor of @descendant. That is, @iter is the
|
|
|
|
* parent (or grandparent or great-grandparent) of @descendant.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE, if @iter is an ancestor of @descendant
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
gboolean
|
2001-09-08 18:23:47 +00:00
|
|
|
gtk_tree_store_is_ancestor (GtkTreeStore *tree_store,
|
2000-10-27 23:34:58 +00:00
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *descendant)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_TREE_STORE (tree_store), FALSE);
|
|
|
|
g_return_val_if_fail (VALID_ITER (iter, tree_store), FALSE);
|
|
|
|
g_return_val_if_fail (VALID_ITER (descendant, tree_store), FALSE);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-01-04 23:36:19 +00:00
|
|
|
return g_node_is_ancestor (G_NODE (iter->user_data),
|
|
|
|
G_NODE (descendant->user_data));
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_iter_depth:
|
|
|
|
* @tree_store: A #GtkTreeStore
|
|
|
|
* @iter: A valid #GtkTreeIter
|
|
|
|
*
|
2001-10-22 19:19:27 +00:00
|
|
|
* Returns the depth of @iter. This will be 0 for anything on the root level, 1
|
2001-09-08 18:23:47 +00:00
|
|
|
* for anything down a level, etc.
|
|
|
|
*
|
|
|
|
* Return value: The depth of @iter
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
gint
|
2001-09-08 18:23:47 +00:00
|
|
|
gtk_tree_store_iter_depth (GtkTreeStore *tree_store,
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2001-09-08 18:23:47 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_TREE_STORE (tree_store), 0);
|
|
|
|
g_return_val_if_fail (VALID_ITER (iter, tree_store), 0);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2001-10-22 19:19:27 +00:00
|
|
|
return g_node_depth (G_NODE (iter->user_data)) - 2;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
2001-01-31 00:57:49 +00:00
|
|
|
|
2002-02-15 18:38:02 +00:00
|
|
|
/* simple ripoff from g_node_traverse_post_order */
|
|
|
|
static gboolean
|
2005-12-29 07:14:19 +00:00
|
|
|
gtk_tree_store_clear_traverse (GNode *node,
|
2002-02-15 18:38:02 +00:00
|
|
|
GtkTreeStore *store)
|
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
if (node->children)
|
|
|
|
{
|
|
|
|
GNode *child;
|
|
|
|
|
|
|
|
child = node->children;
|
|
|
|
while (child)
|
|
|
|
{
|
|
|
|
register GNode *current;
|
|
|
|
|
|
|
|
current = child;
|
|
|
|
child = current->next;
|
|
|
|
if (gtk_tree_store_clear_traverse (current, store))
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (node->parent)
|
|
|
|
{
|
|
|
|
iter.stamp = store->stamp;
|
|
|
|
iter.user_data = node;
|
|
|
|
|
|
|
|
gtk_tree_store_remove (store, &iter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (node->parent)
|
|
|
|
{
|
|
|
|
iter.stamp = store->stamp;
|
|
|
|
iter.user_data = node;
|
|
|
|
|
|
|
|
gtk_tree_store_remove (store, &iter);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-08-11 18:07:47 +00:00
|
|
|
static void
|
|
|
|
gtk_tree_store_increment_stamp (GtkTreeStore *tree_store)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
tree_store->stamp++;
|
|
|
|
}
|
|
|
|
while (tree_store->stamp == 0);
|
|
|
|
}
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_store_clear:
|
2001-12-08 21:39:34 +00:00
|
|
|
* @tree_store: a #GtkTreeStore
|
2001-09-08 18:23:47 +00:00
|
|
|
*
|
|
|
|
* Removes all rows from @tree_store
|
|
|
|
**/
|
2001-06-19 23:15:22 +00:00
|
|
|
void
|
|
|
|
gtk_tree_store_clear (GtkTreeStore *tree_store)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
|
|
|
|
2002-02-15 18:38:02 +00:00
|
|
|
gtk_tree_store_clear_traverse (tree_store->root, tree_store);
|
2005-08-11 18:07:47 +00:00
|
|
|
gtk_tree_store_increment_stamp (tree_store);
|
2001-06-19 23:15:22 +00:00
|
|
|
}
|
|
|
|
|
2002-06-04 17:17:49 +00:00
|
|
|
static gboolean
|
|
|
|
gtk_tree_store_iter_is_valid_helper (GtkTreeIter *iter,
|
|
|
|
GNode *first)
|
|
|
|
{
|
|
|
|
GNode *node;
|
|
|
|
|
|
|
|
node = first;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (node == iter->user_data)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (node->children)
|
|
|
|
if (gtk_tree_store_iter_is_valid_helper (iter, node->children))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
node = node->next;
|
|
|
|
}
|
|
|
|
while (node);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_tree_store_iter_is_valid:
|
|
|
|
* @tree_store: A #GtkTreeStore.
|
|
|
|
* @iter: A #GtkTreeIter.
|
|
|
|
*
|
|
|
|
* WARNING: This function is slow. Only use it for debugging and/or testing
|
|
|
|
* purposes.
|
|
|
|
*
|
|
|
|
* Checks if the given iter is a valid iter for this #GtkTreeStore.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the iter is valid, %FALSE if the iter is invalid.
|
2002-11-28 00:33:17 +00:00
|
|
|
*
|
|
|
|
* Since: 2.2
|
2002-06-04 17:17:49 +00:00
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gtk_tree_store_iter_is_valid (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_STORE (tree_store), FALSE);
|
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
|
|
|
|
|
|
|
if (!VALID_ITER (iter, tree_store))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return gtk_tree_store_iter_is_valid_helper (iter, tree_store->root);
|
|
|
|
}
|
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
/* DND */
|
|
|
|
|
|
|
|
|
2003-01-14 22:57:37 +00:00
|
|
|
static gboolean real_gtk_tree_store_row_draggable (GtkTreeDragSource *drag_source,
|
|
|
|
GtkTreePath *path)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
static gboolean
|
|
|
|
gtk_tree_store_drag_data_delete (GtkTreeDragSource *drag_source,
|
|
|
|
GtkTreePath *path)
|
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
2005-12-30 03:29:36 +00:00
|
|
|
if (gtk_tree_store_get_iter (GTK_TREE_MODEL (drag_source),
|
2001-01-31 00:57:49 +00:00
|
|
|
&iter,
|
|
|
|
path))
|
|
|
|
{
|
|
|
|
gtk_tree_store_remove (GTK_TREE_STORE (drag_source),
|
|
|
|
&iter);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_tree_store_drag_data_get (GtkTreeDragSource *drag_source,
|
|
|
|
GtkTreePath *path,
|
|
|
|
GtkSelectionData *selection_data)
|
|
|
|
{
|
|
|
|
/* Note that we don't need to handle the GTK_TREE_MODEL_ROW
|
|
|
|
* target, because the default handler does it for us, but
|
|
|
|
* we do anyway for the convenience of someone maybe overriding the
|
|
|
|
* default handler.
|
|
|
|
*/
|
|
|
|
|
2001-10-31 21:55:55 +00:00
|
|
|
if (gtk_tree_set_row_drag_data (selection_data,
|
|
|
|
GTK_TREE_MODEL (drag_source),
|
|
|
|
path))
|
2001-01-31 00:57:49 +00:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* FIXME handle text targets at least. */
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
copy_node_data (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *src_iter,
|
|
|
|
GtkTreeIter *dest_iter)
|
|
|
|
{
|
|
|
|
GtkTreeDataList *dl = G_NODE (src_iter->user_data)->data;
|
|
|
|
GtkTreeDataList *copy_head = NULL;
|
|
|
|
GtkTreeDataList *copy_prev = NULL;
|
|
|
|
GtkTreeDataList *copy_iter = NULL;
|
2001-02-22 01:56:08 +00:00
|
|
|
GtkTreePath *path;
|
2001-01-31 00:57:49 +00:00
|
|
|
gint col;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
col = 0;
|
|
|
|
while (dl)
|
|
|
|
{
|
2001-03-10 01:34:48 +00:00
|
|
|
copy_iter = _gtk_tree_data_list_node_copy (dl, tree_store->column_headers[col]);
|
2001-01-31 00:57:49 +00:00
|
|
|
|
|
|
|
if (copy_head == NULL)
|
|
|
|
copy_head = copy_iter;
|
|
|
|
|
|
|
|
if (copy_prev)
|
|
|
|
copy_prev->next = copy_iter;
|
|
|
|
|
|
|
|
copy_prev = copy_iter;
|
|
|
|
|
|
|
|
dl = dl->next;
|
|
|
|
++col;
|
|
|
|
}
|
2001-03-10 01:34:48 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
G_NODE (dest_iter->user_data)->data = copy_head;
|
|
|
|
|
2001-03-10 01:34:48 +00:00
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), dest_iter);
|
2001-09-12 23:16:18 +00:00
|
|
|
gtk_tree_model_row_changed (GTK_TREE_MODEL (tree_store), path, dest_iter);
|
2001-02-22 01:56:08 +00:00
|
|
|
gtk_tree_path_free (path);
|
2001-01-31 00:57:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
recursive_node_copy (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *src_iter,
|
|
|
|
GtkTreeIter *dest_iter)
|
|
|
|
{
|
|
|
|
GtkTreeIter child;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
|
|
|
|
model = GTK_TREE_MODEL (tree_store);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
copy_node_data (tree_store, src_iter, dest_iter);
|
|
|
|
|
2005-12-30 03:29:36 +00:00
|
|
|
if (gtk_tree_store_iter_children (model,
|
2001-01-31 00:57:49 +00:00
|
|
|
&child,
|
|
|
|
src_iter))
|
|
|
|
{
|
|
|
|
/* Need to create children and recurse. Note our
|
|
|
|
* dependence on persistent iterators here.
|
|
|
|
*/
|
|
|
|
do
|
|
|
|
{
|
|
|
|
GtkTreeIter copy;
|
|
|
|
|
|
|
|
/* Gee, a really slow algorithm... ;-) FIXME */
|
|
|
|
gtk_tree_store_append (tree_store,
|
|
|
|
©,
|
|
|
|
dest_iter);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
recursive_node_copy (tree_store, &child, ©);
|
|
|
|
}
|
2005-12-30 03:29:36 +00:00
|
|
|
while (gtk_tree_store_iter_next (model, &child));
|
2001-01-31 00:57:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_tree_store_drag_data_received (GtkTreeDragDest *drag_dest,
|
|
|
|
GtkTreePath *dest,
|
|
|
|
GtkSelectionData *selection_data)
|
|
|
|
{
|
|
|
|
GtkTreeModel *tree_model;
|
|
|
|
GtkTreeStore *tree_store;
|
|
|
|
GtkTreeModel *src_model = NULL;
|
|
|
|
GtkTreePath *src_path = NULL;
|
|
|
|
gboolean retval = FALSE;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
tree_model = GTK_TREE_MODEL (drag_dest);
|
|
|
|
tree_store = GTK_TREE_STORE (drag_dest);
|
|
|
|
|
|
|
|
validate_tree (tree_store);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-10-31 21:55:55 +00:00
|
|
|
if (gtk_tree_get_row_drag_data (selection_data,
|
|
|
|
&src_model,
|
|
|
|
&src_path) &&
|
2001-01-31 00:57:49 +00:00
|
|
|
src_model == tree_model)
|
|
|
|
{
|
|
|
|
/* Copy the given row to a new position */
|
|
|
|
GtkTreeIter src_iter;
|
|
|
|
GtkTreeIter dest_iter;
|
|
|
|
GtkTreePath *prev;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2005-12-30 03:29:36 +00:00
|
|
|
if (!gtk_tree_store_get_iter (src_model,
|
2001-01-31 00:57:49 +00:00
|
|
|
&src_iter,
|
|
|
|
src_path))
|
|
|
|
{
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the path to insert _after_ (dest is the path to insert _before_) */
|
|
|
|
prev = gtk_tree_path_copy (dest);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
if (!gtk_tree_path_prev (prev))
|
|
|
|
{
|
|
|
|
GtkTreeIter dest_parent;
|
|
|
|
GtkTreePath *parent;
|
|
|
|
GtkTreeIter *dest_parent_p;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
/* dest was the first spot at the current depth; which means
|
|
|
|
* we are supposed to prepend.
|
|
|
|
*/
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
/* Get the parent, NULL if parent is the root */
|
|
|
|
dest_parent_p = NULL;
|
|
|
|
parent = gtk_tree_path_copy (dest);
|
2002-03-07 08:03:09 +00:00
|
|
|
if (gtk_tree_path_up (parent) &&
|
|
|
|
gtk_tree_path_get_depth (parent) > 0)
|
2001-01-31 00:57:49 +00:00
|
|
|
{
|
2005-12-30 03:29:36 +00:00
|
|
|
gtk_tree_store_get_iter (tree_model,
|
2001-01-31 00:57:49 +00:00
|
|
|
&dest_parent,
|
|
|
|
parent);
|
|
|
|
dest_parent_p = &dest_parent;
|
|
|
|
}
|
|
|
|
gtk_tree_path_free (parent);
|
|
|
|
parent = NULL;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore
Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org>
Big TreeView DnD fixage, makes drops on empty models work, makes
TreeStore DnD work and gets rid of gtk-tree-model-drop-append.
Related bugs #95362 and #113314. I don't want to touch this code
ever again.
* gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field.
* gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check
for selection_data->length.
* gtk/gtktreeview.c (struct DestRow), (dest_row_free),
(set_dest_row), (get_dest_row): we don't store just the row ref
anymore, but a struct with the row ref and additional info,
(set_destination_row): handle drops on empty space and some
style fixes,
(get_logical_dest_row): also return path_down_mode/drop_append_mode
flags, handle dropping childs on their new parents, rewrite
drop append handling into something saner,
(gtk_tree_view_drag_motion): show a "drop possible arrow" on empty
spaces,
(gtk_tree_view_drag_drop): updates for updated backend,
(gtk_tree_view_drag_data_received): updates for updated backend,
path down mode (treestore DnD) handling,
(gtk_tree_view_set_drag_dest_row): set empty_view_drop flag,
when we are trying to drop a row on an empty model,
(gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag.
* gtk/gtkliststore.c (gtk_list_store_drag_data_received),
(gtk_list_store_row_drop_possible): style and drop-append fixes.
* gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
|
|
|
gtk_tree_store_prepend (tree_store,
|
2001-01-31 00:57:49 +00:00
|
|
|
&dest_iter,
|
|
|
|
dest_parent_p);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
retval = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-12-30 03:29:36 +00:00
|
|
|
if (gtk_tree_store_get_iter (tree_model, &dest_iter, prev))
|
2001-01-31 00:57:49 +00:00
|
|
|
{
|
|
|
|
GtkTreeIter tmp_iter = dest_iter;
|
2002-03-08 19:40:15 +00:00
|
|
|
|
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore
Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org>
Big TreeView DnD fixage, makes drops on empty models work, makes
TreeStore DnD work and gets rid of gtk-tree-model-drop-append.
Related bugs #95362 and #113314. I don't want to touch this code
ever again.
* gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field.
* gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check
for selection_data->length.
* gtk/gtktreeview.c (struct DestRow), (dest_row_free),
(set_dest_row), (get_dest_row): we don't store just the row ref
anymore, but a struct with the row ref and additional info,
(set_destination_row): handle drops on empty space and some
style fixes,
(get_logical_dest_row): also return path_down_mode/drop_append_mode
flags, handle dropping childs on their new parents, rewrite
drop append handling into something saner,
(gtk_tree_view_drag_motion): show a "drop possible arrow" on empty
spaces,
(gtk_tree_view_drag_drop): updates for updated backend,
(gtk_tree_view_drag_data_received): updates for updated backend,
path down mode (treestore DnD) handling,
(gtk_tree_view_set_drag_dest_row): set empty_view_drop flag,
when we are trying to drop a row on an empty model,
(gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag.
* gtk/gtkliststore.c (gtk_list_store_drag_data_received),
(gtk_list_store_row_drop_possible): style and drop-append fixes.
* gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
|
|
|
gtk_tree_store_insert_after (tree_store, &dest_iter, NULL,
|
|
|
|
&tmp_iter);
|
2001-01-31 00:57:49 +00:00
|
|
|
|
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore
Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org>
Big TreeView DnD fixage, makes drops on empty models work, makes
TreeStore DnD work and gets rid of gtk-tree-model-drop-append.
Related bugs #95362 and #113314. I don't want to touch this code
ever again.
* gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field.
* gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check
for selection_data->length.
* gtk/gtktreeview.c (struct DestRow), (dest_row_free),
(set_dest_row), (get_dest_row): we don't store just the row ref
anymore, but a struct with the row ref and additional info,
(set_destination_row): handle drops on empty space and some
style fixes,
(get_logical_dest_row): also return path_down_mode/drop_append_mode
flags, handle dropping childs on their new parents, rewrite
drop append handling into something saner,
(gtk_tree_view_drag_motion): show a "drop possible arrow" on empty
spaces,
(gtk_tree_view_drag_drop): updates for updated backend,
(gtk_tree_view_drag_data_received): updates for updated backend,
path down mode (treestore DnD) handling,
(gtk_tree_view_set_drag_dest_row): set empty_view_drop flag,
when we are trying to drop a row on an empty model,
(gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag.
* gtk/gtkliststore.c (gtk_list_store_drag_data_received),
(gtk_list_store_row_drop_possible): style and drop-append fixes.
* gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
|
|
|
retval = TRUE;
|
2001-01-31 00:57:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_path_free (prev);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
/* If we succeeded in creating dest_iter, walk src_iter tree branch,
|
|
|
|
* duplicating it below dest_iter.
|
|
|
|
*/
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
if (retval)
|
|
|
|
{
|
|
|
|
recursive_node_copy (tree_store,
|
|
|
|
&src_iter,
|
|
|
|
&dest_iter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* FIXME maybe add some data targets eventually, or handle text
|
|
|
|
* targets in the simple case.
|
|
|
|
*/
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
if (src_path)
|
|
|
|
gtk_tree_path_free (src_path);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
|
|
|
return retval;
|
2001-01-31 00:57:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2001-11-06 19:10:03 +00:00
|
|
|
gtk_tree_store_row_drop_possible (GtkTreeDragDest *drag_dest,
|
|
|
|
GtkTreePath *dest_path,
|
|
|
|
GtkSelectionData *selection_data)
|
2001-01-31 00:57:49 +00:00
|
|
|
{
|
2001-11-06 19:10:03 +00:00
|
|
|
GtkTreeModel *src_model = NULL;
|
|
|
|
GtkTreePath *src_path = NULL;
|
|
|
|
GtkTreePath *tmp = NULL;
|
|
|
|
gboolean retval = FALSE;
|
|
|
|
|
Behaviour change, apply changes if the entry of the editable gets a focus
Tue Oct 15 00:53:14 2002 Kristian Rietveld <kris@gtk.org>
Behaviour change, apply changes if the entry of the editable gets
a focus out event (#82405).
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event):
new function,
(gtk_cell_renderer_text_start_editing): stop editing and apply
changes on focus-out.
Tue Oct 15 00:47:35 2002 Kristian Rietveld <kris@gtk.org>
Fixes an *evil* GtkTreeModelSort bug, #93629.
* gtk/gtktreemodel.c (release_row_references): return if the
refs->list is NULL.
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed): if we
are swapping two rows (re-insertion on row_changed), also *emit*
a rows_reordered signal. oops.
Tue Oct 15 00:45:03 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_remove_silently): free
the actual link after the node has been removed (#92014).
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_column_finalize):
free the cell_list and the child if the exists (#92014).
Tue Oct 15 00:40:25 2002 Kristian Rietveld <kris@gtk.org>
Don't accept drops if the model has been sorted, #93758)
* gtk/gtkliststore.c (gtk_list_store_row_drop_possible): return
FALSE if the list has been sorted.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible): check
if drag_dest is a TreeStore, return FALSE if the tree has been
sorted.
Tue Oct 15 00:33:59 2002 Kristian Rietveld <kris@gtk.org>
Compiler warning fixage, (#85858, #85859, #85860, #85872)
* gtk/gtkcellrendererpixbuf (gtk_cell_renderer_pixbuf_render):
s/guint/GtkCellRendererState/.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render):
ditto.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render),
(gtk_cell_renderer_toggle_activate): ditto.
* gtk/gtkliststore.c (gtk_list_store_get_flags): a
s/guint/GtkTreeModelFlags/ on the return type.
2002-10-14 22:50:18 +00:00
|
|
|
/* don't accept drops if the tree has been sorted */
|
|
|
|
if (GTK_TREE_STORE_IS_SORTED (drag_dest))
|
|
|
|
return FALSE;
|
|
|
|
|
2001-11-06 19:10:03 +00:00
|
|
|
if (!gtk_tree_get_row_drag_data (selection_data,
|
|
|
|
&src_model,
|
|
|
|
&src_path))
|
|
|
|
goto out;
|
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
/* can only drag to ourselves */
|
|
|
|
if (src_model != GTK_TREE_MODEL (drag_dest))
|
2001-11-06 19:10:03 +00:00
|
|
|
goto out;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
/* Can't drop into ourself. */
|
|
|
|
if (gtk_tree_path_is_ancestor (src_path,
|
|
|
|
dest_path))
|
2001-11-06 19:10:03 +00:00
|
|
|
goto out;
|
2001-01-31 00:57:49 +00:00
|
|
|
|
|
|
|
/* Can't drop if dest_path's parent doesn't exist */
|
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
2001-11-06 19:10:03 +00:00
|
|
|
if (gtk_tree_path_get_depth (dest_path) > 1)
|
2001-01-31 00:57:49 +00:00
|
|
|
{
|
2001-11-06 19:10:03 +00:00
|
|
|
tmp = gtk_tree_path_copy (dest_path);
|
|
|
|
gtk_tree_path_up (tmp);
|
|
|
|
|
2005-12-30 03:29:36 +00:00
|
|
|
if (!gtk_tree_store_get_iter (GTK_TREE_MODEL (drag_dest),
|
2001-11-06 19:10:03 +00:00
|
|
|
&iter, tmp))
|
|
|
|
goto out;
|
2001-01-31 00:57:49 +00:00
|
|
|
}
|
|
|
|
}
|
2001-11-06 19:10:03 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
/* Can otherwise drop anywhere. */
|
2001-11-06 19:10:03 +00:00
|
|
|
retval = TRUE;
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
|
|
|
if (src_path)
|
|
|
|
gtk_tree_path_free (src_path);
|
|
|
|
if (tmp)
|
|
|
|
gtk_tree_path_free (tmp);
|
|
|
|
|
|
|
|
return retval;
|
2001-01-31 00:57:49 +00:00
|
|
|
}
|
2001-03-23 00:35:19 +00:00
|
|
|
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
/* Sorting and reordering */
|
2001-06-14 23:25:52 +00:00
|
|
|
typedef struct _SortTuple
|
|
|
|
{
|
|
|
|
gint offset;
|
|
|
|
GNode *node;
|
|
|
|
} SortTuple;
|
|
|
|
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
/* Reordering */
|
|
|
|
static gint
|
|
|
|
gtk_tree_store_reorder_func (gconstpointer a,
|
|
|
|
gconstpointer b,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
SortTuple *a_reorder;
|
|
|
|
SortTuple *b_reorder;
|
|
|
|
|
|
|
|
a_reorder = (SortTuple *)a;
|
|
|
|
b_reorder = (SortTuple *)b;
|
|
|
|
|
|
|
|
if (a_reorder->offset < b_reorder->offset)
|
|
|
|
return -1;
|
|
|
|
if (a_reorder->offset > b_reorder->offset)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_tree_store_reorder:
|
2002-10-10 23:42:57 +00:00
|
|
|
* @tree_store: A #GtkTreeStore.
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
* @parent: A #GtkTreeIter.
|
2004-03-02 21:34:19 +00:00
|
|
|
* @new_order: an array of integers mapping the new position of each child
|
|
|
|
* to its old position before the re-ordering,
|
|
|
|
* i.e. @new_order<literal>[newpos] = oldpos</literal>.
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
*
|
2002-10-10 23:42:57 +00:00
|
|
|
* Reorders the children of @parent in @tree_store to follow the order
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
* indicated by @new_order. Note that this function only works with
|
|
|
|
* unsorted stores.
|
2002-11-28 00:33:17 +00:00
|
|
|
*
|
|
|
|
* Since: 2.2
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
**/
|
|
|
|
void
|
2002-10-10 23:42:57 +00:00
|
|
|
gtk_tree_store_reorder (GtkTreeStore *tree_store,
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
GtkTreeIter *parent,
|
|
|
|
gint *new_order)
|
|
|
|
{
|
|
|
|
gint i, length = 0;
|
|
|
|
GNode *level, *node;
|
|
|
|
GtkTreePath *path;
|
|
|
|
SortTuple *sort_array;
|
|
|
|
|
2002-10-10 23:42:57 +00:00
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
|
|
|
g_return_if_fail (!GTK_TREE_STORE_IS_SORTED (tree_store));
|
|
|
|
g_return_if_fail (parent == NULL || VALID_ITER (parent, tree_store));
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
g_return_if_fail (new_order != NULL);
|
|
|
|
|
|
|
|
if (!parent)
|
2002-10-10 23:42:57 +00:00
|
|
|
level = G_NODE (tree_store->root)->children;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
else
|
|
|
|
level = G_NODE (parent->user_data)->children;
|
|
|
|
|
|
|
|
/* count nodes */
|
|
|
|
node = level;
|
|
|
|
while (node)
|
|
|
|
{
|
|
|
|
length++;
|
|
|
|
node = node->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set up sortarray */
|
|
|
|
sort_array = g_new (SortTuple, length);
|
|
|
|
|
|
|
|
node = level;
|
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
{
|
2004-03-02 21:34:19 +00:00
|
|
|
sort_array[new_order[i]].offset = i;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
sort_array[i].node = node;
|
|
|
|
|
|
|
|
node = node->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_qsort_with_data (sort_array,
|
|
|
|
length,
|
|
|
|
sizeof (SortTuple),
|
|
|
|
gtk_tree_store_reorder_func,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* fix up level */
|
|
|
|
for (i = 0; i < length - 1; i++)
|
|
|
|
{
|
|
|
|
sort_array[i].node->next = sort_array[i+1].node;
|
|
|
|
sort_array[i+1].node->prev = sort_array[i].node;
|
|
|
|
}
|
|
|
|
|
|
|
|
sort_array[length-1].node->next = NULL;
|
|
|
|
sort_array[0].node->prev = NULL;
|
|
|
|
if (parent)
|
|
|
|
G_NODE (parent->user_data)->children = sort_array[0].node;
|
|
|
|
else
|
2002-10-10 23:42:57 +00:00
|
|
|
G_NODE (tree_store->root)->children = sort_array[0].node;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
|
|
|
/* emit signal */
|
|
|
|
if (parent)
|
2005-12-30 03:29:36 +00:00
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), parent);
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
else
|
|
|
|
path = gtk_tree_path_new ();
|
2002-10-10 23:42:57 +00:00
|
|
|
gtk_tree_model_rows_reordered (GTK_TREE_MODEL (tree_store), path,
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
parent, new_order);
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
g_free (sort_array);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_tree_store_swap:
|
2002-10-10 23:42:57 +00:00
|
|
|
* @tree_store: A #GtkTreeStore.
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
* @a: A #GtkTreeIter.
|
|
|
|
* @b: Another #GtkTreeIter.
|
|
|
|
*
|
2002-10-10 23:42:57 +00:00
|
|
|
* Swaps @a and @b in the same level of @tree_store. Note that this function
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
* only works with unsorted stores.
|
2002-11-28 00:33:17 +00:00
|
|
|
*
|
|
|
|
* Since: 2.2
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
**/
|
|
|
|
void
|
2002-10-10 23:42:57 +00:00
|
|
|
gtk_tree_store_swap (GtkTreeStore *tree_store,
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
GtkTreeIter *a,
|
|
|
|
GtkTreeIter *b)
|
|
|
|
{
|
|
|
|
GNode *tmp, *node_a, *node_b, *parent_node;
|
2002-11-18 19:33:28 +00:00
|
|
|
GNode *a_prev, *a_next, *b_prev, *b_next;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
gint i, a_count, b_count, length, *order;
|
|
|
|
GtkTreePath *path_a, *path_b;
|
|
|
|
GtkTreeIter parent;
|
|
|
|
|
2002-10-10 23:42:57 +00:00
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
|
|
|
g_return_if_fail (VALID_ITER (a, tree_store));
|
|
|
|
g_return_if_fail (VALID_ITER (b, tree_store));
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
|
|
|
node_a = G_NODE (a->user_data);
|
|
|
|
node_b = G_NODE (b->user_data);
|
|
|
|
|
|
|
|
/* basic sanity checking */
|
|
|
|
if (node_a == node_b)
|
|
|
|
return;
|
|
|
|
|
2005-12-30 03:29:36 +00:00
|
|
|
path_a = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), a);
|
|
|
|
path_b = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), b);
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
|
|
|
g_return_if_fail (path_a && path_b);
|
|
|
|
|
|
|
|
gtk_tree_path_up (path_a);
|
|
|
|
gtk_tree_path_up (path_b);
|
|
|
|
|
2004-06-25 04:33:25 +00:00
|
|
|
if (gtk_tree_path_get_depth (path_a) == 0
|
|
|
|
|| gtk_tree_path_get_depth (path_b) == 0)
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
{
|
2004-06-25 04:33:25 +00:00
|
|
|
if (gtk_tree_path_get_depth (path_a) != gtk_tree_path_get_depth (path_b))
|
|
|
|
{
|
|
|
|
gtk_tree_path_free (path_a);
|
|
|
|
gtk_tree_path_free (path_b);
|
|
|
|
|
|
|
|
g_warning ("Given children are not in the same level\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
parent_node = G_NODE (tree_store->root);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (gtk_tree_path_compare (path_a, path_b))
|
|
|
|
{
|
|
|
|
gtk_tree_path_free (path_a);
|
|
|
|
gtk_tree_path_free (path_b);
|
|
|
|
|
|
|
|
g_warning ("Given children don't have a common parent\n");
|
|
|
|
return;
|
|
|
|
}
|
2005-12-30 03:29:36 +00:00
|
|
|
gtk_tree_store_get_iter (GTK_TREE_MODEL (tree_store), &parent,
|
2004-06-25 04:33:25 +00:00
|
|
|
path_a);
|
|
|
|
parent_node = G_NODE (parent.user_data);
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
}
|
|
|
|
gtk_tree_path_free (path_b);
|
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
/* old links which we have to keep around */
|
|
|
|
a_prev = node_a->prev;
|
|
|
|
a_next = node_a->next;
|
|
|
|
|
|
|
|
b_prev = node_b->prev;
|
|
|
|
b_next = node_b->next;
|
|
|
|
|
|
|
|
/* fix up links if the nodes are next to eachother */
|
|
|
|
if (a_prev == node_b)
|
|
|
|
a_prev = node_a;
|
|
|
|
if (a_next == node_b)
|
|
|
|
a_next = node_a;
|
|
|
|
|
|
|
|
if (b_prev == node_a)
|
|
|
|
b_prev = node_b;
|
|
|
|
if (b_next == node_a)
|
|
|
|
b_next = node_b;
|
|
|
|
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
/* counting nodes */
|
2002-11-18 19:33:28 +00:00
|
|
|
tmp = parent_node->children;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
i = a_count = b_count = 0;
|
|
|
|
while (tmp)
|
|
|
|
{
|
|
|
|
if (tmp == node_a)
|
|
|
|
a_count = i;
|
|
|
|
if (tmp == node_b)
|
|
|
|
b_count = i;
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
length = i;
|
|
|
|
|
|
|
|
/* hacking the tree */
|
2002-11-18 19:33:28 +00:00
|
|
|
if (!a_prev)
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
parent_node->children = node_b;
|
|
|
|
else
|
2002-11-18 19:33:28 +00:00
|
|
|
a_prev->next = node_b;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
if (a_next)
|
|
|
|
a_next->prev = node_b;
|
|
|
|
|
|
|
|
if (!b_prev)
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
parent_node->children = node_a;
|
|
|
|
else
|
2002-11-18 19:33:28 +00:00
|
|
|
b_prev->next = node_a;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
if (b_next)
|
|
|
|
b_next->prev = node_a;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
node_a->prev = b_prev;
|
|
|
|
node_a->next = b_next;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
node_b->prev = a_prev;
|
|
|
|
node_b->next = a_next;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
|
|
|
/* emit signal */
|
|
|
|
order = g_new (gint, length);
|
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
if (i == a_count)
|
|
|
|
order[i] = b_count;
|
|
|
|
else if (i == b_count)
|
|
|
|
order[i] = a_count;
|
|
|
|
else
|
|
|
|
order[i] = i;
|
|
|
|
|
2002-10-10 23:42:57 +00:00
|
|
|
gtk_tree_model_rows_reordered (GTK_TREE_MODEL (tree_store), path_a,
|
2004-08-22 03:56:43 +00:00
|
|
|
parent_node == tree_store->root
|
|
|
|
? NULL : &parent, order);
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
gtk_tree_path_free (path_a);
|
|
|
|
g_free (order);
|
|
|
|
}
|
|
|
|
|
2003-01-14 22:30:41 +00:00
|
|
|
/* WARNING: this function is *incredibly* fragile. Please smashtest after
|
2002-11-18 19:33:28 +00:00
|
|
|
* making changes here.
|
|
|
|
* -Kris
|
|
|
|
*/
|
|
|
|
static void
|
2002-10-10 23:42:57 +00:00
|
|
|
gtk_tree_store_move (GtkTreeStore *tree_store,
|
2002-11-18 19:33:28 +00:00
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *position,
|
|
|
|
gboolean before)
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
{
|
2002-11-18 19:33:28 +00:00
|
|
|
GNode *parent, *node, *a, *b, *tmp, *tmp_a, *tmp_b;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
gint old_pos, new_pos, length, i, *order;
|
2002-11-18 19:33:28 +00:00
|
|
|
GtkTreePath *path = NULL, *tmppath, *pos_path = NULL;
|
|
|
|
GtkTreeIter parent_iter, dst_a, dst_b;
|
|
|
|
gint depth = 0;
|
|
|
|
gboolean handle_b = TRUE;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-10-10 23:42:57 +00:00
|
|
|
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
|
|
|
g_return_if_fail (!GTK_TREE_STORE_IS_SORTED (tree_store));
|
|
|
|
g_return_if_fail (VALID_ITER (iter, tree_store));
|
2002-11-18 19:33:28 +00:00
|
|
|
if (position)
|
|
|
|
g_return_if_fail (VALID_ITER (position, tree_store));
|
|
|
|
|
|
|
|
a = b = NULL;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
|
|
|
/* sanity checks */
|
2002-11-18 19:33:28 +00:00
|
|
|
if (position)
|
|
|
|
{
|
2005-12-30 03:29:36 +00:00
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
|
|
|
|
pos_path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store),
|
2002-11-18 19:33:28 +00:00
|
|
|
position);
|
|
|
|
|
|
|
|
/* if before:
|
|
|
|
* moving the iter before path or "path + 1" doesn't make sense
|
|
|
|
* else
|
|
|
|
* moving the iter before path or "path - 1" doesn't make sense
|
|
|
|
*/
|
|
|
|
if (!gtk_tree_path_compare (path, pos_path))
|
|
|
|
goto free_paths_and_out;
|
|
|
|
|
|
|
|
if (before)
|
|
|
|
gtk_tree_path_next (path);
|
|
|
|
else
|
|
|
|
gtk_tree_path_prev (path);
|
|
|
|
|
|
|
|
if (!gtk_tree_path_compare (path, pos_path))
|
|
|
|
goto free_paths_and_out;
|
|
|
|
|
|
|
|
if (before)
|
|
|
|
gtk_tree_path_prev (path);
|
|
|
|
else
|
|
|
|
gtk_tree_path_next (path);
|
|
|
|
|
|
|
|
if (gtk_tree_path_get_depth (path) != gtk_tree_path_get_depth (pos_path))
|
|
|
|
{
|
2004-08-04 05:38:58 +00:00
|
|
|
g_warning ("Given children are not in the same level\n");
|
2002-11-18 19:33:28 +00:00
|
|
|
|
|
|
|
goto free_paths_and_out;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmppath = gtk_tree_path_copy (pos_path);
|
|
|
|
gtk_tree_path_up (path);
|
|
|
|
gtk_tree_path_up (tmppath);
|
|
|
|
|
|
|
|
if (gtk_tree_path_get_depth (path) > 0 &&
|
|
|
|
gtk_tree_path_compare (path, tmppath))
|
|
|
|
{
|
2004-08-04 05:38:58 +00:00
|
|
|
g_warning ("Given children are not in the same level\n");
|
2002-11-18 19:33:28 +00:00
|
|
|
|
|
|
|
gtk_tree_path_free (tmppath);
|
|
|
|
goto free_paths_and_out;
|
|
|
|
}
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
gtk_tree_path_free (tmppath);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!path)
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
{
|
2005-12-30 03:29:36 +00:00
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
|
2002-11-18 19:33:28 +00:00
|
|
|
gtk_tree_path_up (path);
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
}
|
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
depth = gtk_tree_path_get_depth (path);
|
|
|
|
|
|
|
|
if (depth)
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
{
|
2005-12-30 03:29:36 +00:00
|
|
|
gtk_tree_store_get_iter (GTK_TREE_MODEL (tree_store),
|
|
|
|
&parent_iter, path);
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
parent = G_NODE (parent_iter.user_data);
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
}
|
2002-11-18 19:33:28 +00:00
|
|
|
else
|
|
|
|
parent = G_NODE (tree_store->root);
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
/* yes, I know that this can be done shorter, but I'm doing it this way
|
|
|
|
* so the code is also maintainable
|
|
|
|
*/
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
if (before && position)
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
{
|
2002-11-18 19:33:28 +00:00
|
|
|
b = G_NODE (position->user_data);
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
if (gtk_tree_path_get_indices (pos_path)[gtk_tree_path_get_depth (pos_path) - 1] > 0)
|
|
|
|
{
|
|
|
|
gtk_tree_path_prev (pos_path);
|
2005-12-30 03:29:36 +00:00
|
|
|
if (gtk_tree_store_get_iter (GTK_TREE_MODEL (tree_store),
|
|
|
|
&dst_a, pos_path))
|
2002-11-18 19:33:28 +00:00
|
|
|
a = G_NODE (dst_a.user_data);
|
|
|
|
else
|
|
|
|
a = NULL;
|
|
|
|
gtk_tree_path_next (pos_path);
|
|
|
|
}
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
/* if b is NULL, a is NULL too -- we are at the beginning of the list
|
|
|
|
* yes and we leak memory here ...
|
|
|
|
*/
|
|
|
|
g_return_if_fail (b);
|
|
|
|
}
|
|
|
|
else if (before && !position)
|
|
|
|
{
|
|
|
|
/* move before without position is appending */
|
|
|
|
a = NULL;
|
|
|
|
b = NULL;
|
|
|
|
}
|
|
|
|
else /* !before */
|
|
|
|
{
|
|
|
|
if (position)
|
|
|
|
a = G_NODE (position->user_data);
|
|
|
|
else
|
|
|
|
a = NULL;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
if (position)
|
|
|
|
{
|
|
|
|
gtk_tree_path_next (pos_path);
|
2005-12-30 03:29:36 +00:00
|
|
|
if (gtk_tree_store_get_iter (GTK_TREE_MODEL (tree_store), &dst_b, pos_path))
|
2002-11-18 19:33:28 +00:00
|
|
|
b = G_NODE (dst_b.user_data);
|
|
|
|
else
|
|
|
|
b = NULL;
|
|
|
|
gtk_tree_path_prev (pos_path);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* move after without position is prepending */
|
|
|
|
if (depth)
|
2005-12-30 03:29:36 +00:00
|
|
|
gtk_tree_store_iter_children (GTK_TREE_MODEL (tree_store), &dst_b,
|
2002-11-18 19:33:28 +00:00
|
|
|
&parent_iter);
|
|
|
|
else
|
2005-12-30 03:29:36 +00:00
|
|
|
gtk_tree_store_iter_children (GTK_TREE_MODEL (tree_store), &dst_b,
|
2002-11-18 19:33:28 +00:00
|
|
|
NULL);
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
b = G_NODE (dst_b.user_data);
|
|
|
|
}
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2005-11-15 15:38:53 +00:00
|
|
|
/* if a is NULL, b is NULL too -- we are at the end of the list
|
2002-11-18 19:33:28 +00:00
|
|
|
* yes and we leak memory here ...
|
|
|
|
*/
|
|
|
|
if (position)
|
|
|
|
g_return_if_fail (a);
|
|
|
|
}
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
|
|
|
/* counting nodes */
|
2002-11-18 19:33:28 +00:00
|
|
|
tmp = parent->children;
|
|
|
|
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
length = old_pos = 0;
|
|
|
|
while (tmp)
|
|
|
|
{
|
|
|
|
if (tmp == iter->user_data)
|
|
|
|
old_pos = length;
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
length++;
|
|
|
|
}
|
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
/* remove node from list */
|
|
|
|
node = G_NODE (iter->user_data);
|
|
|
|
tmp_a = node->prev;
|
|
|
|
tmp_b = node->next;
|
|
|
|
|
|
|
|
if (tmp_a)
|
|
|
|
tmp_a->next = tmp_b;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
else
|
2002-11-18 19:33:28 +00:00
|
|
|
parent->children = tmp_b;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
if (tmp_b)
|
|
|
|
tmp_b->prev = tmp_a;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
/* and reinsert the node */
|
|
|
|
if (a)
|
|
|
|
{
|
|
|
|
tmp = a->next;
|
|
|
|
|
|
|
|
a->next = node;
|
|
|
|
node->next = tmp;
|
|
|
|
node->prev = a;
|
|
|
|
}
|
|
|
|
else if (!a && !before)
|
|
|
|
{
|
|
|
|
tmp = parent->children;
|
|
|
|
|
|
|
|
node->prev = NULL;
|
|
|
|
parent->children = node;
|
|
|
|
|
|
|
|
node->next = tmp;
|
2004-07-04 05:12:47 +00:00
|
|
|
if (tmp)
|
|
|
|
tmp->prev = node;
|
2002-11-18 19:33:28 +00:00
|
|
|
|
|
|
|
handle_b = FALSE;
|
|
|
|
}
|
|
|
|
else if (!a && before)
|
|
|
|
{
|
|
|
|
if (!position)
|
|
|
|
{
|
|
|
|
node->parent = NULL;
|
|
|
|
node->next = node->prev = NULL;
|
|
|
|
|
|
|
|
/* before with sibling = NULL appends */
|
|
|
|
g_node_insert_before (parent, NULL, node);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
node->parent = NULL;
|
|
|
|
node->next = node->prev = NULL;
|
|
|
|
|
|
|
|
/* after with sibling = NULL prepends */
|
|
|
|
g_node_insert_after (parent, NULL, node);
|
|
|
|
}
|
2003-01-27 21:41:06 +00:00
|
|
|
|
|
|
|
handle_b = FALSE;
|
2002-11-18 19:33:28 +00:00
|
|
|
}
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
if (handle_b)
|
|
|
|
{
|
|
|
|
if (b)
|
|
|
|
{
|
|
|
|
tmp = b->prev;
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
b->prev = node;
|
|
|
|
node->prev = tmp;
|
|
|
|
node->next = b;
|
|
|
|
}
|
|
|
|
else if (!(!a && before)) /* !a && before is completely handled above */
|
|
|
|
node->next = NULL;
|
|
|
|
}
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
|
|
|
/* emit signal */
|
2002-11-18 19:33:28 +00:00
|
|
|
if (position)
|
|
|
|
new_pos = gtk_tree_path_get_indices (pos_path)[gtk_tree_path_get_depth (pos_path)-1];
|
|
|
|
else if (before)
|
|
|
|
{
|
|
|
|
if (depth)
|
2005-12-30 03:29:36 +00:00
|
|
|
new_pos = gtk_tree_store_iter_n_children (GTK_TREE_MODEL (tree_store),
|
2002-11-18 19:33:28 +00:00
|
|
|
&parent_iter) - 1;
|
|
|
|
else
|
2005-12-30 03:29:36 +00:00
|
|
|
new_pos = gtk_tree_store_iter_n_children (GTK_TREE_MODEL (tree_store),
|
2002-11-18 19:33:28 +00:00
|
|
|
NULL) - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
new_pos = 0;
|
|
|
|
|
|
|
|
if (new_pos > old_pos)
|
|
|
|
{
|
|
|
|
if (before && position)
|
|
|
|
new_pos--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!before && position)
|
|
|
|
new_pos++;
|
|
|
|
}
|
|
|
|
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
order = g_new (gint, length);
|
2002-11-18 19:33:28 +00:00
|
|
|
if (new_pos > old_pos)
|
|
|
|
{
|
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
if (i < old_pos)
|
|
|
|
order[i] = i;
|
|
|
|
else if (i >= old_pos && i < new_pos)
|
|
|
|
order[i] = i + 1;
|
|
|
|
else if (i == new_pos)
|
|
|
|
order[i] = old_pos;
|
|
|
|
else
|
|
|
|
order[i] = i;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
if (i == new_pos)
|
|
|
|
order[i] = old_pos;
|
|
|
|
else if (i > new_pos && i <= old_pos)
|
|
|
|
order[i] = i - 1;
|
|
|
|
else
|
|
|
|
order[i] = i;
|
|
|
|
}
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
|
2003-01-14 22:30:41 +00:00
|
|
|
if (depth)
|
2004-06-26 02:57:32 +00:00
|
|
|
{
|
2005-12-30 03:29:36 +00:00
|
|
|
tmppath = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store),
|
|
|
|
&parent_iter);
|
2004-06-26 02:57:32 +00:00
|
|
|
gtk_tree_model_rows_reordered (GTK_TREE_MODEL (tree_store),
|
2005-11-15 15:38:53 +00:00
|
|
|
tmppath, &parent_iter, order);
|
2004-06-26 02:57:32 +00:00
|
|
|
}
|
2003-01-14 22:30:41 +00:00
|
|
|
else
|
2004-06-26 02:57:32 +00:00
|
|
|
{
|
2005-11-15 15:38:53 +00:00
|
|
|
tmppath = gtk_tree_path_new ();
|
2004-06-26 02:57:32 +00:00
|
|
|
gtk_tree_model_rows_reordered (GTK_TREE_MODEL (tree_store),
|
2005-11-15 15:38:53 +00:00
|
|
|
tmppath, NULL, order);
|
2004-06-26 02:57:32 +00:00
|
|
|
}
|
2002-11-18 19:33:28 +00:00
|
|
|
|
2005-11-15 15:38:53 +00:00
|
|
|
gtk_tree_path_free (tmppath);
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
gtk_tree_path_free (path);
|
2002-11-18 19:33:28 +00:00
|
|
|
if (position)
|
|
|
|
gtk_tree_path_free (pos_path);
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
g_free (order);
|
2002-11-18 19:33:28 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
free_paths_and_out:
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
gtk_tree_path_free (pos_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_tree_store_move_before:
|
|
|
|
* @tree_store: A #GtkTreeStore.
|
|
|
|
* @iter: A #GtkTreeIter.
|
|
|
|
* @position: A #GtkTreeIter or %NULL.
|
|
|
|
*
|
|
|
|
* Moves @iter in @tree_store to the position before @position. @iter and
|
|
|
|
* @position should be in the same level. Note that this function only
|
|
|
|
* works with unsorted stores. If @position is %NULL, @iter will be
|
|
|
|
* moved to the end of the level.
|
2002-11-28 00:33:17 +00:00
|
|
|
*
|
|
|
|
* Since: 2.2
|
2002-11-18 19:33:28 +00:00
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_tree_store_move_before (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *position)
|
|
|
|
{
|
|
|
|
gtk_tree_store_move (tree_store, iter, position, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_tree_store_move_after:
|
|
|
|
* @tree_store: A #GtkTreeStore.
|
|
|
|
* @iter: A #GtkTreeIter.
|
|
|
|
* @position: A #GtkTreeIter.
|
|
|
|
*
|
|
|
|
* Moves @iter in @tree_store to the position after @position. @iter and
|
|
|
|
* @position should be in the same level. Note that this function only
|
|
|
|
* works with unsorted stores. If @position is %NULL, @iter will be moved
|
|
|
|
* to the start of the level.
|
2002-11-28 00:33:17 +00:00
|
|
|
*
|
|
|
|
* Since: 2.2
|
2002-11-18 19:33:28 +00:00
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_tree_store_move_after (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
GtkTreeIter *position)
|
|
|
|
{
|
|
|
|
gtk_tree_store_move (tree_store, iter, position, FALSE);
|
API additions: _move, _reorder and _swap for stores, path constructor.
Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org>
API additions: _move, _reorder and _swap for stores, path
constructor.
* gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function.
* gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private),
gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move.
* gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private),
gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move.
Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreestore.c (node_free): return FALSE,
(gtk_tree_store_finalize): use g_node_traverse instead of
g_node_children_foreach, so the whole tree will be freed (#88854,
patch from Emmanuel Briot).
Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks,
(#84426, patch from Matthias Clasen).
Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org>
Merge from stable:
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children
check shouldn't be in g_return_return_val_if_fail (pointed out by
Josh Green, #88997),
(gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model
for each column when we unset the model (part of #82484),
(gtk_tree_view_get_cell_area): return if we ran out of tree or
if we got an invalid path (#82376).
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model.
* gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model
which disconnects the sort_column_changed_signal (part of #82484).
* gtk/gtkliststore.c (gtk_list_store_insert): append row if the
given postion is off the end of the tree (#85813).
* gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use
2-space indent, commit changes if up/down keys has been pressed,
this overrides the focus key foo so the user won't be surprised
(#84665).
2002-07-26 20:51:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Sorting */
|
2001-06-14 23:25:52 +00:00
|
|
|
static gint
|
|
|
|
gtk_tree_store_compare_func (gconstpointer a,
|
|
|
|
gconstpointer b,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GtkTreeStore *tree_store = user_data;
|
|
|
|
GNode *node_a;
|
|
|
|
GNode *node_b;
|
2001-09-03 23:37:39 +00:00
|
|
|
GtkTreeIterCompareFunc func;
|
|
|
|
gpointer data;
|
|
|
|
|
2001-06-14 23:25:52 +00:00
|
|
|
GtkTreeIter iter_a;
|
|
|
|
GtkTreeIter iter_b;
|
|
|
|
gint retval;
|
|
|
|
|
2001-09-03 23:37:39 +00:00
|
|
|
if (tree_store->sort_column_id != -1)
|
|
|
|
{
|
|
|
|
GtkTreeDataSortHeader *header;
|
|
|
|
|
|
|
|
header = _gtk_tree_data_list_get_header (tree_store->sort_list,
|
|
|
|
tree_store->sort_column_id);
|
|
|
|
g_return_val_if_fail (header != NULL, 0);
|
|
|
|
g_return_val_if_fail (header->func != NULL, 0);
|
2001-06-14 23:25:52 +00:00
|
|
|
|
2001-09-03 23:37:39 +00:00
|
|
|
func = header->func;
|
|
|
|
data = header->data;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (tree_store->default_sort_func != NULL, 0);
|
|
|
|
func = tree_store->default_sort_func;
|
|
|
|
data = tree_store->default_sort_data;
|
|
|
|
}
|
2001-06-14 23:25:52 +00:00
|
|
|
|
|
|
|
node_a = ((SortTuple *) a)->node;
|
|
|
|
node_b = ((SortTuple *) b)->node;
|
|
|
|
|
|
|
|
iter_a.stamp = tree_store->stamp;
|
|
|
|
iter_a.user_data = node_a;
|
|
|
|
iter_b.stamp = tree_store->stamp;
|
|
|
|
iter_b.user_data = node_b;
|
|
|
|
|
2001-09-03 23:37:39 +00:00
|
|
|
retval = (* func) (GTK_TREE_MODEL (user_data), &iter_a, &iter_b, data);
|
2001-06-14 23:25:52 +00:00
|
|
|
|
2001-08-23 18:33:37 +00:00
|
|
|
if (tree_store->order == GTK_SORT_DESCENDING)
|
2001-06-14 23:25:52 +00:00
|
|
|
{
|
|
|
|
if (retval > 0)
|
|
|
|
retval = -1;
|
|
|
|
else if (retval < 0)
|
|
|
|
retval = 1;
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
2001-03-23 00:35:19 +00:00
|
|
|
|
|
|
|
static void
|
2001-06-14 23:25:52 +00:00
|
|
|
gtk_tree_store_sort_helper (GtkTreeStore *tree_store,
|
2001-06-15 23:03:27 +00:00
|
|
|
GNode *parent,
|
|
|
|
gboolean recurse)
|
2001-04-01 05:52:23 +00:00
|
|
|
{
|
2001-06-14 23:25:52 +00:00
|
|
|
GtkTreeIter iter;
|
|
|
|
GArray *sort_array;
|
2001-06-15 23:03:27 +00:00
|
|
|
GNode *node;
|
2001-06-14 23:25:52 +00:00
|
|
|
GNode *tmp_node;
|
|
|
|
gint list_length;
|
|
|
|
gint i;
|
|
|
|
gint *new_order;
|
|
|
|
GtkTreePath *path;
|
2001-04-01 05:52:23 +00:00
|
|
|
|
2001-06-15 23:03:27 +00:00
|
|
|
node = parent->children;
|
2001-09-25 19:38:18 +00:00
|
|
|
if (node == NULL || node->next == NULL)
|
2003-01-27 21:41:06 +00:00
|
|
|
{
|
|
|
|
if (recurse && node && node->children)
|
|
|
|
gtk_tree_store_sort_helper (tree_store, node, TRUE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2001-06-14 23:25:52 +00:00
|
|
|
|
|
|
|
list_length = 0;
|
|
|
|
for (tmp_node = node; tmp_node; tmp_node = tmp_node->next)
|
|
|
|
list_length++;
|
|
|
|
|
|
|
|
sort_array = g_array_sized_new (FALSE, FALSE, sizeof (SortTuple), list_length);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
for (tmp_node = node; tmp_node; tmp_node = tmp_node->next)
|
|
|
|
{
|
|
|
|
SortTuple tuple;
|
|
|
|
|
|
|
|
tuple.offset = i;
|
|
|
|
tuple.node = tmp_node;
|
|
|
|
g_array_append_val (sort_array, tuple);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
2002-01-08 23:48:30 +00:00
|
|
|
/* Sort the array */
|
2001-06-14 23:25:52 +00:00
|
|
|
g_array_sort_with_data (sort_array, gtk_tree_store_compare_func, tree_store);
|
|
|
|
|
|
|
|
for (i = 0; i < list_length - 1; i++)
|
|
|
|
{
|
|
|
|
g_array_index (sort_array, SortTuple, i).node->next =
|
|
|
|
g_array_index (sort_array, SortTuple, i + 1).node;
|
|
|
|
g_array_index (sort_array, SortTuple, i + 1).node->prev =
|
|
|
|
g_array_index (sort_array, SortTuple, i).node;
|
|
|
|
}
|
|
|
|
g_array_index (sort_array, SortTuple, list_length - 1).node->next = NULL;
|
|
|
|
g_array_index (sort_array, SortTuple, 0).node->prev = NULL;
|
2001-06-15 23:03:27 +00:00
|
|
|
parent->children = g_array_index (sort_array, SortTuple, 0).node;
|
2001-06-14 23:25:52 +00:00
|
|
|
|
|
|
|
/* Let the world know about our new order */
|
|
|
|
new_order = g_new (gint, list_length);
|
|
|
|
for (i = 0; i < list_length; i++)
|
|
|
|
new_order[i] = g_array_index (sort_array, SortTuple, i).offset;
|
|
|
|
|
2001-06-15 23:03:27 +00:00
|
|
|
iter.stamp = tree_store->stamp;
|
|
|
|
iter.user_data = parent;
|
|
|
|
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), &iter);
|
2001-09-12 23:16:18 +00:00
|
|
|
gtk_tree_model_rows_reordered (GTK_TREE_MODEL (tree_store),
|
|
|
|
path, &iter, new_order);
|
2001-06-14 23:25:52 +00:00
|
|
|
gtk_tree_path_free (path);
|
|
|
|
g_free (new_order);
|
|
|
|
g_array_free (sort_array, TRUE);
|
2001-06-15 23:03:27 +00:00
|
|
|
|
|
|
|
if (recurse)
|
|
|
|
{
|
|
|
|
for (tmp_node = parent->children; tmp_node; tmp_node = tmp_node->next)
|
|
|
|
{
|
|
|
|
if (tmp_node->children)
|
|
|
|
gtk_tree_store_sort_helper (tree_store, tmp_node, TRUE);
|
|
|
|
}
|
|
|
|
}
|
2001-06-14 23:25:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tree_store_sort (GtkTreeStore *tree_store)
|
|
|
|
{
|
2004-09-05 05:06:05 +00:00
|
|
|
if (!GTK_TREE_STORE_IS_SORTED (tree_store))
|
|
|
|
return;
|
|
|
|
|
2001-09-03 23:37:39 +00:00
|
|
|
if (tree_store->sort_column_id != -1)
|
|
|
|
{
|
|
|
|
GtkTreeDataSortHeader *header = NULL;
|
|
|
|
|
2005-12-29 05:26:09 +00:00
|
|
|
header = _gtk_tree_data_list_get_header (tree_store->sort_list,
|
|
|
|
tree_store->sort_column_id);
|
2001-09-03 23:37:39 +00:00
|
|
|
|
|
|
|
/* We want to make sure that we have a function */
|
|
|
|
g_return_if_fail (header != NULL);
|
|
|
|
g_return_if_fail (header->func != NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree_store->default_sort_func != NULL);
|
|
|
|
}
|
|
|
|
|
2001-06-15 23:03:27 +00:00
|
|
|
gtk_tree_store_sort_helper (tree_store, G_NODE (tree_store->root), TRUE);
|
2001-04-01 05:52:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tree_store_sort_iter_changed (GtkTreeStore *tree_store,
|
|
|
|
GtkTreeIter *iter,
|
2006-01-15 20:12:49 +00:00
|
|
|
gint column,
|
|
|
|
gboolean emit_signal)
|
2001-04-01 05:52:23 +00:00
|
|
|
{
|
|
|
|
GNode *prev = NULL;
|
|
|
|
GNode *next = NULL;
|
2001-04-01 06:02:09 +00:00
|
|
|
GNode *node;
|
2001-04-01 05:52:23 +00:00
|
|
|
GtkTreePath *tmp_path;
|
|
|
|
GtkTreeIter tmp_iter;
|
|
|
|
gint cmp_a = 0;
|
|
|
|
gint cmp_b = 0;
|
|
|
|
gint i;
|
|
|
|
gint old_location;
|
|
|
|
gint new_location;
|
|
|
|
gint *new_order;
|
2001-04-01 06:02:09 +00:00
|
|
|
gint length;
|
2001-09-03 23:37:39 +00:00
|
|
|
GtkTreeIterCompareFunc func;
|
|
|
|
gpointer data;
|
2001-04-01 05:52:23 +00:00
|
|
|
|
2001-06-15 23:03:27 +00:00
|
|
|
g_return_if_fail (G_NODE (iter->user_data)->parent != NULL);
|
|
|
|
|
2001-04-01 06:02:09 +00:00
|
|
|
tmp_iter.stamp = tree_store->stamp;
|
2001-09-03 23:37:39 +00:00
|
|
|
if (tree_store->sort_column_id != -1)
|
|
|
|
{
|
|
|
|
GtkTreeDataSortHeader *header;
|
|
|
|
header = _gtk_tree_data_list_get_header (tree_store->sort_list,
|
|
|
|
tree_store->sort_column_id);
|
|
|
|
g_return_if_fail (header != NULL);
|
|
|
|
g_return_if_fail (header->func != NULL);
|
|
|
|
func = header->func;
|
|
|
|
data = header->data;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree_store->default_sort_func != NULL);
|
|
|
|
func = tree_store->default_sort_func;
|
|
|
|
data = tree_store->default_sort_data;
|
|
|
|
}
|
2001-04-01 05:52:23 +00:00
|
|
|
|
|
|
|
/* If it's the built in function, we don't sort. */
|
2004-08-11 15:08:24 +00:00
|
|
|
if (func == _gtk_tree_data_list_compare_func &&
|
2001-04-01 06:02:09 +00:00
|
|
|
tree_store->sort_column_id != column)
|
2001-04-01 05:52:23 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
old_location = 0;
|
2001-06-15 23:03:27 +00:00
|
|
|
node = G_NODE (iter->user_data)->parent->children;
|
2001-04-01 05:52:23 +00:00
|
|
|
/* First we find the iter, its prev, and its next */
|
2001-04-01 06:02:09 +00:00
|
|
|
while (node)
|
2001-04-01 05:52:23 +00:00
|
|
|
{
|
2001-04-01 06:02:09 +00:00
|
|
|
if (node == G_NODE (iter->user_data))
|
2001-04-01 05:52:23 +00:00
|
|
|
break;
|
|
|
|
old_location++;
|
2001-06-15 23:03:27 +00:00
|
|
|
node = node->next;
|
2001-04-01 05:52:23 +00:00
|
|
|
}
|
2001-04-01 06:02:09 +00:00
|
|
|
g_assert (node != NULL);
|
2001-04-01 05:52:23 +00:00
|
|
|
|
2001-06-15 23:03:27 +00:00
|
|
|
prev = node->prev;
|
2001-04-01 06:02:09 +00:00
|
|
|
next = node->next;
|
2001-04-01 05:52:23 +00:00
|
|
|
|
|
|
|
/* Check the common case, where we don't need to sort it moved. */
|
|
|
|
if (prev != NULL)
|
|
|
|
{
|
|
|
|
tmp_iter.user_data = prev;
|
2001-09-03 23:37:39 +00:00
|
|
|
cmp_a = (* func) (GTK_TREE_MODEL (tree_store), &tmp_iter, iter, data);
|
2001-04-01 05:52:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (next != NULL)
|
|
|
|
{
|
|
|
|
tmp_iter.user_data = next;
|
2001-09-03 23:37:39 +00:00
|
|
|
cmp_b = (* func) (GTK_TREE_MODEL (tree_store), iter, &tmp_iter, data);
|
2001-04-01 05:52:23 +00:00
|
|
|
}
|
|
|
|
|
2001-08-23 18:33:37 +00:00
|
|
|
if (tree_store->order == GTK_SORT_DESCENDING)
|
2001-04-01 05:52:23 +00:00
|
|
|
{
|
|
|
|
if (cmp_a < 0)
|
|
|
|
cmp_a = 1;
|
|
|
|
else if (cmp_a > 0)
|
|
|
|
cmp_a = -1;
|
|
|
|
|
|
|
|
if (cmp_b < 0)
|
|
|
|
cmp_b = 1;
|
|
|
|
else if (cmp_b > 0)
|
|
|
|
cmp_b = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (prev == NULL && cmp_b <= 0)
|
|
|
|
return;
|
|
|
|
else if (next == NULL && cmp_a <= 0)
|
|
|
|
return;
|
|
|
|
else if (prev != NULL && next != NULL &&
|
|
|
|
cmp_a <= 0 && cmp_b <= 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* We actually need to sort it */
|
|
|
|
/* First, remove the old link. */
|
|
|
|
|
2001-06-15 23:03:27 +00:00
|
|
|
if (prev)
|
2001-04-01 05:52:23 +00:00
|
|
|
prev->next = next;
|
2001-06-15 23:03:27 +00:00
|
|
|
else
|
|
|
|
node->parent->children = next;
|
2002-05-16 22:17:59 +00:00
|
|
|
|
2001-06-15 23:03:27 +00:00
|
|
|
if (next)
|
|
|
|
next->prev = prev;
|
|
|
|
|
|
|
|
node->prev = NULL;
|
2001-04-01 06:02:09 +00:00
|
|
|
node->next = NULL;
|
2001-06-15 23:03:27 +00:00
|
|
|
|
2001-04-01 05:52:23 +00:00
|
|
|
/* FIXME: as an optimization, we can potentially start at next */
|
|
|
|
prev = NULL;
|
2001-06-15 23:03:27 +00:00
|
|
|
node = node->parent->children;
|
2001-04-01 05:52:23 +00:00
|
|
|
new_location = 0;
|
2001-04-01 06:02:09 +00:00
|
|
|
tmp_iter.user_data = node;
|
2001-08-23 18:33:37 +00:00
|
|
|
if (tree_store->order == GTK_SORT_DESCENDING)
|
2001-09-03 23:37:39 +00:00
|
|
|
cmp_a = (* func) (GTK_TREE_MODEL (tree_store), &tmp_iter, iter, data);
|
2001-04-01 05:52:23 +00:00
|
|
|
else
|
2001-09-03 23:37:39 +00:00
|
|
|
cmp_a = (* func) (GTK_TREE_MODEL (tree_store), iter, &tmp_iter, data);
|
2001-04-01 05:52:23 +00:00
|
|
|
|
2001-04-01 06:02:09 +00:00
|
|
|
while ((node->next) && (cmp_a > 0))
|
2001-04-01 05:52:23 +00:00
|
|
|
{
|
2001-04-01 06:02:09 +00:00
|
|
|
prev = node;
|
|
|
|
node = node->next;
|
2001-04-01 05:52:23 +00:00
|
|
|
new_location++;
|
2001-04-01 06:02:09 +00:00
|
|
|
tmp_iter.user_data = node;
|
2001-08-23 18:33:37 +00:00
|
|
|
if (tree_store->order == GTK_SORT_DESCENDING)
|
2001-09-03 23:37:39 +00:00
|
|
|
cmp_a = (* func) (GTK_TREE_MODEL (tree_store), &tmp_iter, iter, data);
|
2001-04-01 05:52:23 +00:00
|
|
|
else
|
2001-09-03 23:37:39 +00:00
|
|
|
cmp_a = (* func) (GTK_TREE_MODEL (tree_store), iter, &tmp_iter, data);
|
2001-04-01 05:52:23 +00:00
|
|
|
}
|
|
|
|
|
2001-04-01 06:02:09 +00:00
|
|
|
if ((!node->next) && (cmp_a > 0))
|
2001-04-01 05:52:23 +00:00
|
|
|
{
|
2002-03-07 21:18:28 +00:00
|
|
|
new_location++;
|
2001-04-01 06:02:09 +00:00
|
|
|
node->next = G_NODE (iter->user_data);
|
2001-06-15 23:03:27 +00:00
|
|
|
node->next->prev = node;
|
2001-04-01 05:52:23 +00:00
|
|
|
}
|
|
|
|
else if (prev)
|
|
|
|
{
|
2001-04-01 06:02:09 +00:00
|
|
|
prev->next = G_NODE (iter->user_data);
|
2001-06-15 23:03:27 +00:00
|
|
|
prev->next->prev = prev;
|
2001-04-01 06:02:09 +00:00
|
|
|
G_NODE (iter->user_data)->next = node;
|
2001-06-15 23:03:27 +00:00
|
|
|
G_NODE (iter->user_data)->next->prev = G_NODE (iter->user_data);
|
2001-04-01 05:52:23 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-06-15 23:03:27 +00:00
|
|
|
G_NODE (iter->user_data)->next = G_NODE (iter->user_data)->parent->children;
|
2002-05-16 22:17:59 +00:00
|
|
|
G_NODE (iter->user_data)->next->prev = G_NODE (iter->user_data);
|
2001-06-15 23:03:27 +00:00
|
|
|
G_NODE (iter->user_data)->parent->children = G_NODE (iter->user_data);
|
2001-04-01 05:52:23 +00:00
|
|
|
}
|
|
|
|
|
2006-01-15 20:12:49 +00:00
|
|
|
if (!emit_signal)
|
|
|
|
return;
|
|
|
|
|
2001-04-01 05:52:23 +00:00
|
|
|
/* Emit the reordered signal. */
|
2001-04-01 06:02:09 +00:00
|
|
|
length = g_node_n_children (node->parent);
|
|
|
|
new_order = g_new (int, length);
|
2001-04-01 05:52:23 +00:00
|
|
|
if (old_location < new_location)
|
2001-04-01 06:02:09 +00:00
|
|
|
for (i = 0; i < length; i++)
|
2001-04-01 05:52:23 +00:00
|
|
|
{
|
|
|
|
if (i < old_location ||
|
|
|
|
i > new_location)
|
|
|
|
new_order[i] = i;
|
|
|
|
else if (i >= old_location &&
|
|
|
|
i < new_location)
|
|
|
|
new_order[i] = i + 1;
|
|
|
|
else if (i == new_location)
|
|
|
|
new_order[i] = old_location;
|
|
|
|
}
|
|
|
|
else
|
2001-04-01 06:02:09 +00:00
|
|
|
for (i = 0; i < length; i++)
|
2001-04-01 05:52:23 +00:00
|
|
|
{
|
|
|
|
if (i < new_location ||
|
|
|
|
i > old_location)
|
|
|
|
new_order[i] = i;
|
|
|
|
else if (i > new_location &&
|
|
|
|
i <= old_location)
|
|
|
|
new_order[i] = i - 1;
|
|
|
|
else if (i == new_location)
|
|
|
|
new_order[i] = old_location;
|
|
|
|
}
|
|
|
|
|
2001-06-15 23:03:27 +00:00
|
|
|
tmp_iter.user_data = node->parent;
|
|
|
|
tmp_path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), &tmp_iter);
|
2001-04-01 05:52:23 +00:00
|
|
|
|
2001-09-12 23:16:18 +00:00
|
|
|
gtk_tree_model_rows_reordered (GTK_TREE_MODEL (tree_store),
|
|
|
|
tmp_path, &tmp_iter,
|
|
|
|
new_order);
|
2001-04-01 05:52:23 +00:00
|
|
|
|
|
|
|
gtk_tree_path_free (tmp_path);
|
|
|
|
g_free (new_order);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2001-03-23 00:35:19 +00:00
|
|
|
gtk_tree_store_get_sort_column_id (GtkTreeSortable *sortable,
|
|
|
|
gint *sort_column_id,
|
2001-08-23 18:33:37 +00:00
|
|
|
GtkSortType *order)
|
2001-03-23 00:35:19 +00:00
|
|
|
{
|
2001-04-01 05:52:23 +00:00
|
|
|
GtkTreeStore *tree_store = (GtkTreeStore *) sortable;
|
|
|
|
|
|
|
|
if (sort_column_id)
|
|
|
|
* sort_column_id = tree_store->sort_column_id;
|
|
|
|
if (order)
|
|
|
|
* order = tree_store->order;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2004-11-30 21:45:26 +00:00
|
|
|
if (tree_store->sort_column_id == GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID ||
|
|
|
|
tree_store->sort_column_id == GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
2001-03-23 00:35:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tree_store_set_sort_column_id (GtkTreeSortable *sortable,
|
|
|
|
gint sort_column_id,
|
2001-08-23 18:33:37 +00:00
|
|
|
GtkSortType order)
|
2001-03-23 00:35:19 +00:00
|
|
|
{
|
2001-04-01 05:52:23 +00:00
|
|
|
GtkTreeStore *tree_store = (GtkTreeStore *) sortable;
|
|
|
|
|
2001-09-03 23:37:39 +00:00
|
|
|
|
2001-04-01 05:52:23 +00:00
|
|
|
if ((tree_store->sort_column_id == sort_column_id) &&
|
|
|
|
(tree_store->order == order))
|
|
|
|
return;
|
|
|
|
|
2004-09-05 05:06:05 +00:00
|
|
|
if (sort_column_id != GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID)
|
2001-09-03 23:37:39 +00:00
|
|
|
{
|
2004-09-05 05:06:05 +00:00
|
|
|
if (sort_column_id != GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID)
|
|
|
|
{
|
|
|
|
GtkTreeDataSortHeader *header = NULL;
|
2001-09-03 23:37:39 +00:00
|
|
|
|
2005-12-29 05:26:09 +00:00
|
|
|
header = _gtk_tree_data_list_get_header (tree_store->sort_list,
|
|
|
|
sort_column_id);
|
2001-09-03 23:37:39 +00:00
|
|
|
|
2004-09-05 05:06:05 +00:00
|
|
|
/* We want to make sure that we have a function */
|
|
|
|
g_return_if_fail (header != NULL);
|
|
|
|
g_return_if_fail (header->func != NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree_store->default_sort_func != NULL);
|
|
|
|
}
|
2001-09-03 23:37:39 +00:00
|
|
|
}
|
|
|
|
|
2001-04-01 05:52:23 +00:00
|
|
|
tree_store->sort_column_id = sort_column_id;
|
|
|
|
tree_store->order = order;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-04-01 05:52:23 +00:00
|
|
|
gtk_tree_sortable_sort_column_changed (sortable);
|
2003-01-27 21:41:06 +00:00
|
|
|
|
|
|
|
gtk_tree_store_sort (tree_store);
|
2001-03-23 00:35:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-06-15 23:03:27 +00:00
|
|
|
gtk_tree_store_set_sort_func (GtkTreeSortable *sortable,
|
|
|
|
gint sort_column_id,
|
|
|
|
GtkTreeIterCompareFunc func,
|
|
|
|
gpointer data,
|
2008-06-18 09:12:32 +00:00
|
|
|
GDestroyNotify destroy)
|
2001-03-23 00:35:19 +00:00
|
|
|
{
|
2001-04-01 05:52:23 +00:00
|
|
|
GtkTreeStore *tree_store = (GtkTreeStore *) sortable;
|
|
|
|
|
2005-12-29 05:26:09 +00:00
|
|
|
tree_store->sort_list = _gtk_tree_data_list_set_header (tree_store->sort_list,
|
|
|
|
sort_column_id,
|
|
|
|
func, data, destroy);
|
2003-01-27 21:41:06 +00:00
|
|
|
|
|
|
|
if (tree_store->sort_column_id == sort_column_id)
|
|
|
|
gtk_tree_store_sort (tree_store);
|
2001-03-23 00:35:19 +00:00
|
|
|
}
|
|
|
|
|
2001-09-03 23:37:39 +00:00
|
|
|
static void
|
|
|
|
gtk_tree_store_set_default_sort_func (GtkTreeSortable *sortable,
|
|
|
|
GtkTreeIterCompareFunc func,
|
|
|
|
gpointer data,
|
2008-06-18 09:12:32 +00:00
|
|
|
GDestroyNotify destroy)
|
2001-09-03 23:37:39 +00:00
|
|
|
{
|
|
|
|
GtkTreeStore *tree_store = (GtkTreeStore *) sortable;
|
|
|
|
|
|
|
|
if (tree_store->default_sort_destroy)
|
2002-03-03 05:41:28 +00:00
|
|
|
{
|
2008-06-18 09:12:32 +00:00
|
|
|
GDestroyNotify d = tree_store->default_sort_destroy;
|
2002-03-03 05:41:28 +00:00
|
|
|
|
|
|
|
tree_store->default_sort_destroy = NULL;
|
|
|
|
d (tree_store->default_sort_data);
|
|
|
|
}
|
2001-09-03 23:37:39 +00:00
|
|
|
|
|
|
|
tree_store->default_sort_func = func;
|
|
|
|
tree_store->default_sort_data = data;
|
|
|
|
tree_store->default_sort_destroy = destroy;
|
2003-01-27 21:41:06 +00:00
|
|
|
|
|
|
|
if (tree_store->sort_column_id == GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID)
|
|
|
|
gtk_tree_store_sort (tree_store);
|
2001-09-03 23:37:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_tree_store_has_default_sort_func (GtkTreeSortable *sortable)
|
|
|
|
{
|
|
|
|
GtkTreeStore *tree_store = (GtkTreeStore *) sortable;
|
|
|
|
|
|
|
|
return (tree_store->default_sort_func != NULL);
|
|
|
|
}
|
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
static void
|
|
|
|
validate_gnode (GNode* node)
|
|
|
|
{
|
|
|
|
GNode *iter;
|
2001-03-23 00:35:19 +00:00
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
iter = node->children;
|
|
|
|
while (iter != NULL)
|
|
|
|
{
|
|
|
|
g_assert (iter->parent == node);
|
|
|
|
if (iter->prev)
|
|
|
|
g_assert (iter->prev->next == iter);
|
|
|
|
validate_gnode (iter);
|
|
|
|
iter = iter->next;
|
|
|
|
}
|
|
|
|
}
|
2005-03-20 07:01:23 +00:00
|
|
|
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
/* GtkBuildable custom tag implementation
|
|
|
|
*
|
|
|
|
* <columns>
|
|
|
|
* <column type="..."/>
|
|
|
|
* <column type="..."/>
|
|
|
|
* </columns>
|
|
|
|
*/
|
|
|
|
typedef struct {
|
2007-11-19 05:47:36 +00:00
|
|
|
GtkBuilder *builder;
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
GObject *object;
|
|
|
|
GSList *items;
|
|
|
|
} GSListSubParserData;
|
|
|
|
|
|
|
|
static void
|
|
|
|
tree_model_start_element (GMarkupParseContext *context,
|
|
|
|
const gchar *element_name,
|
|
|
|
const gchar **names,
|
|
|
|
const gchar **values,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
GSListSubParserData *data = (GSListSubParserData*)user_data;
|
|
|
|
|
|
|
|
for (i = 0; names[i]; i++)
|
|
|
|
{
|
|
|
|
if (strcmp (names[i], "type") == 0)
|
|
|
|
data->items = g_slist_prepend (data->items, g_strdup (values[i]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-19 05:47:36 +00:00
|
|
|
static void
|
|
|
|
tree_model_end_element (GMarkupParseContext *context,
|
|
|
|
const gchar *element_name,
|
|
|
|
gpointer user_data,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
GSListSubParserData *data = (GSListSubParserData*)user_data;
|
|
|
|
|
|
|
|
g_assert(data->builder);
|
|
|
|
|
|
|
|
if (strcmp (element_name, "columns") == 0)
|
|
|
|
{
|
|
|
|
GSList *l;
|
|
|
|
GType *types;
|
|
|
|
int i;
|
|
|
|
GType type;
|
|
|
|
|
|
|
|
data = (GSListSubParserData*)user_data;
|
|
|
|
data->items = g_slist_reverse (data->items);
|
|
|
|
types = g_new0 (GType, g_slist_length (data->items));
|
|
|
|
|
|
|
|
for (l = data->items, i = 0; l; l = l->next, i++)
|
|
|
|
{
|
|
|
|
type = gtk_builder_get_type_from_name (data->builder, l->data);
|
|
|
|
if (type == G_TYPE_INVALID)
|
|
|
|
{
|
|
|
|
g_warning ("Unknown type %s specified in treemodel %s",
|
|
|
|
(const gchar*)l->data,
|
|
|
|
gtk_buildable_get_name (GTK_BUILDABLE (data->object)));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
types[i] = type;
|
|
|
|
|
|
|
|
g_free (l->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_store_set_column_types (GTK_TREE_STORE (data->object), i, types);
|
|
|
|
|
|
|
|
g_free (types);
|
|
|
|
}
|
|
|
|
else if (strcmp (element_name, "column") == 0)
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
static const GMarkupParser tree_model_parser =
|
|
|
|
{
|
2007-11-19 05:47:36 +00:00
|
|
|
tree_model_start_element,
|
|
|
|
tree_model_end_element
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_tree_store_buildable_custom_tag_start (GtkBuildable *buildable,
|
|
|
|
GtkBuilder *builder,
|
|
|
|
GObject *child,
|
|
|
|
const gchar *tagname,
|
|
|
|
GMarkupParser *parser,
|
|
|
|
gpointer *data)
|
|
|
|
{
|
|
|
|
GSListSubParserData *parser_data;
|
|
|
|
|
|
|
|
if (child)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (strcmp (tagname, "columns") == 0)
|
|
|
|
{
|
|
|
|
parser_data = g_slice_new0 (GSListSubParserData);
|
2007-11-19 05:47:36 +00:00
|
|
|
parser_data->builder = builder;
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
parser_data->items = NULL;
|
|
|
|
parser_data->object = G_OBJECT (buildable);
|
|
|
|
|
|
|
|
*parser = tree_model_parser;
|
|
|
|
*data = parser_data;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tree_store_buildable_custom_finished (GtkBuildable *buildable,
|
|
|
|
GtkBuilder *builder,
|
|
|
|
GObject *child,
|
|
|
|
const gchar *tagname,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GSListSubParserData *data;
|
|
|
|
|
|
|
|
if (strcmp (tagname, "columns"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
data = (GSListSubParserData*)user_data;
|
|
|
|
|
|
|
|
g_slist_free (data->items);
|
|
|
|
g_slice_free (GSListSubParserData, data);
|
|
|
|
}
|
|
|
|
|
2005-03-20 07:01:23 +00:00
|
|
|
#define __GTK_TREE_STORE_C__
|
|
|
|
#include "gtkaliasdef.c"
|