2000-10-05 01:04:57 +00:00
|
|
|
|
/* gtktreemodel.c
|
|
|
|
|
* Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
|
|
|
|
|
*
|
|
|
|
|
* 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
|
2012-02-27 13:01:10 +00:00
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2000-10-05 01:04:57 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
2000-10-05 01:04:57 +00:00
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
2001-02-17 00:16:08 +00:00
|
|
|
|
#include <glib.h>
|
2002-12-15 01:49:01 +00:00
|
|
|
|
#include <glib/gprintf.h>
|
2001-02-17 00:16:08 +00:00
|
|
|
|
#include <gobject/gvaluecollector.h>
|
2000-10-05 01:04:57 +00:00
|
|
|
|
#include "gtktreemodel.h"
|
2001-02-28 21:37:50 +00:00
|
|
|
|
#include "gtktreeview.h"
|
|
|
|
|
#include "gtktreeprivate.h"
|
2001-11-17 23:28:51 +00:00
|
|
|
|
#include "gtkmarshalers.h"
|
2005-09-01 05:11:46 +00:00
|
|
|
|
#include "gtkintl.h"
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2011-01-12 23:48:20 +00:00
|
|
|
|
/**
|
|
|
|
|
* SECTION:gtktreemodel
|
|
|
|
|
* @Title: GtkTreeModel
|
|
|
|
|
* @Short_description: The tree interface used by GtkTreeView
|
|
|
|
|
* @See_also: #GtkTreeView, #GtkTreeStore, #GtkListStore,
|
2014-02-07 02:07:03 +00:00
|
|
|
|
* [GtkTreeView drag-and-drop][gtk3-GtkTreeView-drag-and-drop]
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* #GtkTreeSortable
|
|
|
|
|
*
|
|
|
|
|
* The #GtkTreeModel interface defines a generic tree interface for
|
|
|
|
|
* use by the #GtkTreeView widget. It is an abstract interface, and
|
|
|
|
|
* is designed to be usable with any appropriate data structure. The
|
|
|
|
|
* programmer just has to implement this interface on their own data
|
|
|
|
|
* type for it to be viewable by a #GtkTreeView widget.
|
|
|
|
|
*
|
|
|
|
|
* The model is represented as a hierarchical tree of strongly-typed,
|
|
|
|
|
* columned data. In other words, the model can be seen as a tree where
|
|
|
|
|
* every node has different values depending on which column is being
|
|
|
|
|
* queried. The type of data found in a column is determined by using
|
|
|
|
|
* the GType system (ie. #G_TYPE_INT, #GTK_TYPE_BUTTON, #G_TYPE_POINTER,
|
|
|
|
|
* etc). The types are homogeneous per column across all nodes. It is
|
|
|
|
|
* important to note that this interface only provides a way of examining
|
|
|
|
|
* a model and observing changes. The implementation of each individual
|
|
|
|
|
* model decides how and if changes are made.
|
|
|
|
|
*
|
|
|
|
|
* In order to make life simpler for programmers who do not need to
|
|
|
|
|
* write their own specialized model, two generic models are provided
|
|
|
|
|
* — the #GtkTreeStore and the #GtkListStore. To use these, the
|
|
|
|
|
* developer simply pushes data into these models as necessary. These
|
|
|
|
|
* models provide the data structure as well as all appropriate tree
|
|
|
|
|
* interfaces. As a result, implementing drag and drop, sorting, and
|
|
|
|
|
* storing data is trivial. For the vast majority of trees and lists,
|
|
|
|
|
* these two models are sufficient.
|
|
|
|
|
*
|
|
|
|
|
* Models are accessed on a node/column level of granularity. One can
|
|
|
|
|
* query for the value of a model at a certain node and a certain
|
2014-02-04 22:42:22 +00:00
|
|
|
|
* column on that node. There are two structures used to reference a
|
|
|
|
|
* particular node in a model. They are the #GtkTreePath-struct and
|
|
|
|
|
* the #GtkTreeIter-struct (“iter” is short for iterator). Most of the
|
|
|
|
|
* interface consists of operations on a #GtkTreeIter-struct.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* A path is essentially a potential node. It is a location on a model
|
|
|
|
|
* that may or may not actually correspond to a node on a specific
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* model. The #GtkTreePath-struct can be converted into either an
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* array of unsigned integers or a string. The string form is a list
|
|
|
|
|
* of numbers separated by a colon. Each number refers to the offset
|
2014-02-04 22:42:22 +00:00
|
|
|
|
* at that level. Thus, the path `0` refers to the root
|
|
|
|
|
* node and the path `2:4` refers to the fifth child of
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* the third node.
|
|
|
|
|
*
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* By contrast, a #GtkTreeIter-struct is a reference to a specific node on
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* a specific model. It is a generic struct with an integer and three
|
|
|
|
|
* generic pointers. These are filled in by the model in a model-specific
|
|
|
|
|
* way. One can convert a path to an iterator by calling
|
|
|
|
|
* gtk_tree_model_get_iter(). These iterators are the primary way
|
|
|
|
|
* of accessing a model and are similar to the iterators used by
|
|
|
|
|
* #GtkTextBuffer. They are generally statically allocated on the
|
|
|
|
|
* stack and only used for a short time. The model interface defines
|
|
|
|
|
* a set of operations using them for navigating the model.
|
|
|
|
|
*
|
|
|
|
|
* It is expected that models fill in the iterator with private data.
|
|
|
|
|
* For example, the #GtkListStore model, which is internally a simple
|
|
|
|
|
* linked list, stores a list node in one of the pointers. The
|
|
|
|
|
* #GtkTreeModelSort stores an array and an offset in two of the
|
|
|
|
|
* pointers. Additionally, there is an integer field. This field is
|
|
|
|
|
* generally filled with a unique stamp per model. This stamp is for
|
|
|
|
|
* catching errors resulting from using invalid iterators with a model.
|
|
|
|
|
*
|
|
|
|
|
* The lifecycle of an iterator can be a little confusing at first.
|
|
|
|
|
* Iterators are expected to always be valid for as long as the model
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* is unchanged (and doesn’t emit a signal). The model is considered
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* to own all outstanding iterators and nothing needs to be done to
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* free them from the user’s point of view. Additionally, some models
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* guarantee that an iterator is valid for as long as the node it refers
|
|
|
|
|
* to is valid (most notably the #GtkTreeStore and #GtkListStore).
|
|
|
|
|
* Although generally uninteresting, as one always has to allow for
|
|
|
|
|
* the case where iterators do not persist beyond a signal, some very
|
|
|
|
|
* important performance enhancements were made in the sort model.
|
|
|
|
|
* As a result, the #GTK_TREE_MODEL_ITERS_PERSIST flag was added to
|
|
|
|
|
* indicate this behavior.
|
|
|
|
|
*
|
|
|
|
|
* To help show some common operation of a model, some examples are
|
|
|
|
|
* provided. The first example shows three ways of getting the iter at
|
2014-02-04 22:42:22 +00:00
|
|
|
|
* the location `3:2:5`. While the first method shown is
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* easier, the second is much more common, as you often get paths from
|
|
|
|
|
* callbacks.
|
|
|
|
|
*
|
2014-02-04 21:57:57 +00:00
|
|
|
|
* ## Acquiring a #GtkTreeIter-struct
|
|
|
|
|
*
|
2014-01-27 19:55:18 +00:00
|
|
|
|
* |[<!-- language="C" -->
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* /* Three ways of getting the iter pointing to the location */
|
|
|
|
|
* GtkTreePath *path;
|
|
|
|
|
* GtkTreeIter iter;
|
|
|
|
|
* GtkTreeIter parent_iter;
|
|
|
|
|
*
|
|
|
|
|
* /* get the iterator from a string */
|
2014-01-27 20:42:15 +00:00
|
|
|
|
* gtk_tree_model_get_iter_from_string (model, &iter, "3:2:5");
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* /* get the iterator from a path */
|
|
|
|
|
* path = gtk_tree_path_new_from_string ("3:2:5");
|
2014-01-27 20:42:15 +00:00
|
|
|
|
* gtk_tree_model_get_iter (model, &iter, path);
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* gtk_tree_path_free (path);
|
|
|
|
|
*
|
|
|
|
|
* /* walk the tree to find the iterator */
|
2014-01-27 20:42:15 +00:00
|
|
|
|
* gtk_tree_model_iter_nth_child (model, &iter, NULL, 3);
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* parent_iter = iter;
|
2014-01-27 20:42:15 +00:00
|
|
|
|
* gtk_tree_model_iter_nth_child (model, &iter, &parent_iter, 2);
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* parent_iter = iter;
|
2014-01-27 20:42:15 +00:00
|
|
|
|
* gtk_tree_model_iter_nth_child (model, &iter, &parent_iter, 5);
|
2014-01-27 17:12:55 +00:00
|
|
|
|
* ]|
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* This second example shows a quick way of iterating through a list
|
|
|
|
|
* and getting a string and an integer from each row. The
|
2014-01-28 04:08:08 +00:00
|
|
|
|
* populate_model() function used below is not
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* shown, as it is specific to the #GtkListStore. For information on
|
|
|
|
|
* how to write such a function, see the #GtkListStore documentation.
|
|
|
|
|
*
|
2014-02-04 21:57:57 +00:00
|
|
|
|
* ## Reading data from a #GtkTreeModel
|
|
|
|
|
*
|
2014-01-27 19:55:18 +00:00
|
|
|
|
* |[<!-- language="C" -->
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* enum
|
|
|
|
|
* {
|
|
|
|
|
* STRING_COLUMN,
|
|
|
|
|
* INT_COLUMN,
|
|
|
|
|
* N_COLUMNS
|
|
|
|
|
* };
|
|
|
|
|
*
|
|
|
|
|
* ...
|
|
|
|
|
*
|
|
|
|
|
* GtkTreeModel *list_store;
|
|
|
|
|
* GtkTreeIter iter;
|
|
|
|
|
* gboolean valid;
|
|
|
|
|
* gint row_count = 0;
|
|
|
|
|
*
|
|
|
|
|
* /* make a new list_store */
|
|
|
|
|
* list_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
|
|
|
|
|
*
|
|
|
|
|
* /* Fill the list store with data */
|
|
|
|
|
* populate_model (list_store);
|
|
|
|
|
*
|
2012-11-22 17:38:41 +00:00
|
|
|
|
* /* Get the first iter in the list, check it is valid and walk
|
|
|
|
|
* * through the list, reading each row. */
|
2014-01-27 20:42:15 +00:00
|
|
|
|
* for (valid = gtk_tree_model_get_iter_first (list_store, &iter);
|
2012-11-22 17:38:41 +00:00
|
|
|
|
* valid;
|
2014-01-27 20:42:15 +00:00
|
|
|
|
* valid = gtk_tree_model_iter_next (list_store, &iter))
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* {
|
|
|
|
|
* gchar *str_data;
|
|
|
|
|
* gint int_data;
|
|
|
|
|
*
|
|
|
|
|
* /* Make sure you terminate calls to gtk_tree_model_get()
|
2014-02-07 19:03:49 +00:00
|
|
|
|
* * with a “-1” value
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* */
|
2014-01-27 20:42:15 +00:00
|
|
|
|
* gtk_tree_model_get (list_store, &iter,
|
|
|
|
|
* STRING_COLUMN, &str_data,
|
|
|
|
|
* INT_COLUMN, &int_data,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* -1);
|
|
|
|
|
*
|
|
|
|
|
* /* Do something with the data */
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* g_print ("Row %d: (%s,%d)\n", row_count, str_data, int_data);
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* g_free (str_data);
|
|
|
|
|
*
|
|
|
|
|
* row_count++;
|
|
|
|
|
* }
|
2014-01-27 17:12:55 +00:00
|
|
|
|
* ]|
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
2011-08-11 08:42:29 +00:00
|
|
|
|
* The #GtkTreeModel interface contains two methods for reference
|
|
|
|
|
* counting: gtk_tree_model_ref_node() and gtk_tree_model_unref_node().
|
|
|
|
|
* These two methods are optional to implement. The reference counting
|
|
|
|
|
* is meant as a way for views to let models know when nodes are being
|
|
|
|
|
* displayed. #GtkTreeView will take a reference on a node when it is
|
|
|
|
|
* visible, which means the node is either in the toplevel or expanded.
|
|
|
|
|
* Being displayed does not mean that the node is currently directly
|
|
|
|
|
* visible to the user in the viewport. Based on this reference counting
|
|
|
|
|
* scheme a caching model, for example, can decide whether or not to cache
|
|
|
|
|
* a node based on the reference count. A file-system based model would
|
|
|
|
|
* not want to keep the entire file hierarchy in memory, but just the
|
|
|
|
|
* folders that are currently expanded in every current view.
|
|
|
|
|
*
|
|
|
|
|
* When working with reference counting, the following rules must be taken
|
|
|
|
|
* into account:
|
2014-02-02 06:07:39 +00:00
|
|
|
|
*
|
|
|
|
|
* - Never take a reference on a node without owning a reference on its parent.
|
|
|
|
|
* This means that all parent nodes of a referenced node must be referenced
|
|
|
|
|
* as well.
|
|
|
|
|
*
|
|
|
|
|
* - Outstanding references on a deleted node are not released. This is not
|
|
|
|
|
* possible because the node has already been deleted by the time the
|
|
|
|
|
* row-deleted signal is received.
|
|
|
|
|
*
|
|
|
|
|
* - Models are not obligated to emit a signal on rows of which none of its
|
|
|
|
|
* siblings are referenced. To phrase this differently, signals are only
|
|
|
|
|
* required for levels in which nodes are referenced. For the root level
|
|
|
|
|
* however, signals must be emitted at all times (however the root level
|
|
|
|
|
* is always referenced when any view is attached).
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2002-05-10 21:59:20 +00:00
|
|
|
|
#define INITIALIZE_TREE_ITER(Iter) \
|
|
|
|
|
G_STMT_START{ \
|
|
|
|
|
(Iter)->stamp = 0; \
|
|
|
|
|
(Iter)->user_data = NULL; \
|
|
|
|
|
(Iter)->user_data2 = NULL; \
|
|
|
|
|
(Iter)->user_data3 = NULL; \
|
|
|
|
|
}G_STMT_END
|
|
|
|
|
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
#define ROW_REF_DATA_STRING "gtk-tree-row-refs"
|
2002-05-10 21:59:20 +00:00
|
|
|
|
|
Another feature to create truly ugly TreeViews!: style properties for the
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties
for the even/odd colors used for row hinting. (#71595, reported
by Owen Taylor).
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
and odd_row_color style properties.
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
(gtk_default_draw_flat_box): rework cell coloring code to support
user-provided even/odd row colors.
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
Cache signal IDs to speed up signal emission. This is a good speedup
because GtkTreeModel emits a big number of signals.
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
by g_signal_new,
(gtk_tree_model_row_changed): use g_signal_emit instead of
g_signal_emit_by_name,
(gtk_tree_model_row_inserted): ditto,
(gtk_tree_model_row_has_child_toggled): ditto,
(gtk_tree_model_row_deleted): ditto,
(gtk_tree_model_rows_reordered): ditto.
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeselection.c (model_changed): new function,
(gtk_tree_selection_selected_foreach): monitor changes in the model,
bail out if the model has been changed from the foreach func.
(#50263, reported by Havoc Pennington).
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
free anchor if applicable (#94868, reported and testcase provided by
Daniel Elstner).
2002-10-22 23:05:29 +00:00
|
|
|
|
enum {
|
|
|
|
|
ROW_CHANGED,
|
|
|
|
|
ROW_INSERTED,
|
|
|
|
|
ROW_HAS_CHILD_TOGGLED,
|
|
|
|
|
ROW_DELETED,
|
|
|
|
|
ROWS_REORDERED,
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static guint tree_model_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
struct _GtkTreePath
|
|
|
|
|
{
|
2011-06-01 02:10:58 +00:00
|
|
|
|
gint depth; /* Number of elements */
|
|
|
|
|
gint alloc; /* Number of allocated elements */
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gint *indices;
|
|
|
|
|
};
|
|
|
|
|
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
GSList *list;
|
|
|
|
|
} RowRefList;
|
2001-02-21 19:59:23 +00:00
|
|
|
|
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
static void gtk_tree_model_base_init (gpointer g_class);
|
|
|
|
|
|
|
|
|
|
/* custom closures */
|
|
|
|
|
static void row_inserted_marshal (GClosure *closure,
|
|
|
|
|
GValue /* out */ *return_value,
|
|
|
|
|
guint n_param_value,
|
|
|
|
|
const GValue *param_values,
|
|
|
|
|
gpointer invocation_hint,
|
|
|
|
|
gpointer marshal_data);
|
|
|
|
|
static void row_deleted_marshal (GClosure *closure,
|
|
|
|
|
GValue /* out */ *return_value,
|
|
|
|
|
guint n_param_value,
|
|
|
|
|
const GValue *param_values,
|
|
|
|
|
gpointer invocation_hint,
|
|
|
|
|
gpointer marshal_data);
|
|
|
|
|
static void rows_reordered_marshal (GClosure *closure,
|
|
|
|
|
GValue /* out */ *return_value,
|
|
|
|
|
guint n_param_value,
|
|
|
|
|
const GValue *param_values,
|
|
|
|
|
gpointer invocation_hint,
|
|
|
|
|
gpointer marshal_data);
|
|
|
|
|
|
|
|
|
|
static void gtk_tree_row_ref_inserted (RowRefList *refs,
|
|
|
|
|
GtkTreePath *path,
|
|
|
|
|
GtkTreeIter *iter);
|
|
|
|
|
static void gtk_tree_row_ref_deleted (RowRefList *refs,
|
|
|
|
|
GtkTreePath *path);
|
|
|
|
|
static void gtk_tree_row_ref_reordered (RowRefList *refs,
|
|
|
|
|
GtkTreePath *path,
|
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
gint *new_order);
|
2001-02-21 19:59:23 +00:00
|
|
|
|
|
2002-10-07 19:10:39 +00:00
|
|
|
|
GType
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gtk_tree_model_get_type (void)
|
|
|
|
|
{
|
2002-10-07 19:10:39 +00:00
|
|
|
|
static GType tree_model_type = 0;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2001-03-23 00:35:19 +00:00
|
|
|
|
if (! tree_model_type)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2006-10-03 15:54:52 +00:00
|
|
|
|
const GTypeInfo tree_model_info =
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2000-10-16 23:11:55 +00:00
|
|
|
|
sizeof (GtkTreeModelIface), /* class_size */
|
2011-01-12 23:48:20 +00:00
|
|
|
|
gtk_tree_model_base_init, /* base_init */
|
|
|
|
|
NULL, /* base_finalize */
|
|
|
|
|
NULL,
|
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
|
NULL, /* class_data */
|
|
|
|
|
0,
|
|
|
|
|
0, /* n_preallocs */
|
|
|
|
|
NULL
|
2000-10-05 01:04:57 +00:00
|
|
|
|
};
|
|
|
|
|
|
2002-10-07 19:10:39 +00:00
|
|
|
|
tree_model_type =
|
2011-01-12 23:48:20 +00:00
|
|
|
|
g_type_register_static (G_TYPE_INTERFACE, I_("GtkTreeModel"),
|
|
|
|
|
&tree_model_info, 0);
|
2002-10-07 19:10:39 +00:00
|
|
|
|
|
2001-03-08 21:36:34 +00:00
|
|
|
|
g_type_interface_add_prerequisite (tree_model_type, G_TYPE_OBJECT);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return tree_model_type;
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-21 19:59:23 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_tree_model_base_init (gpointer g_class)
|
|
|
|
|
{
|
2001-03-23 00:35:19 +00:00
|
|
|
|
static gboolean initialized = FALSE;
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
GClosure *closure;
|
2001-02-21 23:49:22 +00:00
|
|
|
|
|
2001-03-23 00:35:19 +00:00
|
|
|
|
if (! initialized)
|
2001-02-21 19:59:23 +00:00
|
|
|
|
{
|
2004-02-07 00:21:37 +00:00
|
|
|
|
GType row_inserted_params[2];
|
|
|
|
|
GType row_deleted_params[1];
|
|
|
|
|
GType rows_reordered_params[3];
|
|
|
|
|
|
2006-01-23 22:16:41 +00:00
|
|
|
|
row_inserted_params[0] = GTK_TYPE_TREE_PATH | G_SIGNAL_TYPE_STATIC_SCOPE;
|
2004-02-07 00:21:37 +00:00
|
|
|
|
row_inserted_params[1] = GTK_TYPE_TREE_ITER;
|
|
|
|
|
|
2006-01-23 22:16:41 +00:00
|
|
|
|
row_deleted_params[0] = GTK_TYPE_TREE_PATH | G_SIGNAL_TYPE_STATIC_SCOPE;
|
2004-02-07 00:21:37 +00:00
|
|
|
|
|
2006-01-23 22:16:41 +00:00
|
|
|
|
rows_reordered_params[0] = GTK_TYPE_TREE_PATH | G_SIGNAL_TYPE_STATIC_SCOPE;
|
2004-02-07 00:21:37 +00:00
|
|
|
|
rows_reordered_params[1] = GTK_TYPE_TREE_ITER;
|
|
|
|
|
rows_reordered_params[2] = G_TYPE_POINTER;
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
|
2006-05-01 02:05:20 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkTreeModel::row-changed:
|
|
|
|
|
* @tree_model: the #GtkTreeModel on which the signal is emitted
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct identifying the changed row
|
|
|
|
|
* @iter: a valid #GtkTreeIter-struct pointing to the changed row
|
2006-05-01 02:05:20 +00:00
|
|
|
|
*
|
2006-05-04 12:17:12 +00:00
|
|
|
|
* This signal is emitted when a row in the model has changed.
|
2006-05-01 02:05:20 +00:00
|
|
|
|
*/
|
Another feature to create truly ugly TreeViews!: style properties for the
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties
for the even/odd colors used for row hinting. (#71595, reported
by Owen Taylor).
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
and odd_row_color style properties.
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
(gtk_default_draw_flat_box): rework cell coloring code to support
user-provided even/odd row colors.
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
Cache signal IDs to speed up signal emission. This is a good speedup
because GtkTreeModel emits a big number of signals.
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
by g_signal_new,
(gtk_tree_model_row_changed): use g_signal_emit instead of
g_signal_emit_by_name,
(gtk_tree_model_row_inserted): ditto,
(gtk_tree_model_row_has_child_toggled): ditto,
(gtk_tree_model_row_deleted): ditto,
(gtk_tree_model_rows_reordered): ditto.
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeselection.c (model_changed): new function,
(gtk_tree_selection_selected_foreach): monitor changes in the model,
bail out if the model has been changed from the foreach func.
(#50263, reported by Havoc Pennington).
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
free anchor if applicable (#94868, reported and testcase provided by
Daniel Elstner).
2002-10-22 23:05:29 +00:00
|
|
|
|
tree_model_signals[ROW_CHANGED] =
|
2008-08-08 13:53:05 +00:00
|
|
|
|
g_signal_new (I_("row-changed"),
|
Another feature to create truly ugly TreeViews!: style properties for the
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties
for the even/odd colors used for row hinting. (#71595, reported
by Owen Taylor).
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
and odd_row_color style properties.
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
(gtk_default_draw_flat_box): rework cell coloring code to support
user-provided even/odd row colors.
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
Cache signal IDs to speed up signal emission. This is a good speedup
because GtkTreeModel emits a big number of signals.
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
by g_signal_new,
(gtk_tree_model_row_changed): use g_signal_emit instead of
g_signal_emit_by_name,
(gtk_tree_model_row_inserted): ditto,
(gtk_tree_model_row_has_child_toggled): ditto,
(gtk_tree_model_row_deleted): ditto,
(gtk_tree_model_rows_reordered): ditto.
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeselection.c (model_changed): new function,
(gtk_tree_selection_selected_foreach): monitor changes in the model,
bail out if the model has been changed from the foreach func.
(#50263, reported by Havoc Pennington).
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
free anchor if applicable (#94868, reported and testcase provided by
Daniel Elstner).
2002-10-22 23:05:29 +00:00
|
|
|
|
GTK_TYPE_TREE_MODEL,
|
2006-05-01 02:05:20 +00:00
|
|
|
|
G_SIGNAL_RUN_LAST,
|
Another feature to create truly ugly TreeViews!: style properties for the
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties
for the even/odd colors used for row hinting. (#71595, reported
by Owen Taylor).
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
and odd_row_color style properties.
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
(gtk_default_draw_flat_box): rework cell coloring code to support
user-provided even/odd row colors.
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
Cache signal IDs to speed up signal emission. This is a good speedup
because GtkTreeModel emits a big number of signals.
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
by g_signal_new,
(gtk_tree_model_row_changed): use g_signal_emit instead of
g_signal_emit_by_name,
(gtk_tree_model_row_inserted): ditto,
(gtk_tree_model_row_has_child_toggled): ditto,
(gtk_tree_model_row_deleted): ditto,
(gtk_tree_model_rows_reordered): ditto.
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeselection.c (model_changed): new function,
(gtk_tree_selection_selected_foreach): monitor changes in the model,
bail out if the model has been changed from the foreach func.
(#50263, reported by Havoc Pennington).
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
free anchor if applicable (#94868, reported and testcase provided by
Daniel Elstner).
2002-10-22 23:05:29 +00:00
|
|
|
|
G_STRUCT_OFFSET (GtkTreeModelIface, row_changed),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
_gtk_marshal_VOID__BOXED_BOXED,
|
|
|
|
|
G_TYPE_NONE, 2,
|
2006-01-23 22:16:41 +00:00
|
|
|
|
GTK_TYPE_TREE_PATH | G_SIGNAL_TYPE_STATIC_SCOPE,
|
Another feature to create truly ugly TreeViews!: style properties for the
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties
for the even/odd colors used for row hinting. (#71595, reported
by Owen Taylor).
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
and odd_row_color style properties.
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
(gtk_default_draw_flat_box): rework cell coloring code to support
user-provided even/odd row colors.
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
Cache signal IDs to speed up signal emission. This is a good speedup
because GtkTreeModel emits a big number of signals.
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
by g_signal_new,
(gtk_tree_model_row_changed): use g_signal_emit instead of
g_signal_emit_by_name,
(gtk_tree_model_row_inserted): ditto,
(gtk_tree_model_row_has_child_toggled): ditto,
(gtk_tree_model_row_deleted): ditto,
(gtk_tree_model_rows_reordered): ditto.
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeselection.c (model_changed): new function,
(gtk_tree_selection_selected_foreach): monitor changes in the model,
bail out if the model has been changed from the foreach func.
(#50263, reported by Havoc Pennington).
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
free anchor if applicable (#94868, reported and testcase provided by
Daniel Elstner).
2002-10-22 23:05:29 +00:00
|
|
|
|
GTK_TYPE_TREE_ITER);
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
|
2004-03-05 16:40:12 +00:00
|
|
|
|
/* We need to get notification about structure changes
|
|
|
|
|
* to update row references., so instead of using the
|
|
|
|
|
* standard g_signal_new() with an offset into our interface
|
|
|
|
|
* structure, we use a customs closures for the class
|
|
|
|
|
* closures (default handlers) that first update row references
|
|
|
|
|
* and then calls the function from the interface structure.
|
|
|
|
|
*
|
|
|
|
|
* The reason we don't simply update the row references from
|
|
|
|
|
* the wrapper functions (gtk_tree_model_row_inserted(), etc.)
|
|
|
|
|
* is to keep proper ordering with respect to signal handlers
|
|
|
|
|
* connected normally and after.
|
|
|
|
|
*/
|
2006-05-01 02:05:20 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkTreeModel::row-inserted:
|
|
|
|
|
* @tree_model: the #GtkTreeModel on which the signal is emitted
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct identifying the new row
|
|
|
|
|
* @iter: a valid #GtkTreeIter-struct pointing to the new row
|
2006-05-01 02:05:20 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* This signal is emitted when a new row has been inserted in
|
|
|
|
|
* the model.
|
2006-05-01 02:05:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Note that the row may still be empty at this point, since
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* it is a common pattern to first insert an empty row, and
|
2006-05-01 02:05:20 +00:00
|
|
|
|
* then fill it with the desired values.
|
|
|
|
|
*/
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
closure = g_closure_new_simple (sizeof (GClosure), NULL);
|
|
|
|
|
g_closure_set_marshal (closure, row_inserted_marshal);
|
Another feature to create truly ugly TreeViews!: style properties for the
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties
for the even/odd colors used for row hinting. (#71595, reported
by Owen Taylor).
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
and odd_row_color style properties.
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
(gtk_default_draw_flat_box): rework cell coloring code to support
user-provided even/odd row colors.
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
Cache signal IDs to speed up signal emission. This is a good speedup
because GtkTreeModel emits a big number of signals.
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
by g_signal_new,
(gtk_tree_model_row_changed): use g_signal_emit instead of
g_signal_emit_by_name,
(gtk_tree_model_row_inserted): ditto,
(gtk_tree_model_row_has_child_toggled): ditto,
(gtk_tree_model_row_deleted): ditto,
(gtk_tree_model_rows_reordered): ditto.
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeselection.c (model_changed): new function,
(gtk_tree_selection_selected_foreach): monitor changes in the model,
bail out if the model has been changed from the foreach func.
(#50263, reported by Havoc Pennington).
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
free anchor if applicable (#94868, reported and testcase provided by
Daniel Elstner).
2002-10-22 23:05:29 +00:00
|
|
|
|
tree_model_signals[ROW_INSERTED] =
|
2008-08-08 13:53:05 +00:00
|
|
|
|
g_signal_newv (I_("row-inserted"),
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
GTK_TYPE_TREE_MODEL,
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
closure,
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
_gtk_marshal_VOID__BOXED_BOXED,
|
|
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
|
row_inserted_params);
|
|
|
|
|
|
2006-05-01 02:05:20 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkTreeModel::row-has-child-toggled:
|
|
|
|
|
* @tree_model: the #GtkTreeModel on which the signal is emitted
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct identifying the row
|
|
|
|
|
* @iter: a valid #GtkTreeIter-struct pointing to the row
|
2006-05-01 02:05:20 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* This signal is emitted when a row has gotten the first child
|
|
|
|
|
* row or lost its last child row.
|
2006-05-01 02:05:20 +00:00
|
|
|
|
*/
|
Another feature to create truly ugly TreeViews!: style properties for the
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties
for the even/odd colors used for row hinting. (#71595, reported
by Owen Taylor).
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
and odd_row_color style properties.
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
(gtk_default_draw_flat_box): rework cell coloring code to support
user-provided even/odd row colors.
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
Cache signal IDs to speed up signal emission. This is a good speedup
because GtkTreeModel emits a big number of signals.
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
by g_signal_new,
(gtk_tree_model_row_changed): use g_signal_emit instead of
g_signal_emit_by_name,
(gtk_tree_model_row_inserted): ditto,
(gtk_tree_model_row_has_child_toggled): ditto,
(gtk_tree_model_row_deleted): ditto,
(gtk_tree_model_rows_reordered): ditto.
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeselection.c (model_changed): new function,
(gtk_tree_selection_selected_foreach): monitor changes in the model,
bail out if the model has been changed from the foreach func.
(#50263, reported by Havoc Pennington).
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
free anchor if applicable (#94868, reported and testcase provided by
Daniel Elstner).
2002-10-22 23:05:29 +00:00
|
|
|
|
tree_model_signals[ROW_HAS_CHILD_TOGGLED] =
|
2008-08-08 13:53:05 +00:00
|
|
|
|
g_signal_new (I_("row-has-child-toggled"),
|
Another feature to create truly ugly TreeViews!: style properties for the
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties
for the even/odd colors used for row hinting. (#71595, reported
by Owen Taylor).
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
and odd_row_color style properties.
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
(gtk_default_draw_flat_box): rework cell coloring code to support
user-provided even/odd row colors.
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
Cache signal IDs to speed up signal emission. This is a good speedup
because GtkTreeModel emits a big number of signals.
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
by g_signal_new,
(gtk_tree_model_row_changed): use g_signal_emit instead of
g_signal_emit_by_name,
(gtk_tree_model_row_inserted): ditto,
(gtk_tree_model_row_has_child_toggled): ditto,
(gtk_tree_model_row_deleted): ditto,
(gtk_tree_model_rows_reordered): ditto.
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeselection.c (model_changed): new function,
(gtk_tree_selection_selected_foreach): monitor changes in the model,
bail out if the model has been changed from the foreach func.
(#50263, reported by Havoc Pennington).
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
free anchor if applicable (#94868, reported and testcase provided by
Daniel Elstner).
2002-10-22 23:05:29 +00:00
|
|
|
|
GTK_TYPE_TREE_MODEL,
|
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
|
G_STRUCT_OFFSET (GtkTreeModelIface, row_has_child_toggled),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
_gtk_marshal_VOID__BOXED_BOXED,
|
|
|
|
|
G_TYPE_NONE, 2,
|
2006-01-23 22:16:41 +00:00
|
|
|
|
GTK_TYPE_TREE_PATH | G_SIGNAL_TYPE_STATIC_SCOPE,
|
Another feature to create truly ugly TreeViews!: style properties for the
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties
for the even/odd colors used for row hinting. (#71595, reported
by Owen Taylor).
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
and odd_row_color style properties.
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
(gtk_default_draw_flat_box): rework cell coloring code to support
user-provided even/odd row colors.
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
Cache signal IDs to speed up signal emission. This is a good speedup
because GtkTreeModel emits a big number of signals.
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
by g_signal_new,
(gtk_tree_model_row_changed): use g_signal_emit instead of
g_signal_emit_by_name,
(gtk_tree_model_row_inserted): ditto,
(gtk_tree_model_row_has_child_toggled): ditto,
(gtk_tree_model_row_deleted): ditto,
(gtk_tree_model_rows_reordered): ditto.
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeselection.c (model_changed): new function,
(gtk_tree_selection_selected_foreach): monitor changes in the model,
bail out if the model has been changed from the foreach func.
(#50263, reported by Havoc Pennington).
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
free anchor if applicable (#94868, reported and testcase provided by
Daniel Elstner).
2002-10-22 23:05:29 +00:00
|
|
|
|
GTK_TYPE_TREE_ITER);
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
|
2006-05-01 02:05:20 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkTreeModel::row-deleted:
|
|
|
|
|
* @tree_model: the #GtkTreeModel on which the signal is emitted
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct identifying the row
|
2006-05-01 02:05:20 +00:00
|
|
|
|
*
|
2006-05-04 12:17:12 +00:00
|
|
|
|
* This signal is emitted when a row has been deleted.
|
2006-05-01 02:05:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Note that no iterator is passed to the signal handler,
|
|
|
|
|
* since the row is already deleted.
|
2006-08-16 20:52:23 +00:00
|
|
|
|
*
|
2011-03-09 06:06:45 +00:00
|
|
|
|
* This should be called by models after a row has been removed.
|
|
|
|
|
* The location pointed to by @path should be the location that
|
|
|
|
|
* the row previously was at. It may not be a valid location anymore.
|
2006-05-01 02:05:20 +00:00
|
|
|
|
*/
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
closure = g_closure_new_simple (sizeof (GClosure), NULL);
|
|
|
|
|
g_closure_set_marshal (closure, row_deleted_marshal);
|
Another feature to create truly ugly TreeViews!: style properties for the
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties
for the even/odd colors used for row hinting. (#71595, reported
by Owen Taylor).
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
and odd_row_color style properties.
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
(gtk_default_draw_flat_box): rework cell coloring code to support
user-provided even/odd row colors.
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
Cache signal IDs to speed up signal emission. This is a good speedup
because GtkTreeModel emits a big number of signals.
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
by g_signal_new,
(gtk_tree_model_row_changed): use g_signal_emit instead of
g_signal_emit_by_name,
(gtk_tree_model_row_inserted): ditto,
(gtk_tree_model_row_has_child_toggled): ditto,
(gtk_tree_model_row_deleted): ditto,
(gtk_tree_model_rows_reordered): ditto.
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeselection.c (model_changed): new function,
(gtk_tree_selection_selected_foreach): monitor changes in the model,
bail out if the model has been changed from the foreach func.
(#50263, reported by Havoc Pennington).
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
free anchor if applicable (#94868, reported and testcase provided by
Daniel Elstner).
2002-10-22 23:05:29 +00:00
|
|
|
|
tree_model_signals[ROW_DELETED] =
|
2008-08-08 13:53:05 +00:00
|
|
|
|
g_signal_newv (I_("row-deleted"),
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
GTK_TYPE_TREE_MODEL,
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
closure,
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
_gtk_marshal_VOID__BOXED,
|
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
row_deleted_params);
|
|
|
|
|
|
2006-05-01 02:05:20 +00:00
|
|
|
|
/**
|
2011-01-18 05:37:11 +00:00
|
|
|
|
* GtkTreeModel::rows-reordered: (skip)
|
2006-05-01 02:05:20 +00:00
|
|
|
|
* @tree_model: the #GtkTreeModel on which the signal is emitted
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct identifying the tree node whose children
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* have been reordered
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: a valid #GtkTreeIter-struct pointing to the node whose children
|
2014-01-22 06:21:27 +00:00
|
|
|
|
* have been reordered, or %NULL if the depth of @path is 0
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @new_order: an array of integers mapping the current position
|
|
|
|
|
* of each child to its old position before the re-ordering,
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* i.e. @new_order`[newpos] = oldpos`
|
2006-05-01 02:05:20 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* This signal is emitted when the children of a node in the
|
|
|
|
|
* #GtkTreeModel have been reordered.
|
2006-05-01 02:05:20 +00:00
|
|
|
|
*
|
2014-01-28 06:54:48 +00:00
|
|
|
|
* Note that this signal is not emitted
|
2006-05-01 02:05:20 +00:00
|
|
|
|
* when rows are reordered by DND, since this is implemented
|
|
|
|
|
* by removing and then reinserting the row.
|
|
|
|
|
*/
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
closure = g_closure_new_simple (sizeof (GClosure), NULL);
|
|
|
|
|
g_closure_set_marshal (closure, rows_reordered_marshal);
|
Another feature to create truly ugly TreeViews!: style properties for the
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties
for the even/odd colors used for row hinting. (#71595, reported
by Owen Taylor).
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
and odd_row_color style properties.
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
(gtk_default_draw_flat_box): rework cell coloring code to support
user-provided even/odd row colors.
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
Cache signal IDs to speed up signal emission. This is a good speedup
because GtkTreeModel emits a big number of signals.
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
by g_signal_new,
(gtk_tree_model_row_changed): use g_signal_emit instead of
g_signal_emit_by_name,
(gtk_tree_model_row_inserted): ditto,
(gtk_tree_model_row_has_child_toggled): ditto,
(gtk_tree_model_row_deleted): ditto,
(gtk_tree_model_rows_reordered): ditto.
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeselection.c (model_changed): new function,
(gtk_tree_selection_selected_foreach): monitor changes in the model,
bail out if the model has been changed from the foreach func.
(#50263, reported by Havoc Pennington).
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
free anchor if applicable (#94868, reported and testcase provided by
Daniel Elstner).
2002-10-22 23:05:29 +00:00
|
|
|
|
tree_model_signals[ROWS_REORDERED] =
|
2008-08-08 13:53:05 +00:00
|
|
|
|
g_signal_newv (I_("rows-reordered"),
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
GTK_TYPE_TREE_MODEL,
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
closure,
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
_gtk_marshal_VOID__BOXED_BOXED_POINTER,
|
|
|
|
|
G_TYPE_NONE, 3,
|
|
|
|
|
rows_reordered_params);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
initialized = TRUE;
|
2001-02-21 19:59:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
static void
|
|
|
|
|
row_inserted_marshal (GClosure *closure,
|
|
|
|
|
GValue /* out */ *return_value,
|
|
|
|
|
guint n_param_values,
|
|
|
|
|
const GValue *param_values,
|
|
|
|
|
gpointer invocation_hint,
|
|
|
|
|
gpointer marshal_data)
|
|
|
|
|
{
|
|
|
|
|
GtkTreeModelIface *iface;
|
2003-12-17 17:52:47 +00:00
|
|
|
|
|
|
|
|
|
void (* row_inserted_callback) (GtkTreeModel *tree_model,
|
|
|
|
|
GtkTreePath *path,
|
2004-10-28 15:00:05 +00:00
|
|
|
|
GtkTreeIter *iter) = NULL;
|
2011-01-12 23:48:20 +00:00
|
|
|
|
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
GObject *model = g_value_get_object (param_values + 0);
|
2003-12-17 17:52:47 +00:00
|
|
|
|
GtkTreePath *path = (GtkTreePath *)g_value_get_boxed (param_values + 1);
|
|
|
|
|
GtkTreeIter *iter = (GtkTreeIter *)g_value_get_boxed (param_values + 2);
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
|
|
|
|
|
/* first, we need to update internal row references */
|
|
|
|
|
gtk_tree_row_ref_inserted ((RowRefList *)g_object_get_data (model, ROW_REF_DATA_STRING),
|
2003-12-17 17:52:47 +00:00
|
|
|
|
path, iter);
|
2011-01-12 23:48:20 +00:00
|
|
|
|
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
/* fetch the interface ->row_inserted implementation */
|
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (model);
|
2003-12-17 17:52:47 +00:00
|
|
|
|
row_inserted_callback = G_STRUCT_MEMBER (gpointer, iface,
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
G_STRUCT_OFFSET (GtkTreeModelIface,
|
|
|
|
|
row_inserted));
|
2003-12-17 17:52:47 +00:00
|
|
|
|
|
2011-01-12 23:48:20 +00:00
|
|
|
|
/* Call that default signal handler, it if has been set */
|
2003-12-17 17:52:47 +00:00
|
|
|
|
if (row_inserted_callback)
|
|
|
|
|
row_inserted_callback (GTK_TREE_MODEL (model), path, iter);
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
row_deleted_marshal (GClosure *closure,
|
|
|
|
|
GValue /* out */ *return_value,
|
|
|
|
|
guint n_param_values,
|
|
|
|
|
const GValue *param_values,
|
|
|
|
|
gpointer invocation_hint,
|
|
|
|
|
gpointer marshal_data)
|
|
|
|
|
{
|
|
|
|
|
GtkTreeModelIface *iface;
|
2003-12-17 17:52:47 +00:00
|
|
|
|
void (* row_deleted_callback) (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreePath *path) = NULL;
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
GObject *model = g_value_get_object (param_values + 0);
|
2003-12-17 17:52:47 +00:00
|
|
|
|
GtkTreePath *path = (GtkTreePath *)g_value_get_boxed (param_values + 1);
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
|
|
|
|
|
/* first, we need to update internal row references */
|
|
|
|
|
gtk_tree_row_ref_deleted ((RowRefList *)g_object_get_data (model, ROW_REF_DATA_STRING),
|
2003-12-17 17:52:47 +00:00
|
|
|
|
path);
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
|
2003-12-17 17:52:47 +00:00
|
|
|
|
/* fetch the interface ->row_deleted implementation */
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (model);
|
2003-12-17 17:52:47 +00:00
|
|
|
|
row_deleted_callback = G_STRUCT_MEMBER (gpointer, iface,
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
G_STRUCT_OFFSET (GtkTreeModelIface,
|
|
|
|
|
row_deleted));
|
2011-01-12 23:48:20 +00:00
|
|
|
|
|
2003-12-17 17:52:47 +00:00
|
|
|
|
/* Call that default signal handler, it if has been set */
|
|
|
|
|
if (row_deleted_callback)
|
|
|
|
|
row_deleted_callback (GTK_TREE_MODEL (model), path);
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
rows_reordered_marshal (GClosure *closure,
|
|
|
|
|
GValue /* out */ *return_value,
|
|
|
|
|
guint n_param_values,
|
|
|
|
|
const GValue *param_values,
|
|
|
|
|
gpointer invocation_hint,
|
|
|
|
|
gpointer marshal_data)
|
|
|
|
|
{
|
|
|
|
|
GtkTreeModelIface *iface;
|
2003-12-17 17:52:47 +00:00
|
|
|
|
void (* rows_reordered_callback) (GtkTreeModel *tree_model,
|
|
|
|
|
GtkTreePath *path,
|
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
gint *new_order);
|
2011-01-12 23:48:20 +00:00
|
|
|
|
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
GObject *model = g_value_get_object (param_values + 0);
|
2003-12-17 17:52:47 +00:00
|
|
|
|
GtkTreePath *path = (GtkTreePath *)g_value_get_boxed (param_values + 1);
|
|
|
|
|
GtkTreeIter *iter = (GtkTreeIter *)g_value_get_boxed (param_values + 2);
|
|
|
|
|
gint *new_order = (gint *)g_value_get_pointer (param_values + 3);
|
2011-01-12 23:48:20 +00:00
|
|
|
|
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
/* first, we need to update internal row references */
|
|
|
|
|
gtk_tree_row_ref_reordered ((RowRefList *)g_object_get_data (model, ROW_REF_DATA_STRING),
|
2003-12-17 17:52:47 +00:00
|
|
|
|
path, iter, new_order);
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
|
2003-12-17 17:52:47 +00:00
|
|
|
|
/* fetch the interface ->rows_reordered implementation */
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (model);
|
2003-12-17 17:52:47 +00:00
|
|
|
|
rows_reordered_callback = G_STRUCT_MEMBER (gpointer, iface,
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
G_STRUCT_OFFSET (GtkTreeModelIface,
|
|
|
|
|
rows_reordered));
|
2003-12-17 17:52:47 +00:00
|
|
|
|
|
|
|
|
|
/* Call that default signal handler, it if has been set */
|
|
|
|
|
if (rows_reordered_callback)
|
|
|
|
|
rows_reordered_callback (GTK_TREE_MODEL (model), path, iter, new_order);
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_new:
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* Creates a new #GtkTreePath-struct.
|
|
|
|
|
* This refers to a row.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* Return value: A newly created #GtkTreePath-struct.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
GtkTreePath *
|
|
|
|
|
gtk_tree_path_new (void)
|
|
|
|
|
{
|
|
|
|
|
GtkTreePath *retval;
|
2007-12-31 11:26:55 +00:00
|
|
|
|
retval = g_slice_new (GtkTreePath);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
retval->depth = 0;
|
2011-06-01 02:10:58 +00:00
|
|
|
|
retval->alloc = 0;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
retval->indices = NULL;
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_new_from_string:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @path: The string representation of a path
|
|
|
|
|
*
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* Creates a new #GtkTreePath-struct initialized to @path.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @path is expected to be a colon separated list of numbers.
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* For example, the string “10:4:0” would create a path of depth
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* 3 pointing to the 11th child of the root node, the 5th
|
|
|
|
|
* child of that 11th child, and the 1st child of that 5th child.
|
|
|
|
|
* If an invalid path string is passed in, %NULL is returned.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* Return value: A newly-created #GtkTreePath-struct, or %NULL
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
GtkTreePath *
|
2001-08-17 16:33:04 +00:00
|
|
|
|
gtk_tree_path_new_from_string (const gchar *path)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
|
|
|
|
GtkTreePath *retval;
|
2001-08-17 16:33:04 +00:00
|
|
|
|
const gchar *orig_path = path;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gchar *ptr;
|
|
|
|
|
gint i;
|
|
|
|
|
|
2001-05-16 18:16:57 +00:00
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (*path != '\000', NULL);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
retval = gtk_tree_path_new ();
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
i = strtol (path, &ptr, 10);
|
2001-05-16 18:16:57 +00:00
|
|
|
|
if (i < 0)
|
2011-01-12 23:48:20 +00:00
|
|
|
|
{
|
|
|
|
|
g_warning (G_STRLOC ": Negative numbers in path %s passed to gtk_tree_path_new_from_string", orig_path);
|
|
|
|
|
gtk_tree_path_free (retval);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2005-06-08 20:25:21 +00:00
|
|
|
|
|
|
|
|
|
gtk_tree_path_append_index (retval, i);
|
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
if (*ptr == '\000')
|
2011-01-12 23:48:20 +00:00
|
|
|
|
break;
|
2001-05-16 18:16:57 +00:00
|
|
|
|
if (ptr == path || *ptr != ':')
|
2011-01-12 23:48:20 +00:00
|
|
|
|
{
|
|
|
|
|
g_warning (G_STRLOC ": Invalid path %s passed to gtk_tree_path_new_from_string", orig_path);
|
|
|
|
|
gtk_tree_path_free (retval);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
path = ptr + 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
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_new_from_indices:
|
2002-08-07 22:23:18 +00:00
|
|
|
|
* @first_index: first integer
|
2011-09-26 00:58:59 +00:00
|
|
|
|
* @...: list of integers terminated by -1
|
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
|
|
|
|
*
|
|
|
|
|
* Creates a new path with @first_index and @varargs as indices.
|
|
|
|
|
*
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* Return value: A newly created #GtkTreePath-struct
|
2002-11-28 00:33:17 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.2
|
2011-01-12 23:48:20 +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
|
|
|
|
GtkTreePath *
|
|
|
|
|
gtk_tree_path_new_from_indices (gint first_index,
|
2011-01-12 23:48:20 +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
|
|
|
|
{
|
|
|
|
|
int arg;
|
|
|
|
|
va_list args;
|
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
|
|
|
|
|
path = gtk_tree_path_new ();
|
|
|
|
|
|
|
|
|
|
va_start (args, first_index);
|
|
|
|
|
arg = first_index;
|
|
|
|
|
|
|
|
|
|
while (arg != -1)
|
|
|
|
|
{
|
|
|
|
|
gtk_tree_path_append_index (path, arg);
|
|
|
|
|
arg = va_arg (args, gint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
va_end (args);
|
|
|
|
|
|
|
|
|
|
return path;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-16 10:59:30 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_new_from_indicesv: (rename-to gtk_tree_path_new_from_indices)
|
|
|
|
|
* @indices: (array length=length): array of indices
|
|
|
|
|
* @length: length of @indices array
|
|
|
|
|
*
|
|
|
|
|
* Creates a new path with the given @indices array of @length.
|
|
|
|
|
*
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* Return value: A newly created #GtkTreePath-struct
|
2013-08-16 10:59:30 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 3.12
|
|
|
|
|
*/
|
|
|
|
|
GtkTreePath *
|
|
|
|
|
gtk_tree_path_new_from_indicesv (gint *indices,
|
|
|
|
|
gsize length)
|
|
|
|
|
{
|
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (indices != NULL && length != 0, NULL);
|
|
|
|
|
|
|
|
|
|
path = gtk_tree_path_new ();
|
|
|
|
|
path->alloc = length;
|
|
|
|
|
path->depth = length;
|
|
|
|
|
path->indices = g_new (gint, length);
|
|
|
|
|
memcpy (path->indices, indices, length * sizeof (gint));
|
|
|
|
|
|
|
|
|
|
return path;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_to_string:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: A #GtkTreePath-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Generates a string representation of the path.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2014-02-07 19:03:49 +00:00
|
|
|
|
* This string is a “:” separated list of numbers.
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* For example, “4:10:0:3” would be an acceptable
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* return value for this string.
|
|
|
|
|
*
|
|
|
|
|
* Return value: A newly-allocated string.
|
|
|
|
|
* Must be freed with g_free().
|
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gchar *
|
|
|
|
|
gtk_tree_path_to_string (GtkTreePath *path)
|
|
|
|
|
{
|
2007-01-08 14:49:30 +00:00
|
|
|
|
gchar *retval, *ptr, *end;
|
|
|
|
|
gint i, n;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2001-05-16 18:16:57 +00:00
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
if (path->depth == 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2007-01-08 14:49:30 +00:00
|
|
|
|
n = path->depth * 12;
|
|
|
|
|
ptr = retval = g_new0 (gchar, n);
|
|
|
|
|
end = ptr + n;
|
|
|
|
|
g_snprintf (retval, end - ptr, "%d", path->indices[0]);
|
2011-01-12 23:48:20 +00:00
|
|
|
|
while (*ptr != '\000')
|
2000-10-05 01:04:57 +00:00
|
|
|
|
ptr++;
|
|
|
|
|
|
|
|
|
|
for (i = 1; i < path->depth; i++)
|
|
|
|
|
{
|
2007-01-08 14:49:30 +00:00
|
|
|
|
g_snprintf (ptr, end - ptr, ":%d", path->indices[i]);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
while (*ptr != '\000')
|
2011-01-12 23:48:20 +00:00
|
|
|
|
ptr++;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
2002-02-24 03:43:08 +00:00
|
|
|
|
* gtk_tree_path_new_first:
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* Creates a new #GtkTreePath-struct.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* The string representation of this path is “0”.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* Return value: A new #GtkTreePath-struct
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
GtkTreePath *
|
2002-02-24 03:43:08 +00:00
|
|
|
|
gtk_tree_path_new_first (void)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
|
|
|
|
GtkTreePath *retval;
|
|
|
|
|
|
|
|
|
|
retval = gtk_tree_path_new ();
|
|
|
|
|
gtk_tree_path_append_index (retval, 0);
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_append_index:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @index_: the index
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Appends a new index to a path.
|
|
|
|
|
*
|
|
|
|
|
* As a result, the depth of the path is increased.
|
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_path_append_index (GtkTreePath *path,
|
2011-06-01 02:10:58 +00:00
|
|
|
|
gint index_)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2000-10-17 22:21:01 +00:00
|
|
|
|
g_return_if_fail (path != NULL);
|
2011-06-01 02:10:58 +00:00
|
|
|
|
g_return_if_fail (index_ >= 0);
|
|
|
|
|
|
|
|
|
|
if (path->depth == path->alloc)
|
|
|
|
|
{
|
|
|
|
|
gint *indices;
|
|
|
|
|
path->alloc = MAX (path->alloc * 2, 1);
|
|
|
|
|
indices = g_new (gint, path->alloc);
|
|
|
|
|
memcpy (indices, path->indices, path->depth * sizeof (gint));
|
|
|
|
|
g_free (path->indices);
|
|
|
|
|
path->indices = indices;
|
|
|
|
|
}
|
2000-10-17 22:21:01 +00:00
|
|
|
|
|
2001-02-13 05:44:47 +00:00
|
|
|
|
path->depth += 1;
|
2011-06-01 02:10:58 +00:00
|
|
|
|
path->indices[path->depth - 1] = index_;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_prepend_index:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @index_: the index
|
|
|
|
|
*
|
|
|
|
|
* Prepends a new index to a path.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* As a result, the depth of the path is increased.
|
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_path_prepend_index (GtkTreePath *path,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
gint index)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2011-06-01 02:10:58 +00:00
|
|
|
|
if (path->depth == path->alloc)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2011-06-01 02:10:58 +00:00
|
|
|
|
gint *indices;
|
|
|
|
|
path->alloc = MAX (path->alloc * 2, 1);
|
|
|
|
|
indices = g_new (gint, path->alloc);
|
|
|
|
|
memcpy (indices + 1, path->indices, path->depth * sizeof (gint));
|
|
|
|
|
g_free (path->indices);
|
|
|
|
|
path->indices = indices;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
2011-06-01 02:10:58 +00:00
|
|
|
|
else if (path->depth > 0)
|
|
|
|
|
memmove (path->indices + 1, path->indices, path->depth * sizeof (gint));
|
|
|
|
|
|
|
|
|
|
path->depth += 1;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
path->indices[0] = index;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_get_depth:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2000-10-17 22:21:01 +00:00
|
|
|
|
* Returns the current depth of @path.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2000-10-17 22:21:01 +00:00
|
|
|
|
* Return value: The depth of @path
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gint
|
|
|
|
|
gtk_tree_path_get_depth (GtkTreePath *path)
|
|
|
|
|
{
|
2000-10-17 22:21:01 +00:00
|
|
|
|
g_return_val_if_fail (path != NULL, 0);
|
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
return path->depth;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
2011-01-18 05:37:11 +00:00
|
|
|
|
* gtk_tree_path_get_indices: (skip)
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct
|
2010-06-28 18:15:10 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Returns the current indices of @path.
|
2010-06-28 18:15:10 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* This is an array of integers, each representing a node in a tree.
|
|
|
|
|
* This value should not be freed.
|
|
|
|
|
*
|
2011-06-01 02:10:58 +00:00
|
|
|
|
* The length of the array can be obtained with gtk_tree_path_get_depth().
|
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: The current indices, or %NULL
|
|
|
|
|
*/
|
2010-06-28 18:15:10 +00:00
|
|
|
|
gint *
|
|
|
|
|
gtk_tree_path_get_indices (GtkTreePath *path)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
return path->indices;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2013-10-09 18:09:35 +00:00
|
|
|
|
* gtk_tree_path_get_indices_with_depth: (rename-to gtk_tree_path_get_indices)
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct
|
2013-09-05 00:08:41 +00:00
|
|
|
|
* @depth: (out) (allow-none): return location for number of elements
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* returned in the integer array, or %NULL
|
2010-04-27 21:12:41 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns the current indices of @path.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
2010-04-27 21:12:41 +00:00
|
|
|
|
* This is an array of integers, each representing a node in a tree.
|
|
|
|
|
* It also returns the number of elements in the array.
|
|
|
|
|
* The array should not be freed.
|
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: (array length=depth) (transfer none): The current
|
|
|
|
|
* indices, or %NULL
|
2010-04-27 21:12:41 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2010-04-27 21:12:41 +00:00
|
|
|
|
gint *
|
2011-01-12 23:48:20 +00:00
|
|
|
|
gtk_tree_path_get_indices_with_depth (GtkTreePath *path,
|
|
|
|
|
gint *depth)
|
2010-04-27 21:12:41 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
if (depth)
|
|
|
|
|
*depth = path->depth;
|
|
|
|
|
|
|
|
|
|
return path->indices;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_free:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: (allow-none): a #GtkTreePath-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-10-19 18:47:50 +00:00
|
|
|
|
* Frees @path. If @path is %NULL, it simply returns.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_path_free (GtkTreePath *path)
|
|
|
|
|
{
|
2003-07-11 19:00:25 +00:00
|
|
|
|
if (!path)
|
|
|
|
|
return;
|
2000-11-13 19:23:24 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
g_free (path->indices);
|
2007-12-31 11:26:55 +00:00
|
|
|
|
g_slice_free (GtkTreePath, path);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_copy:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* Creates a new #GtkTreePath-struct as a copy of @path.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* Return value: a new #GtkTreePath-struct
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
GtkTreePath *
|
2002-03-25 04:10:49 +00:00
|
|
|
|
gtk_tree_path_copy (const GtkTreePath *path)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
|
|
|
|
GtkTreePath *retval;
|
|
|
|
|
|
2000-11-13 19:23:24 +00:00
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
|
2007-12-31 11:26:55 +00:00
|
|
|
|
retval = g_slice_new (GtkTreePath);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
retval->depth = path->depth;
|
2011-06-01 02:10:58 +00:00
|
|
|
|
retval->alloc = retval->depth;
|
|
|
|
|
retval->indices = g_new (gint, path->alloc);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
memcpy (retval->indices, path->indices, path->depth * sizeof (gint));
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-27 11:31:23 +00:00
|
|
|
|
G_DEFINE_BOXED_TYPE (GtkTreePath, gtk_tree_path,
|
|
|
|
|
gtk_tree_path_copy,
|
|
|
|
|
gtk_tree_path_free)
|
2002-03-02 19:11:47 +00:00
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_compare:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @a: a #GtkTreePath-struct
|
|
|
|
|
* @b: a #GtkTreePath-struct to compare with
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Compares two paths.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* If @a appears before @b in a tree, then -1 is returned.
|
|
|
|
|
* If @b appears before @a, then 1 is returned.
|
|
|
|
|
* If the two nodes are equal, then 0 is returned.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: the relative positions of @a and @b
|
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gint
|
2000-10-17 22:21:01 +00:00
|
|
|
|
gtk_tree_path_compare (const GtkTreePath *a,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
const GtkTreePath *b)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
|
|
|
|
gint p = 0, q = 0;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (a != NULL, 0);
|
|
|
|
|
g_return_val_if_fail (b != NULL, 0);
|
|
|
|
|
g_return_val_if_fail (a->depth > 0, 0);
|
|
|
|
|
g_return_val_if_fail (b->depth > 0, 0);
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (a->indices[p] == b->indices[q])
|
2011-01-12 23:48:20 +00:00
|
|
|
|
continue;
|
2001-04-23 23:03:53 +00:00
|
|
|
|
return (a->indices[p] < b->indices[q]?-1:1);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
while (++p < a->depth && ++q < b->depth);
|
|
|
|
|
if (a->depth == b->depth)
|
|
|
|
|
return 0;
|
2001-04-23 23:03:53 +00:00
|
|
|
|
return (a->depth < b->depth?-1:1);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_is_ancestor:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct
|
|
|
|
|
* @descendant: another #GtkTreePath-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
Mass fixing of trivial doc bugs. (#63544, #57007, #64141, #63472, #57108,
* gtk/gtkiconfactory.c, gtk/gtktextbuffer.c, gtk/gtktreemodel.c,
gtk/gtkwindow.c, gtk/gtknotebook.c, gtk/gtkradiobutton.c,
gtk/gtktextiter.c, gtk/gtkdialog.c: Mass fixing of trivial doc bugs.
(#63544, #57007, #64141, #63472, #57108, #60818, #61562)
* gtk/tmpl/gtkaccellabel.sgml, gtk/tmpl/gtkcombo.sgml,
gtk/tmpl/gtkentry.sgml, gtk/tmpl/gtkhscrollbar.sgml,
gtk/tmpl/gtkvscrollbar.sgml, gtk/tmpl/gtktoolbar.sgml,
gtk/tmpl/gtkdialog.sgml, gtk/tmpl/gtkstatusbar.sgml:
Mass fixing of trivial doc bugs. (#55579, #56760, #58769, #55918,
#64154, #60422, #54697)
2001-11-10 22:06:44 +00:00
|
|
|
|
* Returns %TRUE if @descendant is a descendant of @path.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2001-01-31 00:57:49 +00:00
|
|
|
|
* Return value: %TRUE if @descendant is contained inside @path
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2001-01-31 00:57:49 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_tree_path_is_ancestor (GtkTreePath *path,
|
|
|
|
|
GtkTreePath *descendant)
|
|
|
|
|
{
|
|
|
|
|
gint i;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
|
g_return_val_if_fail (path != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (descendant != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
/* can't be an ancestor if we're deeper */
|
|
|
|
|
if (path->depth >= descendant->depth)
|
|
|
|
|
return FALSE;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
|
i = 0;
|
|
|
|
|
while (i < path->depth)
|
|
|
|
|
{
|
|
|
|
|
if (path->indices[i] != descendant->indices[i])
|
|
|
|
|
return FALSE;
|
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_is_descendant:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct
|
|
|
|
|
* @ancestor: another #GtkTreePath-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
Doc typo fix. (#68172)
* gtk/gtksocket.c (gtk_socket_get_id): Doc typo fix. (#68172)
* gtk/gtktreemodel.c (gtk_tree_path_is_descendant): Fix docs.
* gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Document.
* gtk/gtkwindow.c (gtk_window_remove_accel_group): Fix docs.
* gtk/gtkrc.c (gtk_rc_get_style_by_paths),
gtk/gtkwidget.c (gtk_widget_get_toplevel,
gtk_widget_push_composite_child), gtk/gtkdialog.c
(gtk_dialog_new_with_buttons, gtk_dialog_run): Keep gtk-doc
from messing up the indentation of inline examples.
* gtk/gtkmain.c, gtk/gtkrc.c: Consistently call g_getenv()
instead of getenv().
* gtk/gtktreemodel.c, gtk/gtkaccelgroup.c, gtk/gtkclipboard.c,
gtk/gtkdnd.c, gtk/gtkiconfactory.c, gtk/gtkrc.c,
gtk/gtkstyle.c, gtk/gtkselection.c: Doc fixes.
* gtk/gtkaccelmap.c (gtk_accel_map_add_filter,
gtk_accel_map_foreach_unfiltered, gtk_accel_map_load_scanner):
Document.
* gtk/tmpl/gtksocket.sgml: Mention gtk_socket_get_id()
instead of GTK_WINDOW_XWINDOW(). (#68172)
* gtk/gtk-sections.txt: Move functions which are documented
as "private" or "internal" into Private subsections.
* gtk/tmpl/gtkdnd.sgml, gtk/tmpl/gtkobject.sgml,
gtk/tmpl/gtkrc.sgml, gtk/tmpl/gtktooltips.sgml,
gtk/tmpl/gtkwidget.sgml, gtk/tmpl/gtkclipboard.sgml,
gtk/tmpl/gtkstyle.sgml, gtk/tmpl/gtkselection.sgml,
gtk/tmpl/gtkfeatures.sgml: Minor markup fixes.
* gtk/tmpl/gtksignal.sgml: Add link to GLib signal docs.
* gtk/tmpl/gtkpreview.sgml, gtk/tmpl/gtktext.sgml,
gtk/tmpl/gtktree.sgml: Remove "deprecated" from short desc.
* gtk/tmpl/gtkrc.sgml: Correct names of default RC files.
2002-01-08 00:04:57 +00:00
|
|
|
|
* Returns %TRUE if @path is a descendant of @ancestor.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2001-01-31 00:57:49 +00:00
|
|
|
|
* Return value: %TRUE if @ancestor contains @path somewhere below it
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2001-01-31 00:57:49 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_tree_path_is_descendant (GtkTreePath *path,
|
|
|
|
|
GtkTreePath *ancestor)
|
|
|
|
|
{
|
|
|
|
|
gint i;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
|
g_return_val_if_fail (path != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (ancestor != NULL, FALSE);
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
|
/* can't be a descendant if we're shallower in the tree */
|
|
|
|
|
if (path->depth <= ancestor->depth)
|
|
|
|
|
return FALSE;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
|
i = 0;
|
|
|
|
|
while (i < ancestor->depth)
|
|
|
|
|
{
|
|
|
|
|
if (path->indices[i] != ancestor->indices[i])
|
|
|
|
|
return FALSE;
|
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_next:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2000-10-17 22:21:01 +00:00
|
|
|
|
* Moves the @path to point to the next node at the current depth.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_path_next (GtkTreePath *path)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (path != NULL);
|
2000-10-17 22:21:01 +00:00
|
|
|
|
g_return_if_fail (path->depth > 0);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
path->indices[path->depth - 1] ++;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_prev:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Moves the @path to point to the previous node at the
|
|
|
|
|
* current depth, if it exists.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: %TRUE if @path has a previous node, and
|
|
|
|
|
* the move was made
|
|
|
|
|
*/
|
Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
|
gboolean
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gtk_tree_path_prev (GtkTreePath *path)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (path != NULL, FALSE);
|
|
|
|
|
|
2004-11-15 16:22:49 +00:00
|
|
|
|
if (path->depth == 0)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
|
if (path->indices[path->depth - 1] == 0)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
2001-01-31 00:57:49 +00:00
|
|
|
|
path->indices[path->depth - 1] -= 1;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_up:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2003-04-07 00:16:43 +00:00
|
|
|
|
* Moves the @path to point to its parent node, if it has a parent.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: %TRUE if @path has a parent, and the move was made
|
|
|
|
|
*/
|
Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
|
gboolean
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gtk_tree_path_up (GtkTreePath *path)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (path != NULL, FALSE);
|
|
|
|
|
|
2001-08-24 20:09:26 +00:00
|
|
|
|
if (path->depth == 0)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
path->depth--;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_path_down:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2000-10-17 22:21:01 +00:00
|
|
|
|
* Moves @path to point to the first child of the current path.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_path_down (GtkTreePath *path)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (path != NULL);
|
|
|
|
|
|
|
|
|
|
gtk_tree_path_append_index (path, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_iter_copy:
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: a #GtkTreeIter-struct
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Creates a dynamically allocated tree iterator as a copy of @iter.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* This function is not intended for use in applications,
|
|
|
|
|
* because you can just copy the structs by value
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* (`GtkTreeIter new_iter = iter;`).
|
2008-07-28 23:29:38 +00:00
|
|
|
|
* You must free this iter with gtk_tree_iter_free().
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: a newly-allocated copy of @iter
|
|
|
|
|
*/
|
2000-11-09 16:52:17 +00:00
|
|
|
|
GtkTreeIter *
|
|
|
|
|
gtk_tree_iter_copy (GtkTreeIter *iter)
|
|
|
|
|
{
|
|
|
|
|
GtkTreeIter *retval;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (iter != NULL, NULL);
|
|
|
|
|
|
2007-05-01 22:32:57 +00:00
|
|
|
|
retval = g_slice_new (GtkTreeIter);
|
2000-11-09 16:52:17 +00:00
|
|
|
|
*retval = *iter;
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_iter_free:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @iter: a dynamically allocated tree iterator
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2008-07-28 23:29:38 +00:00
|
|
|
|
* Frees an iterator that has been allocated by gtk_tree_iter_copy().
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
2008-07-28 23:29:38 +00:00
|
|
|
|
* This function is mainly used for language bindings.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2000-11-09 16:52:17 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_iter_free (GtkTreeIter *iter)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (iter != NULL);
|
|
|
|
|
|
2007-05-01 22:32:57 +00:00
|
|
|
|
g_slice_free (GtkTreeIter, iter);
|
2000-11-09 16:52:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-04-27 11:31:23 +00:00
|
|
|
|
G_DEFINE_BOXED_TYPE (GtkTreeIter, gtk_tree_iter,
|
|
|
|
|
gtk_tree_iter_copy,
|
|
|
|
|
gtk_tree_iter_free)
|
2002-03-02 19:11:47 +00:00
|
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_get_flags:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
|
|
|
|
*
|
|
|
|
|
* Returns a set of flags supported by this interface.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* The flags are a bitwise combination of #GtkTreeModelFlags.
|
|
|
|
|
* The flags supported should not change during the lifetime
|
|
|
|
|
* of the @tree_model.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: the flags supported by this interface
|
|
|
|
|
*/
|
Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
|
GtkTreeModelFlags
|
2000-11-09 16:52:17 +00:00
|
|
|
|
gtk_tree_model_get_flags (GtkTreeModel *tree_model)
|
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), 0);
|
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
if (iface->get_flags)
|
|
|
|
|
return (* iface->get_flags) (tree_model);
|
2000-11-09 16:52:17 +00:00
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_get_n_columns:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
Doc typo fix. (#68172)
* gtk/gtksocket.c (gtk_socket_get_id): Doc typo fix. (#68172)
* gtk/gtktreemodel.c (gtk_tree_path_is_descendant): Fix docs.
* gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Document.
* gtk/gtkwindow.c (gtk_window_remove_accel_group): Fix docs.
* gtk/gtkrc.c (gtk_rc_get_style_by_paths),
gtk/gtkwidget.c (gtk_widget_get_toplevel,
gtk_widget_push_composite_child), gtk/gtkdialog.c
(gtk_dialog_new_with_buttons, gtk_dialog_run): Keep gtk-doc
from messing up the indentation of inline examples.
* gtk/gtkmain.c, gtk/gtkrc.c: Consistently call g_getenv()
instead of getenv().
* gtk/gtktreemodel.c, gtk/gtkaccelgroup.c, gtk/gtkclipboard.c,
gtk/gtkdnd.c, gtk/gtkiconfactory.c, gtk/gtkrc.c,
gtk/gtkstyle.c, gtk/gtkselection.c: Doc fixes.
* gtk/gtkaccelmap.c (gtk_accel_map_add_filter,
gtk_accel_map_foreach_unfiltered, gtk_accel_map_load_scanner):
Document.
* gtk/tmpl/gtksocket.sgml: Mention gtk_socket_get_id()
instead of GTK_WINDOW_XWINDOW(). (#68172)
* gtk/gtk-sections.txt: Move functions which are documented
as "private" or "internal" into Private subsections.
* gtk/tmpl/gtkdnd.sgml, gtk/tmpl/gtkobject.sgml,
gtk/tmpl/gtkrc.sgml, gtk/tmpl/gtktooltips.sgml,
gtk/tmpl/gtkwidget.sgml, gtk/tmpl/gtkclipboard.sgml,
gtk/tmpl/gtkstyle.sgml, gtk/tmpl/gtkselection.sgml,
gtk/tmpl/gtkfeatures.sgml: Minor markup fixes.
* gtk/tmpl/gtksignal.sgml: Add link to GLib signal docs.
* gtk/tmpl/gtkpreview.sgml, gtk/tmpl/gtktext.sgml,
gtk/tmpl/gtktree.sgml: Remove "deprecated" from short desc.
* gtk/tmpl/gtkrc.sgml: Correct names of default RC files.
2002-01-08 00:04:57 +00:00
|
|
|
|
* Returns the number of columns supported by @tree_model.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: the number of columns
|
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gint
|
|
|
|
|
gtk_tree_model_get_n_columns (GtkTreeModel *tree_model)
|
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
2000-10-27 23:34:58 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), 0);
|
2000-10-26 00:36:47 +00:00
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
g_return_val_if_fail (iface->get_n_columns != NULL, 0);
|
|
|
|
|
|
|
|
|
|
return (* iface->get_n_columns) (tree_model);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_get_column_type:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
|
|
|
|
* @index_: the column index
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2000-11-09 16:52:17 +00:00
|
|
|
|
* Returns the type of the column.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: (transfer none): the type of the column
|
|
|
|
|
*/
|
2000-11-09 16:52:17 +00:00
|
|
|
|
GType
|
|
|
|
|
gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
gint index)
|
2000-11-09 16:52:17 +00:00
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), G_TYPE_INVALID);
|
2005-05-21 01:05:14 +00:00
|
|
|
|
|
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
g_return_val_if_fail (iface->get_column_type != NULL, G_TYPE_INVALID);
|
2000-11-09 16:52:17 +00:00
|
|
|
|
g_return_val_if_fail (index >= 0, G_TYPE_INVALID);
|
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
return (* iface->get_column_type) (tree_model, index);
|
2000-11-09 16:52:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
2000-10-26 00:36:47 +00:00
|
|
|
|
* gtk_tree_model_get_iter:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: (out): the uninitialized #GtkTreeIter-struct
|
|
|
|
|
* @path: the #GtkTreePath-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-05-09 07:51:50 +00:00
|
|
|
|
* Sets @iter to a valid iterator pointing to @path. If @path does
|
2011-08-22 19:26:44 +00:00
|
|
|
|
* not exist, @iter is set to an invalid iterator and %FALSE is returned.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: %TRUE, if @iter was set
|
|
|
|
|
*/
|
2000-10-26 00:36:47 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_tree_model_get_iter (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
GtkTreePath *path)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
2001-05-22 19:18:47 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
|
2000-10-27 23:34:58 +00:00
|
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (path != NULL, FALSE);
|
2005-05-21 01:05:14 +00:00
|
|
|
|
|
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
g_return_val_if_fail (iface->get_iter != NULL, FALSE);
|
2001-07-09 17:09:35 +00:00
|
|
|
|
g_return_val_if_fail (path->depth > 0, FALSE);
|
2000-10-27 23:34:58 +00:00
|
|
|
|
|
2002-05-10 21:59:20 +00:00
|
|
|
|
INITIALIZE_TREE_ITER (iter);
|
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
return (* iface->get_iter) (tree_model, iter, path);
|
2000-10-26 00:36:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-10-10 19:21:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_get_iter_from_string:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: (out): an uninitialized #GtkTreeIter-struct
|
|
|
|
|
* @path_string: a string representation of a #GtkTreePath-struct
|
2001-10-10 19:21:41 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets @iter to a valid iterator pointing to @path_string, if it
|
|
|
|
|
* exists. Otherwise, @iter is left invalid and %FALSE is returned.
|
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: %TRUE, if @iter was set
|
|
|
|
|
*/
|
2001-10-10 19:21:41 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_tree_model_get_iter_from_string (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
const gchar *path_string)
|
2001-10-10 19:21:41 +00:00
|
|
|
|
{
|
|
|
|
|
gboolean retval;
|
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
|
|
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (path_string != NULL, FALSE);
|
2011-01-12 23:48:20 +00:00
|
|
|
|
|
2001-10-10 19:21:41 +00:00
|
|
|
|
path = gtk_tree_path_new_from_string (path_string);
|
2011-01-12 23:48:20 +00:00
|
|
|
|
|
2001-10-10 19:21:41 +00:00
|
|
|
|
g_return_val_if_fail (path != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
retval = gtk_tree_model_get_iter (tree_model, iter, path);
|
|
|
|
|
gtk_tree_path_free (path);
|
2011-01-12 23:48:20 +00:00
|
|
|
|
|
2001-10-10 19:21:41 +00:00
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-04 17:12:15 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_get_string_from_iter:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: a #GtkTreeIter-struct
|
2002-06-04 17:12:15 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Generates a string representation of the iter.
|
2002-06-04 17:12:15 +00:00
|
|
|
|
*
|
2014-02-07 19:03:49 +00:00
|
|
|
|
* This string is a “:” separated list of numbers.
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* For example, “4:10:0:3” would be an acceptable
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* return value for this string.
|
|
|
|
|
*
|
|
|
|
|
* Return value: a newly-allocated string.
|
|
|
|
|
* Must be freed with g_free().
|
2002-11-28 00:33:17 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.2
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2002-06-04 17:12:15 +00:00
|
|
|
|
gchar *
|
|
|
|
|
gtk_tree_model_get_string_from_iter (GtkTreeModel *tree_model,
|
|
|
|
|
GtkTreeIter *iter)
|
|
|
|
|
{
|
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
gchar *ret;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), NULL);
|
|
|
|
|
g_return_val_if_fail (iter != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
path = gtk_tree_model_get_path (tree_model, iter);
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
ret = gtk_tree_path_to_string (path);
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2001-05-22 19:18:47 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2002-02-24 03:43:08 +00:00
|
|
|
|
* gtk_tree_model_get_iter_first:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: (out): the uninitialized #GtkTreeIter-struct
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Initializes @iter with the first iterator in the tree
|
|
|
|
|
* (the one at the path "0") and returns %TRUE. Returns
|
|
|
|
|
* %FALSE if the tree is empty.
|
|
|
|
|
*
|
|
|
|
|
* Return value: %TRUE, if @iter was set
|
|
|
|
|
*/
|
2001-05-22 19:18:47 +00:00
|
|
|
|
gboolean
|
2002-02-24 03:43:08 +00:00
|
|
|
|
gtk_tree_model_get_iter_first (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter)
|
2001-05-22 19:18:47 +00:00
|
|
|
|
{
|
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
gboolean retval;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
|
|
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
|
|
|
|
|
2002-02-24 04:18:44 +00:00
|
|
|
|
path = gtk_tree_path_new_first ();
|
2001-05-22 19:18:47 +00:00
|
|
|
|
retval = gtk_tree_model_get_iter (tree_model, iter, path);
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_get_path:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: the #GtkTreeIter-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* Returns a newly-created #GtkTreePath-struct referenced by @iter.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* This path should be freed with gtk_tree_path_free().
|
|
|
|
|
*
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* Return value: a newly-created #GtkTreePath-struct
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
GtkTreePath *
|
|
|
|
|
gtk_tree_model_get_path (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
2000-10-27 23:34:58 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), NULL);
|
2001-07-09 17:09:35 +00:00
|
|
|
|
g_return_val_if_fail (iter != NULL, NULL);
|
2000-10-26 00:36:47 +00:00
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
g_return_val_if_fail (iface->get_path != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
return (* iface->get_path) (tree_model, iter);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
2000-10-27 23:34:58 +00:00
|
|
|
|
* gtk_tree_model_get_value:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: the #GtkTreeIter-struct
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @column: the column to lookup the value at
|
|
|
|
|
* @value: (out) (transfer none): an empty #GValue to set
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2009-01-05 04:07:00 +00:00
|
|
|
|
* Initializes and sets @value to that at @column.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* When done with @value, g_value_unset() needs to be called
|
2009-01-05 04:07:00 +00:00
|
|
|
|
* to free any allocated memory.
|
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
2000-10-27 23:34:58 +00:00
|
|
|
|
gtk_tree_model_get_value (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
gint column,
|
|
|
|
|
GValue *value)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
2000-10-27 23:34:58 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
2001-07-09 17:09:35 +00:00
|
|
|
|
g_return_if_fail (iter != NULL);
|
2000-10-27 23:34:58 +00:00
|
|
|
|
g_return_if_fail (value != NULL);
|
2000-10-26 00:36:47 +00:00
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
g_return_if_fail (iface->get_value != NULL);
|
|
|
|
|
|
|
|
|
|
(* iface->get_value) (tree_model, iter, column, value);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
2000-10-26 00:36:47 +00:00
|
|
|
|
* gtk_tree_model_iter_next:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: (in): the #GtkTreeIter-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Sets @iter to point to the node following it at the current level.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* If there is no next @iter, %FALSE is returned and @iter is set
|
|
|
|
|
* to be invalid.
|
|
|
|
|
*
|
|
|
|
|
* Return value: %TRUE if @iter has been changed to the next node
|
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gboolean
|
2000-10-26 00:36:47 +00:00
|
|
|
|
gtk_tree_model_iter_next (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
2000-10-27 23:34:58 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
|
|
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
2000-10-26 00:36:47 +00:00
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
g_return_val_if_fail (iface->iter_next != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
return (* iface->iter_next) (tree_model, iter);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-06 04:39:11 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_tree_model_iter_previous_default (GtkTreeModel *tree_model,
|
|
|
|
|
GtkTreeIter *iter)
|
|
|
|
|
{
|
|
|
|
|
gboolean retval;
|
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
|
|
|
|
|
path = gtk_tree_model_get_path (tree_model, iter);
|
|
|
|
|
if (path == NULL)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
retval = gtk_tree_path_prev (path) &&
|
|
|
|
|
gtk_tree_model_get_iter (tree_model, iter, path);
|
|
|
|
|
if (retval == FALSE)
|
|
|
|
|
iter->stamp = 0;
|
|
|
|
|
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_iter_previous:
|
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: (in): the #GtkTreeIter-struct
|
2011-01-06 04:39:11 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Sets @iter to point to the previous node at the current level.
|
|
|
|
|
*
|
|
|
|
|
* If there is no previous @iter, %FALSE is returned and @iter is
|
|
|
|
|
* set to be invalid.
|
2011-01-06 04:39:11 +00:00
|
|
|
|
*
|
|
|
|
|
* Return value: %TRUE if @iter has been changed to the previous node
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gtk_tree_model_iter_previous (GtkTreeModel *tree_model,
|
|
|
|
|
GtkTreeIter *iter)
|
|
|
|
|
{
|
|
|
|
|
gboolean retval;
|
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
|
|
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
|
|
|
|
|
if (iface->iter_previous)
|
|
|
|
|
retval = (* iface->iter_previous) (tree_model, iter);
|
|
|
|
|
else
|
|
|
|
|
retval = gtk_tree_model_iter_previous_default (tree_model, iter);
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
2000-10-26 00:36:47 +00:00
|
|
|
|
* gtk_tree_model_iter_children:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: (out): the new #GtkTreeIter-struct to be set to the child
|
|
|
|
|
* @parent: (allow-none): the #GtkTreeIter-struct, or %NULL
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets @iter to point to the first child of @parent.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* If @parent has no children, %FALSE is returned and @iter is
|
|
|
|
|
* set to be invalid. @parent will remain a valid node after this
|
|
|
|
|
* function has been called.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
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
|
|
|
|
* If @parent is %NULL returns the first node, equivalent to
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* `gtk_tree_model_get_iter_first (tree_model, iter);`
|
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
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: %TRUE, if @child has been set to the first child
|
|
|
|
|
*/
|
2000-10-26 00:36:47 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_tree_model_iter_children (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
GtkTreeIter *parent)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
2000-10-27 23:34:58 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
|
|
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
2005-05-21 01:05:14 +00:00
|
|
|
|
|
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
g_return_val_if_fail (iface->iter_children != NULL, FALSE);
|
2000-10-26 00:36:47 +00:00
|
|
|
|
|
2002-05-10 21:59:20 +00:00
|
|
|
|
INITIALIZE_TREE_ITER (iter);
|
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
return (* iface->iter_children) (tree_model, iter, parent);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
2000-10-26 00:36:47 +00:00
|
|
|
|
* gtk_tree_model_iter_has_child:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: the #GtkTreeIter-struct to test for children
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
Doc typo fix. (#68172)
* gtk/gtksocket.c (gtk_socket_get_id): Doc typo fix. (#68172)
* gtk/gtktreemodel.c (gtk_tree_path_is_descendant): Fix docs.
* gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Document.
* gtk/gtkwindow.c (gtk_window_remove_accel_group): Fix docs.
* gtk/gtkrc.c (gtk_rc_get_style_by_paths),
gtk/gtkwidget.c (gtk_widget_get_toplevel,
gtk_widget_push_composite_child), gtk/gtkdialog.c
(gtk_dialog_new_with_buttons, gtk_dialog_run): Keep gtk-doc
from messing up the indentation of inline examples.
* gtk/gtkmain.c, gtk/gtkrc.c: Consistently call g_getenv()
instead of getenv().
* gtk/gtktreemodel.c, gtk/gtkaccelgroup.c, gtk/gtkclipboard.c,
gtk/gtkdnd.c, gtk/gtkiconfactory.c, gtk/gtkrc.c,
gtk/gtkstyle.c, gtk/gtkselection.c: Doc fixes.
* gtk/gtkaccelmap.c (gtk_accel_map_add_filter,
gtk_accel_map_foreach_unfiltered, gtk_accel_map_load_scanner):
Document.
* gtk/tmpl/gtksocket.sgml: Mention gtk_socket_get_id()
instead of GTK_WINDOW_XWINDOW(). (#68172)
* gtk/gtk-sections.txt: Move functions which are documented
as "private" or "internal" into Private subsections.
* gtk/tmpl/gtkdnd.sgml, gtk/tmpl/gtkobject.sgml,
gtk/tmpl/gtkrc.sgml, gtk/tmpl/gtktooltips.sgml,
gtk/tmpl/gtkwidget.sgml, gtk/tmpl/gtkclipboard.sgml,
gtk/tmpl/gtkstyle.sgml, gtk/tmpl/gtkselection.sgml,
gtk/tmpl/gtkfeatures.sgml: Minor markup fixes.
* gtk/tmpl/gtksignal.sgml: Add link to GLib signal docs.
* gtk/tmpl/gtkpreview.sgml, gtk/tmpl/gtktext.sgml,
gtk/tmpl/gtktree.sgml: Remove "deprecated" from short desc.
* gtk/tmpl/gtkrc.sgml: Correct names of default RC files.
2002-01-08 00:04:57 +00:00
|
|
|
|
* Returns %TRUE if @iter has children, %FALSE otherwise.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: %TRUE if @iter has children
|
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gboolean
|
2000-10-26 00:36:47 +00:00
|
|
|
|
gtk_tree_model_iter_has_child (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
2000-10-27 23:34:58 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
|
|
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
2000-10-26 00:36:47 +00:00
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
g_return_val_if_fail (iface->iter_has_child != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
return (* iface->iter_has_child) (tree_model, iter);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
2000-10-26 00:36:47 +00:00
|
|
|
|
* gtk_tree_model_iter_n_children:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: (allow-none): the #GtkTreeIter-struct, or %NULL
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Returns the number of children that @iter has.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* As a special case, if @iter is %NULL, then the number
|
|
|
|
|
* of toplevel nodes is returned.
|
|
|
|
|
*
|
|
|
|
|
* Return value: the number of children of @iter
|
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gint
|
2000-10-26 00:36:47 +00:00
|
|
|
|
gtk_tree_model_iter_n_children (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
2000-10-27 23:34:58 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), 0);
|
2000-10-26 00:36:47 +00:00
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
g_return_val_if_fail (iface->iter_n_children != NULL, 0);
|
|
|
|
|
|
|
|
|
|
return (* iface->iter_n_children) (tree_model, iter);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
2000-10-26 00:36:47 +00:00
|
|
|
|
* gtk_tree_model_iter_nth_child:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: (out): the #GtkTreeIter-struct to set to the nth child
|
|
|
|
|
* @parent: (allow-none): the #GtkTreeIter-struct to get the child from, or %NULL.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @n: the index of the desired child
|
|
|
|
|
*
|
|
|
|
|
* Sets @iter to be the child of @parent, using the given index.
|
|
|
|
|
*
|
|
|
|
|
* The first index is 0. If @n is too big, or @parent has no children,
|
|
|
|
|
* @iter is set to an invalid iterator and %FALSE is returned. @parent
|
|
|
|
|
* will remain a valid node after this function has been called. As a
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* special case, if @parent is %NULL, then the @n-th root node
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* is set.
|
|
|
|
|
*
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* Return value: %TRUE, if @parent has an @n-th child
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2000-10-26 00:36:47 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
GtkTreeIter *parent,
|
|
|
|
|
gint n)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
2000-10-27 23:34:58 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
|
|
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (n >= 0, FALSE);
|
2005-05-21 01:05:14 +00:00
|
|
|
|
|
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
g_return_val_if_fail (iface->iter_nth_child != NULL, FALSE);
|
2000-10-26 00:36:47 +00:00
|
|
|
|
|
2002-05-10 21:59:20 +00:00
|
|
|
|
INITIALIZE_TREE_ITER (iter);
|
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
return (* iface->iter_nth_child) (tree_model, iter, parent, n);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 22:21:01 +00:00
|
|
|
|
/**
|
2000-10-26 00:36:47 +00:00
|
|
|
|
* gtk_tree_model_iter_parent:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: (out): the new #GtkTreeIter-struct to set to the parent
|
|
|
|
|
* @child: the #GtkTreeIter-struct
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets @iter to be the parent of @child.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* If @child is at the toplevel, and doesn’t have a parent, then
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @iter is set to an invalid iterator and %FALSE is returned.
|
|
|
|
|
* @child will remain a valid node after this function has been
|
2000-10-26 00:36:47 +00:00
|
|
|
|
* called.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: %TRUE, if @iter is set to the parent of @child
|
|
|
|
|
*/
|
2000-10-26 00:36:47 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_tree_model_iter_parent (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
GtkTreeIter *child)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
|
|
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (child != NULL, FALSE);
|
2011-01-12 23:48:20 +00:00
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
g_return_val_if_fail (iface->iter_parent != NULL, FALSE);
|
2000-10-26 00:36:47 +00:00
|
|
|
|
|
2002-05-10 21:59:20 +00:00
|
|
|
|
INITIALIZE_TREE_ITER (iter);
|
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
return (* iface->iter_parent) (tree_model, iter, child);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
|
/**
|
2001-03-09 00:19:11 +00:00
|
|
|
|
* gtk_tree_model_ref_node:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: the #GtkTreeIter-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Lets the tree ref the node.
|
|
|
|
|
*
|
|
|
|
|
* This is an optional method for models to implement.
|
|
|
|
|
* To be more specific, models may ignore this call as it exists
|
2001-03-09 00:19:11 +00:00
|
|
|
|
* primarily for performance reasons.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* This function is primarily meant as a way for views to let
|
|
|
|
|
* caching models know when nodes are being displayed (and hence,
|
2011-08-11 08:42:29 +00:00
|
|
|
|
* whether or not to cache that node). Being displayed means a node
|
|
|
|
|
* is in an expanded branch, regardless of whether the node is currently
|
|
|
|
|
* visible in the viewport. For example, a file-system based model
|
|
|
|
|
* would not want to keep the entire file-hierarchy in memory,
|
|
|
|
|
* just the sections that are currently being displayed by
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* every current view.
|
|
|
|
|
*
|
|
|
|
|
* A model should be expected to be able to get an iter independent
|
|
|
|
|
* of its reffed state.
|
|
|
|
|
*/
|
2000-11-09 16:52:17 +00:00
|
|
|
|
void
|
2001-03-09 00:19:11 +00:00
|
|
|
|
gtk_tree_model_ref_node (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter)
|
2000-11-09 16:52:17 +00:00
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
if (iface->ref_node)
|
|
|
|
|
(* iface->ref_node) (tree_model, iter);
|
2000-11-09 16:52:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2001-03-09 00:19:11 +00:00
|
|
|
|
* gtk_tree_model_unref_node:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: the #GtkTreeIter-struct
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Lets the tree unref the node.
|
|
|
|
|
*
|
|
|
|
|
* This is an optional method for models to implement.
|
|
|
|
|
* To be more specific, models may ignore this call as it exists
|
|
|
|
|
* primarily for performance reasons. For more information on what
|
|
|
|
|
* this means, see gtk_tree_model_ref_node().
|
2001-03-09 00:19:11 +00:00
|
|
|
|
*
|
|
|
|
|
* Please note that nodes that are deleted are not unreffed.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2000-11-09 16:52:17 +00:00
|
|
|
|
void
|
2001-03-09 00:19:11 +00:00
|
|
|
|
gtk_tree_model_unref_node (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter)
|
2000-11-09 16:52:17 +00:00
|
|
|
|
{
|
2005-05-21 01:05:14 +00:00
|
|
|
|
GtkTreeModelIface *iface;
|
|
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
2001-07-09 17:09:35 +00:00
|
|
|
|
g_return_if_fail (iter != NULL);
|
2000-11-09 16:52:17 +00:00
|
|
|
|
|
2005-05-21 01:05:14 +00:00
|
|
|
|
iface = GTK_TREE_MODEL_GET_IFACE (tree_model);
|
|
|
|
|
if (iface->unref_node)
|
|
|
|
|
(* iface->unref_node) (tree_model, iter);
|
2000-11-09 16:52:17 +00:00
|
|
|
|
}
|
2001-02-17 00:16:08 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_get:
|
|
|
|
|
* @tree_model: a #GtkTreeModel
|
|
|
|
|
* @iter: a row in @tree_model
|
2011-09-26 00:58:59 +00:00
|
|
|
|
* @...: pairs of column number and value return locations,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* terminated by -1
|
2001-02-17 00:16:08 +00:00
|
|
|
|
*
|
|
|
|
|
* Gets the value of one or more cells in the row referenced by @iter.
|
|
|
|
|
* The variable argument list should contain integer column numbers,
|
|
|
|
|
* each column number followed by a place to store the value being
|
|
|
|
|
* retrieved. The list is terminated by a -1. For example, to get a
|
|
|
|
|
* value from column 0 with type %G_TYPE_STRING, you would
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* write: `gtk_tree_model_get (model, iter, 0, &place_string_here, -1)`,
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* where `place_string_here` is a #gchararray
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* to be filled with the string.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Returned values with type %G_TYPE_OBJECT have to be unreferenced,
|
|
|
|
|
* values with type %G_TYPE_STRING or %G_TYPE_BOXED have to be freed.
|
|
|
|
|
* Other values are passed by value.
|
|
|
|
|
*/
|
2001-02-17 00:16:08 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_model_get (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
...)
|
2001-02-17 00:16:08 +00:00
|
|
|
|
{
|
|
|
|
|
va_list var_args;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
2001-07-09 17:09:35 +00:00
|
|
|
|
g_return_if_fail (iter != NULL);
|
2001-02-17 00:16:08 +00:00
|
|
|
|
|
|
|
|
|
va_start (var_args, iter);
|
|
|
|
|
gtk_tree_model_get_valist (tree_model, iter, var_args);
|
|
|
|
|
va_end (var_args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_get_valist:
|
|
|
|
|
* @tree_model: a #GtkTreeModel
|
|
|
|
|
* @iter: a row in @tree_model
|
2014-01-28 05:06:30 +00:00
|
|
|
|
* @var_args: va_list of column/return location pairs
|
2001-02-17 00:16:08 +00:00
|
|
|
|
*
|
2014-01-28 05:06:30 +00:00
|
|
|
|
* See gtk_tree_model_get(), this version takes a va_list
|
Doc typo fix. (#68172)
* gtk/gtksocket.c (gtk_socket_get_id): Doc typo fix. (#68172)
* gtk/gtktreemodel.c (gtk_tree_path_is_descendant): Fix docs.
* gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Document.
* gtk/gtkwindow.c (gtk_window_remove_accel_group): Fix docs.
* gtk/gtkrc.c (gtk_rc_get_style_by_paths),
gtk/gtkwidget.c (gtk_widget_get_toplevel,
gtk_widget_push_composite_child), gtk/gtkdialog.c
(gtk_dialog_new_with_buttons, gtk_dialog_run): Keep gtk-doc
from messing up the indentation of inline examples.
* gtk/gtkmain.c, gtk/gtkrc.c: Consistently call g_getenv()
instead of getenv().
* gtk/gtktreemodel.c, gtk/gtkaccelgroup.c, gtk/gtkclipboard.c,
gtk/gtkdnd.c, gtk/gtkiconfactory.c, gtk/gtkrc.c,
gtk/gtkstyle.c, gtk/gtkselection.c: Doc fixes.
* gtk/gtkaccelmap.c (gtk_accel_map_add_filter,
gtk_accel_map_foreach_unfiltered, gtk_accel_map_load_scanner):
Document.
* gtk/tmpl/gtksocket.sgml: Mention gtk_socket_get_id()
instead of GTK_WINDOW_XWINDOW(). (#68172)
* gtk/gtk-sections.txt: Move functions which are documented
as "private" or "internal" into Private subsections.
* gtk/tmpl/gtkdnd.sgml, gtk/tmpl/gtkobject.sgml,
gtk/tmpl/gtkrc.sgml, gtk/tmpl/gtktooltips.sgml,
gtk/tmpl/gtkwidget.sgml, gtk/tmpl/gtkclipboard.sgml,
gtk/tmpl/gtkstyle.sgml, gtk/tmpl/gtkselection.sgml,
gtk/tmpl/gtkfeatures.sgml: Minor markup fixes.
* gtk/tmpl/gtksignal.sgml: Add link to GLib signal docs.
* gtk/tmpl/gtkpreview.sgml, gtk/tmpl/gtktext.sgml,
gtk/tmpl/gtktree.sgml: Remove "deprecated" from short desc.
* gtk/tmpl/gtkrc.sgml: Correct names of default RC files.
2002-01-08 00:04:57 +00:00
|
|
|
|
* for language bindings to use.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2001-02-17 00:16:08 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_model_get_valist (GtkTreeModel *tree_model,
|
|
|
|
|
GtkTreeIter *iter,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
va_list var_args)
|
2001-02-17 00:16:08 +00:00
|
|
|
|
{
|
|
|
|
|
gint column;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
2001-07-09 17:09:35 +00:00
|
|
|
|
g_return_if_fail (iter != NULL);
|
2001-02-17 00:16:08 +00:00
|
|
|
|
|
|
|
|
|
column = va_arg (var_args, gint);
|
|
|
|
|
|
|
|
|
|
while (column != -1)
|
|
|
|
|
{
|
2011-09-30 15:31:04 +00:00
|
|
|
|
GValue value = G_VALUE_INIT;
|
2001-02-17 00:16:08 +00:00
|
|
|
|
gchar *error = NULL;
|
|
|
|
|
|
|
|
|
|
if (column >= gtk_tree_model_get_n_columns (tree_model))
|
2011-01-12 23:48:20 +00:00
|
|
|
|
{
|
|
|
|
|
g_warning ("%s: Invalid column number %d accessed (remember to end your list of columns with a -1)", G_STRLOC, column);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2001-02-17 00:16:08 +00:00
|
|
|
|
|
|
|
|
|
gtk_tree_model_get_value (GTK_TREE_MODEL (tree_model), iter, column, &value);
|
|
|
|
|
|
2001-02-19 22:51:15 +00:00
|
|
|
|
G_VALUE_LCOPY (&value, var_args, 0, &error);
|
2001-02-17 00:16:08 +00:00
|
|
|
|
if (error)
|
2011-01-12 23:48:20 +00:00
|
|
|
|
{
|
|
|
|
|
g_warning ("%s: %s", G_STRLOC, error);
|
|
|
|
|
g_free (error);
|
2001-02-17 00:16:08 +00:00
|
|
|
|
|
2011-01-12 23:48:20 +00:00
|
|
|
|
/* we purposely leak the value here, it might not be
|
|
|
|
|
* in a sane state if an error condition occurred
|
|
|
|
|
*/
|
|
|
|
|
break;
|
|
|
|
|
}
|
2001-02-17 00:16:08 +00:00
|
|
|
|
|
|
|
|
|
g_value_unset (&value);
|
|
|
|
|
|
|
|
|
|
column = va_arg (var_args, gint);
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-02-22 01:56:08 +00:00
|
|
|
|
|
2001-09-12 23:16:18 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_row_changed:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct pointing to the changed row
|
|
|
|
|
* @iter: a valid #GtkTreeIter-struct pointing to the changed row
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Emits the #GtkTreeModel::row-changed signal on @tree_model.
|
|
|
|
|
*/
|
2001-02-22 01:56:08 +00:00
|
|
|
|
void
|
2001-09-12 23:16:18 +00:00
|
|
|
|
gtk_tree_model_row_changed (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreePath *path,
|
|
|
|
|
GtkTreeIter *iter)
|
2001-02-22 01:56:08 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
2001-09-12 23:16:18 +00:00
|
|
|
|
g_return_if_fail (path != NULL);
|
|
|
|
|
g_return_if_fail (iter != NULL);
|
|
|
|
|
|
2002-10-23 14:54:27 +00:00
|
|
|
|
g_signal_emit (tree_model, tree_model_signals[ROW_CHANGED], 0, path, iter);
|
2001-02-22 01:56:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-09-12 23:16:18 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_row_inserted:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct pointing to the inserted row
|
|
|
|
|
* @iter: a valid #GtkTreeIter-struct pointing to the inserted row
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Emits the #GtkTreeModel::row-inserted signal on @tree_model.
|
|
|
|
|
*/
|
2001-02-22 01:56:08 +00:00
|
|
|
|
void
|
2001-09-12 23:16:18 +00:00
|
|
|
|
gtk_tree_model_row_inserted (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreePath *path,
|
|
|
|
|
GtkTreeIter *iter)
|
2001-02-22 01:56:08 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
|
|
|
|
g_return_if_fail (path != NULL);
|
|
|
|
|
g_return_if_fail (iter != NULL);
|
|
|
|
|
|
2002-10-23 14:54:27 +00:00
|
|
|
|
g_signal_emit (tree_model, tree_model_signals[ROW_INSERTED], 0, path, iter);
|
2001-02-22 01:56:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-09-12 23:16:18 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_row_has_child_toggled:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct pointing to the changed row
|
|
|
|
|
* @iter: a valid #GtkTreeIter-struct pointing to the changed row
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Emits the #GtkTreeModel::row-has-child-toggled signal on
|
|
|
|
|
* @tree_model. This should be called by models after the child
|
|
|
|
|
* state of a node changes.
|
|
|
|
|
*/
|
2001-02-22 01:56:08 +00:00
|
|
|
|
void
|
2001-09-12 23:16:18 +00:00
|
|
|
|
gtk_tree_model_row_has_child_toggled (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreePath *path,
|
|
|
|
|
GtkTreeIter *iter)
|
2001-02-22 01:56:08 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
|
|
|
|
g_return_if_fail (path != NULL);
|
|
|
|
|
g_return_if_fail (iter != NULL);
|
|
|
|
|
|
2002-10-23 14:54:27 +00:00
|
|
|
|
g_signal_emit (tree_model, tree_model_signals[ROW_HAS_CHILD_TOGGLED], 0, path, iter);
|
2001-02-22 01:56:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-12-04 23:49:57 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_row_deleted:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct pointing to the previous location of
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* the deleted row
|
|
|
|
|
*
|
|
|
|
|
* Emits the #GtkTreeModel::row-deleted signal on @tree_model.
|
|
|
|
|
*
|
|
|
|
|
* This should be called by models after a row has been removed.
|
|
|
|
|
* The location pointed to by @path should be the location that
|
|
|
|
|
* the row previously was at. It may not be a valid location anymore.
|
2011-08-11 08:42:29 +00:00
|
|
|
|
*
|
|
|
|
|
* Nodes that are deleted are not unreffed, this means that any
|
|
|
|
|
* outstanding references on the deleted node should not be released.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2001-02-22 01:56:08 +00:00
|
|
|
|
void
|
2001-09-12 23:16:18 +00:00
|
|
|
|
gtk_tree_model_row_deleted (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreePath *path)
|
2001-02-22 01:56:08 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
|
|
|
|
g_return_if_fail (path != NULL);
|
|
|
|
|
|
2002-10-23 14:54:27 +00:00
|
|
|
|
g_signal_emit (tree_model, tree_model_signals[ROW_DELETED], 0, path);
|
2001-02-22 01:56:08 +00:00
|
|
|
|
}
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
Doc typo fix. (#68172)
* gtk/gtksocket.c (gtk_socket_get_id): Doc typo fix. (#68172)
* gtk/gtktreemodel.c (gtk_tree_path_is_descendant): Fix docs.
* gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Document.
* gtk/gtkwindow.c (gtk_window_remove_accel_group): Fix docs.
* gtk/gtkrc.c (gtk_rc_get_style_by_paths),
gtk/gtkwidget.c (gtk_widget_get_toplevel,
gtk_widget_push_composite_child), gtk/gtkdialog.c
(gtk_dialog_new_with_buttons, gtk_dialog_run): Keep gtk-doc
from messing up the indentation of inline examples.
* gtk/gtkmain.c, gtk/gtkrc.c: Consistently call g_getenv()
instead of getenv().
* gtk/gtktreemodel.c, gtk/gtkaccelgroup.c, gtk/gtkclipboard.c,
gtk/gtkdnd.c, gtk/gtkiconfactory.c, gtk/gtkrc.c,
gtk/gtkstyle.c, gtk/gtkselection.c: Doc fixes.
* gtk/gtkaccelmap.c (gtk_accel_map_add_filter,
gtk_accel_map_foreach_unfiltered, gtk_accel_map_load_scanner):
Document.
* gtk/tmpl/gtksocket.sgml: Mention gtk_socket_get_id()
instead of GTK_WINDOW_XWINDOW(). (#68172)
* gtk/gtk-sections.txt: Move functions which are documented
as "private" or "internal" into Private subsections.
* gtk/tmpl/gtkdnd.sgml, gtk/tmpl/gtkobject.sgml,
gtk/tmpl/gtkrc.sgml, gtk/tmpl/gtktooltips.sgml,
gtk/tmpl/gtkwidget.sgml, gtk/tmpl/gtkclipboard.sgml,
gtk/tmpl/gtkstyle.sgml, gtk/tmpl/gtkselection.sgml,
gtk/tmpl/gtkfeatures.sgml: Minor markup fixes.
* gtk/tmpl/gtksignal.sgml: Add link to GLib signal docs.
* gtk/tmpl/gtkpreview.sgml, gtk/tmpl/gtktext.sgml,
gtk/tmpl/gtktree.sgml: Remove "deprecated" from short desc.
* gtk/tmpl/gtkrc.sgml: Correct names of default RC files.
2002-01-08 00:04:57 +00:00
|
|
|
|
/**
|
2011-01-18 05:37:11 +00:00
|
|
|
|
* gtk_tree_model_rows_reordered: (skip)
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct pointing to the tree node whose children
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* have been reordered
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: a valid #GtkTreeIter-struct pointing to the node whose children
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* have been reordered, or %NULL if the depth of @path is 0
|
|
|
|
|
* @new_order: an array of integers mapping the current position of
|
|
|
|
|
* each child to its old position before the re-ordering,
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* i.e. @new_order`[newpos] = oldpos`
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Emits the #GtkTreeModel::rows-reordered signal on @tree_model.
|
|
|
|
|
*
|
|
|
|
|
* This should be called by models when their rows have been
|
|
|
|
|
* reordered.
|
|
|
|
|
*/
|
2001-03-23 00:35:19 +00:00
|
|
|
|
void
|
2001-09-12 23:16:18 +00:00
|
|
|
|
gtk_tree_model_rows_reordered (GtkTreeModel *tree_model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreePath *path,
|
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
gint *new_order)
|
2001-03-23 00:35:19 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
|
|
|
|
g_return_if_fail (new_order != NULL);
|
|
|
|
|
|
2002-10-23 14:54:27 +00:00
|
|
|
|
g_signal_emit (tree_model, tree_model_signals[ROWS_REORDERED], 0, path, iter, new_order);
|
2001-03-23 00:35:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-24 23:34:56 +00:00
|
|
|
|
/**
|
2013-10-09 18:09:35 +00:00
|
|
|
|
* gtk_tree_model_rows_reordered_with_length: (rename-to gtk_tree_model_rows_reordered)
|
2012-09-24 23:34:56 +00:00
|
|
|
|
* @tree_model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a #GtkTreePath-struct pointing to the tree node whose children
|
2012-09-24 23:34:56 +00:00
|
|
|
|
* have been reordered
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @iter: (allow-none): a valid #GtkTreeIter-struct pointing to the node
|
2012-09-24 23:34:56 +00:00
|
|
|
|
* whose children have been reordered, or %NULL if the depth
|
|
|
|
|
* of @path is 0
|
|
|
|
|
* @new_order: (array length=length): an array of integers
|
|
|
|
|
* mapping the current position of each child to its old
|
|
|
|
|
* position before the re-ordering,
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* i.e. @new_order`[newpos] = oldpos`
|
2012-09-24 23:34:56 +00:00
|
|
|
|
* @length: length of @new_order array
|
|
|
|
|
*
|
|
|
|
|
* Emits the #GtkTreeModel::rows-reordered signal on @tree_model.
|
|
|
|
|
*
|
|
|
|
|
* This should be called by models when their rows have been
|
|
|
|
|
* reordered.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.10
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_tree_model_rows_reordered_with_length (GtkTreeModel *tree_model,
|
|
|
|
|
GtkTreePath *path,
|
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
gint *new_order,
|
|
|
|
|
gint length)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
|
|
|
|
g_return_if_fail (new_order != NULL);
|
|
|
|
|
g_return_if_fail (length == gtk_tree_model_iter_n_children (tree_model, iter));
|
|
|
|
|
|
|
|
|
|
g_signal_emit (tree_model, tree_model_signals[ROWS_REORDERED], 0, path, iter, new_order);
|
|
|
|
|
}
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2001-06-29 04:19:30 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_tree_model_foreach_helper (GtkTreeModel *model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
GtkTreePath *path,
|
|
|
|
|
GtkTreeModelForeachFunc func,
|
|
|
|
|
gpointer user_data)
|
2001-06-29 04:19:30 +00:00
|
|
|
|
{
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
GtkTreeIter child;
|
|
|
|
|
|
2002-03-12 04:48:50 +00:00
|
|
|
|
if ((* func) (model, path, iter, user_data))
|
2011-01-12 23:48:20 +00:00
|
|
|
|
return TRUE;
|
2002-03-12 04:48:50 +00:00
|
|
|
|
|
2001-06-29 04:19:30 +00:00
|
|
|
|
if (gtk_tree_model_iter_children (model, &child, iter))
|
2011-01-12 23:48:20 +00:00
|
|
|
|
{
|
|
|
|
|
gtk_tree_path_down (path);
|
|
|
|
|
if (gtk_tree_model_foreach_helper (model, &child, path, func, user_data))
|
|
|
|
|
return TRUE;
|
|
|
|
|
gtk_tree_path_up (path);
|
|
|
|
|
}
|
2001-06-29 04:19:30 +00:00
|
|
|
|
|
|
|
|
|
gtk_tree_path_next (path);
|
|
|
|
|
}
|
|
|
|
|
while (gtk_tree_model_iter_next (model, iter));
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_model_foreach:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @model: a #GtkTreeModel
|
|
|
|
|
* @func: (scope call): a function to be called on each row
|
|
|
|
|
* @user_data: user data to passed to @func
|
2010-09-21 04:18:11 +00:00
|
|
|
|
*
|
|
|
|
|
* Calls func on each node in model in a depth-first fashion.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* If @func returns %TRUE, then the tree ceases to be walked,
|
|
|
|
|
* and gtk_tree_model_foreach() returns.
|
|
|
|
|
*/
|
2001-06-29 04:19:30 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_model_foreach (GtkTreeModel *model,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeModelForeachFunc func,
|
|
|
|
|
gpointer user_data)
|
2001-06-29 04:19:30 +00:00
|
|
|
|
{
|
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
2001-07-09 17:09:35 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_TREE_MODEL (model));
|
|
|
|
|
g_return_if_fail (func != NULL);
|
|
|
|
|
|
2002-02-24 04:18:44 +00:00
|
|
|
|
path = gtk_tree_path_new_first ();
|
2001-07-21 15:31:19 +00:00
|
|
|
|
if (gtk_tree_model_get_iter (model, &iter, path) == FALSE)
|
2001-11-24 17:32:27 +00:00
|
|
|
|
{
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-07-21 15:31:19 +00:00
|
|
|
|
|
2001-06-29 04:19:30 +00:00
|
|
|
|
gtk_tree_model_foreach_helper (model, &iter, path, func, user_data);
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-03-23 22:21:06 +00:00
|
|
|
|
/*
|
|
|
|
|
* GtkTreeRowReference
|
|
|
|
|
*/
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2001-10-06 00:50:36 +00:00
|
|
|
|
static void gtk_tree_row_reference_unref_path (GtkTreePath *path,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeModel *model,
|
|
|
|
|
gint depth);
|
2001-11-20 22:04:00 +00:00
|
|
|
|
|
2001-10-06 00:50:36 +00:00
|
|
|
|
|
2010-04-27 11:31:23 +00:00
|
|
|
|
G_DEFINE_BOXED_TYPE (GtkTreeRowReference, gtk_tree_row_reference,
|
|
|
|
|
gtk_tree_row_reference_copy,
|
|
|
|
|
gtk_tree_row_reference_free)
|
2002-09-11 19:52:31 +00:00
|
|
|
|
|
2001-02-28 21:37:50 +00:00
|
|
|
|
struct _GtkTreeRowReference
|
|
|
|
|
{
|
|
|
|
|
GObject *proxy;
|
|
|
|
|
GtkTreeModel *model;
|
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
release_row_references (gpointer data)
|
|
|
|
|
{
|
|
|
|
|
RowRefList *refs = data;
|
|
|
|
|
GSList *tmp_list = NULL;
|
|
|
|
|
|
|
|
|
|
tmp_list = refs->list;
|
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
|
{
|
|
|
|
|
GtkTreeRowReference *reference = tmp_list->data;
|
|
|
|
|
|
|
|
|
|
if (reference->proxy == (GObject *)reference->model)
|
2011-01-12 23:48:20 +00:00
|
|
|
|
reference->model = NULL;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
reference->proxy = NULL;
|
|
|
|
|
|
|
|
|
|
/* we don't free the reference, users are responsible for that. */
|
|
|
|
|
|
|
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_slist_free (refs->list);
|
|
|
|
|
g_free (refs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
gtk_tree_row_ref_inserted (RowRefList *refs,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreePath *path,
|
|
|
|
|
GtkTreeIter *iter)
|
2001-02-28 21:37:50 +00:00
|
|
|
|
{
|
|
|
|
|
GSList *tmp_list;
|
|
|
|
|
|
|
|
|
|
if (refs == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* This function corrects the path stored in the reference to
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* account for an insertion. Note that it's called _after_ the
|
|
|
|
|
* insertion with the path to the newly-inserted row. Which means
|
|
|
|
|
* that the inserted path is in a different "coordinate system" than
|
|
|
|
|
* the old path (e.g. if the inserted path was just before the old
|
|
|
|
|
* path, then inserted path and old path will be the same, and old
|
|
|
|
|
* path must be moved down one).
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
tmp_list = refs->list;
|
|
|
|
|
|
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
|
{
|
|
|
|
|
GtkTreeRowReference *reference = tmp_list->data;
|
|
|
|
|
|
2001-10-01 18:12:34 +00:00
|
|
|
|
if (reference->path == NULL)
|
2011-01-12 23:48:20 +00:00
|
|
|
|
goto done;
|
2001-10-01 18:12:34 +00:00
|
|
|
|
|
|
|
|
|
if (reference->path->depth >= path->depth)
|
2011-01-12 23:48:20 +00:00
|
|
|
|
{
|
|
|
|
|
gint i;
|
|
|
|
|
gboolean ancestor = TRUE;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < path->depth - 1; i ++)
|
|
|
|
|
{
|
|
|
|
|
if (path->indices[i] != reference->path->indices[i])
|
|
|
|
|
{
|
|
|
|
|
ancestor = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ancestor == FALSE)
|
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
|
|
if (path->indices[path->depth-1] <= reference->path->indices[path->depth-1])
|
|
|
|
|
reference->path->indices[path->depth-1] += 1;
|
|
|
|
|
}
|
2001-10-01 18:12:34 +00:00
|
|
|
|
done:
|
2001-02-28 21:37:50 +00:00
|
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
gtk_tree_row_ref_deleted (RowRefList *refs,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreePath *path)
|
2001-02-28 21:37:50 +00:00
|
|
|
|
{
|
|
|
|
|
GSList *tmp_list;
|
|
|
|
|
|
|
|
|
|
if (refs == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* This function corrects the path stored in the reference to
|
|
|
|
|
* account for an deletion. Note that it's called _after_ the
|
|
|
|
|
* deletion with the old path of the just-deleted row. Which means
|
|
|
|
|
* that the deleted path is the same now-defunct "coordinate system"
|
|
|
|
|
* as the path saved in the reference, which is what we want to fix.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
tmp_list = refs->list;
|
|
|
|
|
|
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
|
{
|
|
|
|
|
GtkTreeRowReference *reference = tmp_list->data;
|
|
|
|
|
|
|
|
|
|
if (reference->path)
|
2011-01-12 23:48:20 +00:00
|
|
|
|
{
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
|
|
if (path->depth > reference->path->depth)
|
|
|
|
|
goto next;
|
|
|
|
|
for (i = 0; i < path->depth - 1; i++)
|
|
|
|
|
{
|
|
|
|
|
if (path->indices[i] != reference->path->indices[i])
|
|
|
|
|
goto next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We know it affects us. */
|
|
|
|
|
if (path->indices[i] == reference->path->indices[i])
|
|
|
|
|
{
|
|
|
|
|
if (reference->path->depth > path->depth)
|
|
|
|
|
/* some parent was deleted, trying to unref any node
|
|
|
|
|
* between the deleted parent and the node the reference
|
|
|
|
|
* is pointing to is bad, as those nodes are already gone.
|
|
|
|
|
*/
|
|
|
|
|
gtk_tree_row_reference_unref_path (reference->path, reference->model, path->depth - 1);
|
|
|
|
|
else
|
|
|
|
|
gtk_tree_row_reference_unref_path (reference->path, reference->model, reference->path->depth - 1);
|
|
|
|
|
gtk_tree_path_free (reference->path);
|
|
|
|
|
reference->path = NULL;
|
|
|
|
|
}
|
|
|
|
|
else if (path->indices[i] < reference->path->indices[i])
|
|
|
|
|
{
|
|
|
|
|
reference->path->indices[path->depth-1]-=1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-02-12 17:48:02 +00:00
|
|
|
|
|
|
|
|
|
next:
|
2001-02-28 21:37:50 +00:00
|
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-30 01:26:30 +00:00
|
|
|
|
static void
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
gtk_tree_row_ref_reordered (RowRefList *refs,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreePath *path,
|
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
gint *new_order)
|
2001-03-30 01:26:30 +00:00
|
|
|
|
{
|
|
|
|
|
GSList *tmp_list;
|
|
|
|
|
gint length;
|
|
|
|
|
|
|
|
|
|
if (refs == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
tmp_list = refs->list;
|
|
|
|
|
|
|
|
|
|
while (tmp_list != NULL)
|
|
|
|
|
{
|
|
|
|
|
GtkTreeRowReference *reference = tmp_list->data;
|
|
|
|
|
|
|
|
|
|
length = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (reference->model), iter);
|
|
|
|
|
|
|
|
|
|
if (length < 2)
|
2011-01-12 23:48:20 +00:00
|
|
|
|
return;
|
2001-03-30 01:26:30 +00:00
|
|
|
|
|
|
|
|
|
if ((reference->path) &&
|
2011-01-12 23:48:20 +00:00
|
|
|
|
(gtk_tree_path_is_ancestor (path, reference->path)))
|
|
|
|
|
{
|
|
|
|
|
gint ref_depth = gtk_tree_path_get_depth (reference->path);
|
|
|
|
|
gint depth = gtk_tree_path_get_depth (path);
|
|
|
|
|
|
|
|
|
|
if (ref_depth > depth)
|
|
|
|
|
{
|
|
|
|
|
gint i;
|
|
|
|
|
gint *indices = gtk_tree_path_get_indices (reference->path);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (new_order[i] == indices[depth])
|
|
|
|
|
{
|
|
|
|
|
indices[depth] = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-03-30 01:26:30 +00:00
|
|
|
|
|
|
|
|
|
tmp_list = g_slist_next (tmp_list);
|
|
|
|
|
}
|
2001-02-28 21:37:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-12 23:48:20 +00:00
|
|
|
|
/* We do this recursively so that we can unref children nodes
|
|
|
|
|
* before their parent
|
|
|
|
|
*/
|
2001-10-06 00:50:36 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_tree_row_reference_unref_path_helper (GtkTreePath *path,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeModel *model,
|
|
|
|
|
GtkTreeIter *parent_iter,
|
|
|
|
|
gint depth,
|
|
|
|
|
gint current_depth)
|
2001-10-06 00:50:36 +00:00
|
|
|
|
{
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
2001-11-20 22:04:00 +00:00
|
|
|
|
if (depth == current_depth)
|
2001-10-06 00:50:36 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2001-11-20 22:04:00 +00:00
|
|
|
|
gtk_tree_model_iter_nth_child (model, &iter, parent_iter, path->indices[current_depth]);
|
|
|
|
|
gtk_tree_row_reference_unref_path_helper (path, model, &iter, depth, current_depth + 1);
|
2001-10-06 00:50:36 +00:00
|
|
|
|
gtk_tree_model_unref_node (model, &iter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_tree_row_reference_unref_path (GtkTreePath *path,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeModel *model,
|
|
|
|
|
gint depth)
|
2001-10-06 00:50:36 +00:00
|
|
|
|
{
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
2001-11-20 22:04:00 +00:00
|
|
|
|
if (depth <= 0)
|
2001-10-06 00:50:36 +00:00
|
|
|
|
return;
|
2011-01-12 23:48:20 +00:00
|
|
|
|
|
2001-10-06 00:50:36 +00:00
|
|
|
|
gtk_tree_model_iter_nth_child (model, &iter, NULL, path->indices[0]);
|
2001-11-20 22:04:00 +00:00
|
|
|
|
gtk_tree_row_reference_unref_path_helper (path, model, &iter, depth, 1);
|
2001-10-06 00:50:36 +00:00
|
|
|
|
gtk_tree_model_unref_node (model, &iter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_row_reference_new:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a valid #GtkTreePath-struct to monitor
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Creates a row reference based on @path.
|
|
|
|
|
*
|
|
|
|
|
* This reference will keep pointing to the node pointed to
|
2012-02-20 14:42:11 +00:00
|
|
|
|
* by @path, so long as it exists. Any changes that occur on @model are
|
|
|
|
|
* propagated, and the path is updated appropriately. If
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* @path isn’t a valid path in @model, then %NULL is returned.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Return value: a newly allocated #GtkTreeRowReference, or %NULL
|
|
|
|
|
*/
|
2001-02-28 21:37:50 +00:00
|
|
|
|
GtkTreeRowReference *
|
|
|
|
|
gtk_tree_row_reference_new (GtkTreeModel *model,
|
|
|
|
|
GtkTreePath *path)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (model), NULL);
|
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
|
2004-03-05 16:40:12 +00:00
|
|
|
|
/* We use the model itself as the proxy object; and call
|
|
|
|
|
* gtk_tree_row_reference_inserted(), etc, in the
|
|
|
|
|
* class closure (default handler) marshalers for the signal.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2001-02-28 21:37:50 +00:00
|
|
|
|
return gtk_tree_row_reference_new_proxy (G_OBJECT (model), model, path);
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-23 05:45:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_row_reference_new_proxy:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @proxy: a proxy #GObject
|
|
|
|
|
* @model: a #GtkTreeModel
|
2014-01-27 22:04:46 +00:00
|
|
|
|
* @path: a valid #GtkTreePath-struct to monitor
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* You do not need to use this function.
|
|
|
|
|
*
|
|
|
|
|
* Creates a row reference based on @path.
|
|
|
|
|
*
|
|
|
|
|
* This reference will keep pointing to the node pointed to
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* by @path, so long as it exists. If @path isn’t a valid
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* path in @model, then %NULL is returned. However, unlike
|
|
|
|
|
* references created with gtk_tree_row_reference_new(), it
|
|
|
|
|
* does not listen to the model for changes. The creator of
|
|
|
|
|
* the row reference must do this explicitly using
|
2002-02-23 05:45:40 +00:00
|
|
|
|
* gtk_tree_row_reference_inserted(), gtk_tree_row_reference_deleted(),
|
2004-03-05 16:40:12 +00:00
|
|
|
|
* gtk_tree_row_reference_reordered().
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
2004-03-05 16:40:12 +00:00
|
|
|
|
* These functions must be called exactly once per proxy when the
|
|
|
|
|
* corresponding signal on the model is emitted. This single call
|
|
|
|
|
* updates all row references for that proxy. Since built-in GTK+
|
|
|
|
|
* objects like #GtkTreeView already use this mechanism internally,
|
|
|
|
|
* using them as the proxy object will produce unpredictable results.
|
|
|
|
|
* Further more, passing the same object as @model and @proxy
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* doesn’t work for reasons of internal implementation.
|
2002-02-23 05:45:40 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* This type of row reference is primarily meant by structures that
|
|
|
|
|
* need to carefully monitor exactly when a row reference updates
|
|
|
|
|
* itself, and is not generally needed by most applications.
|
2002-02-23 05:45:40 +00:00
|
|
|
|
*
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* Return value: a newly allocated #GtkTreeRowReference, or %NULL
|
|
|
|
|
*/
|
2001-02-28 21:37:50 +00:00
|
|
|
|
GtkTreeRowReference *
|
|
|
|
|
gtk_tree_row_reference_new_proxy (GObject *proxy,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreeModel *model,
|
|
|
|
|
GtkTreePath *path)
|
2001-02-28 21:37:50 +00:00
|
|
|
|
{
|
|
|
|
|
GtkTreeRowReference *reference;
|
|
|
|
|
RowRefList *refs;
|
2001-10-06 00:50:36 +00:00
|
|
|
|
GtkTreeIter parent_iter;
|
|
|
|
|
gint i;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (G_IS_OBJECT (proxy), NULL);
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_MODEL (model), NULL);
|
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
2001-10-06 00:50:36 +00:00
|
|
|
|
g_return_val_if_fail (path->depth > 0, NULL);
|
|
|
|
|
|
|
|
|
|
/* check that the path is valid */
|
|
|
|
|
if (gtk_tree_model_get_iter (model, &parent_iter, path) == FALSE)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
/* Now we want to ref every node */
|
|
|
|
|
gtk_tree_model_iter_nth_child (model, &parent_iter, NULL, path->indices[0]);
|
|
|
|
|
gtk_tree_model_ref_node (model, &parent_iter);
|
|
|
|
|
|
|
|
|
|
for (i = 1; i < path->depth; i++)
|
|
|
|
|
{
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
gtk_tree_model_iter_nth_child (model, &iter, &parent_iter, path->indices[i]);
|
|
|
|
|
gtk_tree_model_ref_node (model, &iter);
|
|
|
|
|
parent_iter = iter;
|
|
|
|
|
}
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2004-03-05 16:40:12 +00:00
|
|
|
|
/* Make the row reference */
|
2001-02-28 21:37:50 +00:00
|
|
|
|
reference = g_new (GtkTreeRowReference, 1);
|
|
|
|
|
|
2001-05-25 23:10:49 +00:00
|
|
|
|
g_object_ref (proxy);
|
|
|
|
|
g_object_ref (model);
|
2001-02-28 21:37:50 +00:00
|
|
|
|
reference->proxy = proxy;
|
|
|
|
|
reference->model = model;
|
|
|
|
|
reference->path = gtk_tree_path_copy (path);
|
|
|
|
|
|
|
|
|
|
refs = g_object_get_data (G_OBJECT (proxy), ROW_REF_DATA_STRING);
|
|
|
|
|
|
|
|
|
|
if (refs == NULL)
|
|
|
|
|
{
|
|
|
|
|
refs = g_new (RowRefList, 1);
|
|
|
|
|
refs->list = NULL;
|
|
|
|
|
|
|
|
|
|
g_object_set_data_full (G_OBJECT (proxy),
|
2011-01-12 23:48:20 +00:00
|
|
|
|
I_(ROW_REF_DATA_STRING),
|
2001-02-28 21:37:50 +00:00
|
|
|
|
refs, release_row_references);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
refs->list = g_slist_prepend (refs->list, reference);
|
|
|
|
|
|
|
|
|
|
return reference;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-18 23:44:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_row_reference_get_path:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @reference: a #GtkTreeRowReference
|
|
|
|
|
*
|
|
|
|
|
* Returns a path that the row reference currently points to,
|
|
|
|
|
* or %NULL if the path pointed to is no longer valid.
|
|
|
|
|
*
|
|
|
|
|
* Return value: a current path, or %NULL
|
|
|
|
|
*/
|
2001-02-28 21:37:50 +00:00
|
|
|
|
GtkTreePath *
|
|
|
|
|
gtk_tree_row_reference_get_path (GtkTreeRowReference *reference)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (reference != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
if (reference->proxy == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
if (reference->path == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
return gtk_tree_path_copy (reference->path);
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-13 21:27:03 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_row_reference_get_model:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @reference: a #GtkTreeRowReference
|
2005-07-13 21:27:03 +00:00
|
|
|
|
*
|
2005-08-31 04:17:46 +00:00
|
|
|
|
* Returns the model that the row reference is monitoring.
|
2005-07-13 21:27:03 +00:00
|
|
|
|
*
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* Return value: (transfer none): the model
|
2005-07-13 21:27:03 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.8
|
|
|
|
|
*/
|
|
|
|
|
GtkTreeModel *
|
|
|
|
|
gtk_tree_row_reference_get_model (GtkTreeRowReference *reference)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (reference != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
return reference->model;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-18 23:44:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_row_reference_valid:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @reference: (allow-none): a #GtkTreeRowReference, or %NULL
|
|
|
|
|
*
|
|
|
|
|
* Returns %TRUE if the @reference is non-%NULL and refers to
|
|
|
|
|
* a current valid path.
|
|
|
|
|
*
|
|
|
|
|
* Return value: %TRUE if @reference points to a valid path
|
|
|
|
|
*/
|
2001-06-18 23:44:41 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_tree_row_reference_valid (GtkTreeRowReference *reference)
|
|
|
|
|
{
|
|
|
|
|
if (reference == NULL || reference->path == NULL)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-11 19:52:31 +00:00
|
|
|
|
|
2002-11-28 00:33:17 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_row_reference_copy:
|
|
|
|
|
* @reference: a #GtkTreeRowReference
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
2002-11-28 00:33:17 +00:00
|
|
|
|
* Copies a #GtkTreeRowReference.
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Return value: a copy of @reference
|
2002-11-28 00:33:17 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.2
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2002-09-11 19:52:31 +00:00
|
|
|
|
GtkTreeRowReference *
|
|
|
|
|
gtk_tree_row_reference_copy (GtkTreeRowReference *reference)
|
|
|
|
|
{
|
|
|
|
|
return gtk_tree_row_reference_new_proxy (reference->proxy,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
reference->model,
|
|
|
|
|
reference->path);
|
2002-09-11 19:52:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-06-18 23:44:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_row_reference_free:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @reference: (allow-none): a #GtkTreeRowReference, or %NULL
|
|
|
|
|
*
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* Free’s @reference. @reference may be %NULL
|
2011-01-12 23:48:20 +00:00
|
|
|
|
*/
|
2001-02-28 21:37:50 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_row_reference_free (GtkTreeRowReference *reference)
|
|
|
|
|
{
|
|
|
|
|
RowRefList *refs;
|
|
|
|
|
|
2001-06-18 23:44:41 +00:00
|
|
|
|
if (reference == NULL)
|
|
|
|
|
return;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2001-05-25 23:10:49 +00:00
|
|
|
|
refs = g_object_get_data (G_OBJECT (reference->proxy), ROW_REF_DATA_STRING);
|
|
|
|
|
|
|
|
|
|
if (refs == NULL)
|
|
|
|
|
{
|
|
|
|
|
g_warning (G_STRLOC": bad row reference, proxy has no outstanding row references");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
refs->list = g_slist_remove (refs->list, reference);
|
|
|
|
|
|
|
|
|
|
if (refs->list == NULL)
|
2001-02-28 21:37:50 +00:00
|
|
|
|
{
|
2001-05-25 23:10:49 +00:00
|
|
|
|
g_object_set_data (G_OBJECT (reference->proxy),
|
2011-01-12 23:48:20 +00:00
|
|
|
|
I_(ROW_REF_DATA_STRING),
|
|
|
|
|
NULL);
|
2001-02-28 21:37:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (reference->path)
|
2001-10-06 00:50:36 +00:00
|
|
|
|
{
|
2001-11-20 22:04:00 +00:00
|
|
|
|
gtk_tree_row_reference_unref_path (reference->path, reference->model, reference->path->depth);
|
2001-10-06 00:50:36 +00:00
|
|
|
|
gtk_tree_path_free (reference->path);
|
|
|
|
|
}
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2002-01-31 23:47:23 +00:00
|
|
|
|
g_object_unref (reference->proxy);
|
|
|
|
|
g_object_unref (reference->model);
|
2001-02-28 21:37:50 +00:00
|
|
|
|
g_free (reference);
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-23 05:45:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_row_reference_inserted:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @proxy: a #GObject
|
|
|
|
|
* @path: the row position that was inserted
|
|
|
|
|
*
|
|
|
|
|
* Lets a set of row reference created by
|
|
|
|
|
* gtk_tree_row_reference_new_proxy() know that the
|
|
|
|
|
* model emitted the #GtkTreeModel::row-inserted signal.
|
|
|
|
|
*/
|
2001-02-28 21:37:50 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_row_reference_inserted (GObject *proxy,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreePath *path)
|
2001-02-28 21:37:50 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (G_IS_OBJECT (proxy));
|
|
|
|
|
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
gtk_tree_row_ref_inserted ((RowRefList *)g_object_get_data (proxy, ROW_REF_DATA_STRING), path, NULL);
|
2001-02-28 21:37:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-02-23 05:45:40 +00:00
|
|
|
|
/**
|
2002-03-05 22:44:27 +00:00
|
|
|
|
* gtk_tree_row_reference_deleted:
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @proxy: a #GObject
|
|
|
|
|
* @path: the path position that was deleted
|
|
|
|
|
*
|
|
|
|
|
* Lets a set of row reference created by
|
|
|
|
|
* gtk_tree_row_reference_new_proxy() know that the
|
|
|
|
|
* model emitted the #GtkTreeModel::row-deleted signal.
|
|
|
|
|
*/
|
2001-02-28 21:37:50 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_row_reference_deleted (GObject *proxy,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreePath *path)
|
2001-02-28 21:37:50 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (G_IS_OBJECT (proxy));
|
|
|
|
|
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
gtk_tree_row_ref_deleted ((RowRefList *)g_object_get_data (proxy, ROW_REF_DATA_STRING), path);
|
2001-02-28 21:37:50 +00:00
|
|
|
|
}
|
2001-03-30 01:26:30 +00:00
|
|
|
|
|
2002-02-23 05:45:40 +00:00
|
|
|
|
/**
|
2011-01-18 05:37:11 +00:00
|
|
|
|
* gtk_tree_row_reference_reordered: (skip)
|
2011-01-12 23:48:20 +00:00
|
|
|
|
* @proxy: a #GObject
|
|
|
|
|
* @path: the parent path of the reordered signal
|
|
|
|
|
* @iter: the iter pointing to the parent of the reordered
|
|
|
|
|
* @new_order: the new order of rows
|
|
|
|
|
*
|
|
|
|
|
* Lets a set of row reference created by
|
|
|
|
|
* gtk_tree_row_reference_new_proxy() know that the
|
|
|
|
|
* model emitted the #GtkTreeModel::rows-reordered signal.
|
|
|
|
|
*/
|
2001-03-30 01:26:30 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_row_reference_reordered (GObject *proxy,
|
2011-01-12 23:48:20 +00:00
|
|
|
|
GtkTreePath *path,
|
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
|
gint *new_order)
|
2001-03-30 01:26:30 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (G_IS_OBJECT (proxy));
|
|
|
|
|
|
Fix major bug in row ref handling, so the new combo box will actually work
Sat Aug 16 16:22:23 2003 Kristian Rietveld <kris@gtk.org>
Fix major bug in row ref handling, so the new combo box
will actually work right (:. Bug #107748. Patch written
with help from Tim Janik.
The basic idea is to update the row refs in a closure,
before the actual signal is emitted (rather than having
the model connect signal handlers).
* gtk/gtktreemodel.c (gtk_tree_model_base_init): change
g_signal_new calls for row_inserted, row_deleted and
rows_reordered to use the new marshallers,
(row_inserted_marshall), (row_deleted_marshall),
(rows_reordered_marshall): the new marshallers,
(gtk_tree_row_ref_inserted_callback): renamed to
gtk_tree_row_ref_inserted since it isn't a callback
anymore and gets called by the marshaller now,
(gtk_tree_row_ref_deleted_callback): likewise,
(gtk_tree_row_ref_reordered_callback): likewise,
(connect_ref_callbacks), (disconnect_ref_callbacks):
removed,
(gtk_tree_row_reference_new_proxy),
(gtk_tree_row_reference_free),
(gtk_tree_row_reference_inserted),
(gtk_tree_row_reference_deleted),
(gtk_tree_row_reference_reordered): updated.
2003-08-16 14:39:33 +00:00
|
|
|
|
gtk_tree_row_ref_reordered ((RowRefList *)g_object_get_data (proxy, ROW_REF_DATA_STRING), path, iter, new_order);
|
2001-03-30 01:26:30 +00:00
|
|
|
|
}
|