2000-10-05 01:04:57 +00:00
|
|
|
|
/* gtktreeselection.h
|
|
|
|
|
* 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"
|
2004-10-28 15:00:05 +00:00
|
|
|
|
#include <string.h>
|
2000-10-05 01:04:57 +00:00
|
|
|
|
#include "gtktreeselection.h"
|
|
|
|
|
#include "gtktreeprivate.h"
|
2019-01-07 03:28:09 +00:00
|
|
|
|
#include "gtktreerbtreeprivate.h"
|
2001-11-17 23:28:51 +00:00
|
|
|
|
#include "gtkmarshalers.h"
|
2005-09-01 05:11:46 +00:00
|
|
|
|
#include "gtkintl.h"
|
2014-06-09 15:49:45 +00:00
|
|
|
|
#include "gtkprivate.h"
|
2011-03-31 22:03:52 +00:00
|
|
|
|
#include "gtktypebuiltins.h"
|
2010-07-09 17:22:23 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2010-10-22 20:24:36 +00:00
|
|
|
|
/**
|
2021-03-02 03:50:53 +00:00
|
|
|
|
* GtkTreeSelection:
|
|
|
|
|
*
|
|
|
|
|
* The selection object for GtkTreeView
|
2010-10-22 20:24:36 +00:00
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* The `GtkTreeSelection` object is a helper object to manage the selection
|
|
|
|
|
* for a `GtkTreeView` widget. The `GtkTreeSelection` object is
|
|
|
|
|
* automatically created when a new `GtkTreeView` widget is created, and
|
2014-02-26 09:46:43 +00:00
|
|
|
|
* cannot exist independently of this widget. The primary reason the
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* `GtkTreeSelection` objects exists is for cleanliness of code and API.
|
2010-10-22 20:24:36 +00:00
|
|
|
|
* That is, there is no conceptual reason all these functions could not be
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* methods on the `GtkTreeView` widget instead of a separate function.
|
2010-10-22 20:24:36 +00:00
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* The `GtkTreeSelection` object is gotten from a `GtkTreeView` by calling
|
2010-10-22 20:24:36 +00:00
|
|
|
|
* gtk_tree_view_get_selection(). It can be manipulated to check the
|
|
|
|
|
* selection status of the tree, as well as select and deselect individual
|
|
|
|
|
* rows. Selection is done completely view side. As a result, multiple
|
|
|
|
|
* views of the same model can have completely different selections.
|
|
|
|
|
* Additionally, you cannot change the selection of a row on the model that
|
|
|
|
|
* is not currently displayed by the view without expanding its parents
|
|
|
|
|
* first.
|
|
|
|
|
*
|
|
|
|
|
* One of the important things to remember when monitoring the selection of
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* a view is that the `GtkTreeSelection`::changed signal is mostly a hint.
|
2012-12-12 02:30:22 +00:00
|
|
|
|
* That is, it may only emit one signal when a range of rows is selected.
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* Additionally, it may on occasion emit a `GtkTreeSelection`::changed signal
|
2010-10-22 20:24:36 +00:00
|
|
|
|
* when nothing has happened (mostly as a result of programmers calling
|
|
|
|
|
* select_row on an already selected row).
|
|
|
|
|
*/
|
|
|
|
|
|
2019-05-29 01:42:38 +00:00
|
|
|
|
typedef struct _GtkTreeSelectionClass GtkTreeSelectionClass;
|
|
|
|
|
|
|
|
|
|
struct _GtkTreeSelection
|
|
|
|
|
{
|
|
|
|
|
GObject parent;
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
GtkTreeView *tree_view;
|
|
|
|
|
GtkSelectionMode type;
|
|
|
|
|
GtkTreeSelectionFunc user_func;
|
|
|
|
|
gpointer user_data;
|
|
|
|
|
GDestroyNotify destroy;
|
2019-05-29 01:42:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _GtkTreeSelectionClass
|
|
|
|
|
{
|
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
|
|
|
|
|
void (* changed) (GtkTreeSelection *selection);
|
|
|
|
|
};
|
|
|
|
|
|
2001-02-28 00:35:25 +00:00
|
|
|
|
static void gtk_tree_selection_finalize (GObject *object);
|
2020-07-24 13:54:49 +00:00
|
|
|
|
static int gtk_tree_selection_real_select_all (GtkTreeSelection *selection);
|
|
|
|
|
static int gtk_tree_selection_real_unselect_all (GtkTreeSelection *selection);
|
|
|
|
|
static int gtk_tree_selection_real_select_node (GtkTreeSelection *selection,
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBTree *tree,
|
|
|
|
|
GtkTreeRBNode *node,
|
2000-10-06 00:06:00 +00:00
|
|
|
|
gboolean select);
|
2011-03-31 22:03:52 +00:00
|
|
|
|
static void gtk_tree_selection_set_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
static void gtk_tree_selection_get_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_MODE,
|
|
|
|
|
N_PROPERTIES
|
|
|
|
|
};
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
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
|
|
|
|
enum
|
|
|
|
|
{
|
2001-06-07 22:33:14 +00:00
|
|
|
|
CHANGED,
|
2000-10-05 01:04:57 +00:00
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
|
2011-03-31 22:03:52 +00:00
|
|
|
|
static GParamSpec *properties[N_PROPERTIES];
|
2001-08-22 22:27:41 +00:00
|
|
|
|
static guint tree_selection_signals [LAST_SIGNAL] = { 0 };
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
G_DEFINE_TYPE(GtkTreeSelection, gtk_tree_selection, G_TYPE_OBJECT)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_tree_selection_class_init (GtkTreeSelectionClass *class)
|
|
|
|
|
{
|
2001-02-28 00:35:25 +00:00
|
|
|
|
GObjectClass *object_class;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2001-02-28 00:35:25 +00:00
|
|
|
|
object_class = (GObjectClass*) class;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2001-02-28 00:35:25 +00:00
|
|
|
|
object_class->finalize = gtk_tree_selection_finalize;
|
2011-03-31 22:03:52 +00:00
|
|
|
|
object_class->set_property = gtk_tree_selection_set_property;
|
|
|
|
|
object_class->get_property = gtk_tree_selection_get_property;
|
2001-06-07 22:33:14 +00:00
|
|
|
|
class->changed = NULL;
|
doh, this was broken beyond believe.
Tue Dec 12 23:46:44 2000 Tim Janik <timj@gtk.org>
* gtk/stock-icons/Makefile.am: doh, this was broken beyond believe.
* gtk/gtkbox.c: change property types from (u)long to (u)int for
::position and ::padding.
* gtk/gtkcontainer.c: make ::border_width an INT property.
* gtk/gtkpacker.c: make ::position an INT property.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_adjustment_changed):
guard against NULL h/v scrollbars, since this is used at construction
time.
* gtk/gtkclist.[hc]: nuked gtk_clist_construct(), implemented
internal gtk_clist_constructor().
* gtk/gtkctree.[hc]: nuked gtk_ctree_construct(), implemented
gtk_ctree_constructor().
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): property
::pulse_step should use ARG_PULSE_STEP, not ARG_FRACTION.
* docs/reference/Makefile.am: fun stuff, disabled docs generation
again, gtk-scan.c needs to introspec paramspecs, not GtkAgs.
* gtk/gtkwidget.[hc]:
removed gtk_widget_setv(), gtk_widget_getv(), gtk_widget_newv()
and gtk_widget_get().
(gtk_widget_new): use g_object_new_valist().
(gtk_widget_set): use g_object_set_valist().
* gtk/gtkobject.[hc]:
removed gtk_object_arg_get_info(), gtk_object_getv(),
gtk_object_query_args(), gtk_object_newv(),
gtk_object_class_add_signals(),
gtk_object_class_user_signal_new(),
gtk_object_class_user_signal_newv(),
gtk_object_arg_set(), gtk_object_arg_get(),
gtk_object_args_collect(),
gtk_object_default_construct(),
gtk_object_constructed(),
GTK_CONSTRUCTED and GTK_OBJECT_CONSTRUCTED().
removed nsignals, signals and n_args members from GtkObjectClass.
(gtk_object_new): use g_object_new_valist().
(gtk_object_set): use g_object_set_valist().
(gtk_object_get): use g_object_get_valist().
* gtk/gtkcompat.h: define gtk_object_default_construct().
* gtk/gtktypeutils.c (gtk_type_new): create constructed objects via
g_object_new().
* gtk/*.c: removed gtk_object_class_add_signals() from class_init()
fucntions, cleaned up method assignments (make sure your structures
are setup properly before calling out). removed all GTK_CONSTRUCTED
hacks ;)
2000-12-13 01:34:41 +00:00
|
|
|
|
|
2011-03-31 22:03:52 +00:00
|
|
|
|
/* Properties */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkTreeSelection:mode:
|
|
|
|
|
*
|
|
|
|
|
* Selection mode.
|
|
|
|
|
* See gtk_tree_selection_set_mode() for more information on this property.
|
|
|
|
|
*/
|
2022-05-11 12:19:39 +00:00
|
|
|
|
properties[PROP_MODE] = g_param_spec_enum ("mode", NULL, NULL,
|
2011-03-31 22:03:52 +00:00
|
|
|
|
GTK_TYPE_SELECTION_MODE,
|
|
|
|
|
GTK_SELECTION_SINGLE,
|
2014-06-09 15:49:45 +00:00
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2011-03-31 22:03:52 +00:00
|
|
|
|
|
|
|
|
|
/* Install all properties */
|
|
|
|
|
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
|
|
|
|
|
|
|
|
|
/* Signals */
|
|
|
|
|
|
2010-10-22 20:24:36 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkTreeSelection::changed:
|
|
|
|
|
* @treeselection: the object which received the signal.
|
|
|
|
|
*
|
|
|
|
|
* Emitted whenever the selection has (possibly) changed. Please note that
|
|
|
|
|
* this signal is mostly a hint. It may only be emitted once when a range
|
|
|
|
|
* of rows are selected, and it may occasionally be emitted when nothing
|
|
|
|
|
* has happened.
|
|
|
|
|
*/
|
2001-06-07 22:33:14 +00:00
|
|
|
|
tree_selection_signals[CHANGED] =
|
2005-09-01 05:11:46 +00:00
|
|
|
|
g_signal_new (I_("changed"),
|
2002-10-07 19:10:39 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (GtkTreeSelectionClass, changed),
|
|
|
|
|
NULL, NULL,
|
2016-08-29 14:00:17 +00:00
|
|
|
|
NULL,
|
2002-10-07 19:10:39 +00:00
|
|
|
|
G_TYPE_NONE, 0);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_tree_selection_init (GtkTreeSelection *selection)
|
|
|
|
|
{
|
2019-12-17 01:54:23 +00:00
|
|
|
|
selection->type = GTK_SELECTION_SINGLE;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-28 00:35:25 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_tree_selection_finalize (GObject *object)
|
|
|
|
|
{
|
2002-03-03 05:41:28 +00:00
|
|
|
|
GtkTreeSelection *selection = GTK_TREE_SELECTION (object);
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (selection->destroy)
|
|
|
|
|
selection->destroy (selection->user_data);
|
2001-08-17 16:33:04 +00:00
|
|
|
|
|
|
|
|
|
/* chain parent_class' handler */
|
2006-05-02 23:56:43 +00:00
|
|
|
|
G_OBJECT_CLASS (gtk_tree_selection_parent_class)->finalize (object);
|
2001-02-28 00:35:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-03-31 22:03:52 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_tree_selection_set_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (object));
|
|
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_MODE:
|
|
|
|
|
gtk_tree_selection_set_mode (GTK_TREE_SELECTION (object), g_value_get_enum (value));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_tree_selection_get_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (object));
|
|
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_MODE:
|
|
|
|
|
g_value_set_enum (value, gtk_tree_selection_get_mode (GTK_TREE_SELECTION (object)));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
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
|
|
|
|
* _gtk_tree_selection_new:
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* Creates a new `GtkTreeSelection` object. This function should not be invoked,
|
|
|
|
|
* as each `GtkTreeView` will create its own `GtkTreeSelection`.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* Returns: A newly created `GtkTreeSelection` object.
|
2000-10-16 07:03:54 +00:00
|
|
|
|
**/
|
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
|
|
|
|
GtkTreeSelection*
|
|
|
|
|
_gtk_tree_selection_new (void)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
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
|
|
|
|
GtkTreeSelection *selection;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2002-10-07 19:10:39 +00:00
|
|
|
|
selection = g_object_new (GTK_TYPE_TREE_SELECTION, NULL);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
return selection;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
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
|
|
|
|
* _gtk_tree_selection_new_with_tree_view:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @tree_view: The `GtkTreeView`.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* Creates a new `GtkTreeSelection` object. This function should not be invoked,
|
|
|
|
|
* as each `GtkTreeView` will create its own `GtkTreeSelection`.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* Returns: A newly created `GtkTreeSelection` object.
|
2000-10-16 07:03:54 +00:00
|
|
|
|
**/
|
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
|
|
|
|
GtkTreeSelection*
|
|
|
|
|
_gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
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
|
|
|
|
GtkTreeSelection *selection;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
|
|
|
|
|
|
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
|
|
|
|
selection = _gtk_tree_selection_new ();
|
|
|
|
|
_gtk_tree_selection_set_tree_view (selection, tree_view);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
return selection;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
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
|
|
|
|
* _gtk_tree_selection_set_tree_view:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
|
|
|
|
* @tree_view: The `GtkTreeView`.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* Sets the `GtkTreeView` of @selection. This function should not be invoked, as
|
|
|
|
|
* it is used internally by `GtkTreeView`.
|
2000-10-16 07:03:54 +00:00
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
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
|
|
|
|
_gtk_tree_selection_set_tree_view (GtkTreeSelection *selection,
|
|
|
|
|
GtkTreeView *tree_view)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2010-12-19 05:01:22 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
|
|
|
|
if (tree_view != NULL)
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
selection->tree_view = tree_view;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
2001-01-04 21:33:24 +00:00
|
|
|
|
* gtk_tree_selection_set_mode:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
2001-06-24 15:34:48 +00:00
|
|
|
|
* @type: The selection mode
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2001-06-24 15:34:48 +00:00
|
|
|
|
* Sets the selection mode of the @selection. If the previous type was
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* %GTK_SELECTION_MULTIPLE, then the anchor is kept selected, if it was
|
2001-08-27 19:19:24 +00:00
|
|
|
|
* previously selected.
|
2000-10-16 07:03:54 +00:00
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
2001-08-27 19:19:24 +00:00
|
|
|
|
gtk_tree_selection_set_mode (GtkTreeSelection *selection,
|
|
|
|
|
GtkSelectionMode type)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2001-10-31 20:20:12 +00:00
|
|
|
|
GtkTreeSelectionFunc tmp_func;
|
2010-12-19 05:01:22 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (selection->type == type)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2001-10-31 20:20:12 +00:00
|
|
|
|
if (type == GTK_SELECTION_NONE)
|
|
|
|
|
{
|
|
|
|
|
/* We do this so that we unconditionally unset all rows
|
|
|
|
|
*/
|
2019-12-17 01:54:23 +00:00
|
|
|
|
tmp_func = selection->user_func;
|
|
|
|
|
selection->user_func = NULL;
|
2001-10-31 20:20:12 +00:00
|
|
|
|
gtk_tree_selection_unselect_all (selection);
|
2019-12-17 01:54:23 +00:00
|
|
|
|
selection->user_func = tmp_func;
|
2002-04-05 16:28:14 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_set_anchor_path (selection->tree_view, NULL);
|
2001-10-31 20:20:12 +00:00
|
|
|
|
}
|
|
|
|
|
else if (type == GTK_SELECTION_SINGLE ||
|
|
|
|
|
type == GTK_SELECTION_BROWSE)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBTree *tree = NULL;
|
|
|
|
|
GtkTreeRBNode *node = NULL;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int selected = FALSE;
|
2001-10-31 20:20:12 +00:00
|
|
|
|
GtkTreePath *anchor_path = NULL;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
anchor_path = _gtk_tree_view_get_anchor_path (selection->tree_view);
|
2010-11-30 07:36:07 +00:00
|
|
|
|
|
|
|
|
|
if (anchor_path)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_find_node (selection->tree_view,
|
2010-11-30 07:36:07 +00:00
|
|
|
|
anchor_path,
|
|
|
|
|
&tree,
|
|
|
|
|
&node);
|
|
|
|
|
|
2019-01-07 03:28:09 +00:00
|
|
|
|
if (node && GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED))
|
2010-11-30 07:36:07 +00:00
|
|
|
|
selected = TRUE;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
2001-10-31 20:20:12 +00:00
|
|
|
|
|
|
|
|
|
/* We do this so that we unconditionally unset all rows
|
2000-10-16 07:03:54 +00:00
|
|
|
|
*/
|
2019-12-17 01:54:23 +00:00
|
|
|
|
tmp_func = selection->user_func;
|
|
|
|
|
selection->user_func = NULL;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gtk_tree_selection_unselect_all (selection);
|
2019-12-17 01:54:23 +00:00
|
|
|
|
selection->user_func = tmp_func;
|
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
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
if (node && selected)
|
2001-10-31 20:20:12 +00:00
|
|
|
|
_gtk_tree_selection_internal_select_node (selection,
|
|
|
|
|
node,
|
|
|
|
|
tree,
|
|
|
|
|
anchor_path,
|
Merge from stable.
Mon Aug 25 23:21:43 2003 Kristian Rietveld <kris@gtk.org>
Merge from stable.
Fixes #115871, reported by Michael Natterer.
* gtk/gtktreeprivate.h: added GtkTreeSelectMode enum,
added ctrl_pressed and shift_pressed bitfields,
(_gtk_tree_selection_internal_select_node): replace GdkModifierType
arg with GtkTreeSelectMode.
* gtk/gtktreeselection.c (gtk_tree_selection_set_mode),
(gtk_tree_selection_select_path), (gtk_tree_selection_unselect_path),
(_gtk_tree_selection_internal_select_node): all updated for
GdkModifierType -> GtkTreeSelectMode move.
* gtk/gtktreeview.c (gtk_tree_view_button_press): set ctrl_pressed
and shift_pressed around selection handling block,
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_selection_cursor_parent),
(gtk_tree_view_real_set_cursor): use ctrl_pressed and shift_pressed,
instead of checking the event state. And also updates for the
GdkModifierType -> GtkTreeSelectMode move.
2003-08-25 21:33:00 +00:00
|
|
|
|
0,
|
2002-04-09 19:48:32 +00:00
|
|
|
|
FALSE);
|
2001-11-02 00:13:30 +00:00
|
|
|
|
if (anchor_path)
|
|
|
|
|
gtk_tree_path_free (anchor_path);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
2001-10-31 20:20:12 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
selection->type = type;
|
2011-03-31 22:03:52 +00:00
|
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (selection), properties[PROP_MODE]);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_get_mode:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: a `GtkTreeSelection`
|
2001-06-24 15:34:48 +00:00
|
|
|
|
*
|
|
|
|
|
* Gets the selection mode for @selection. See
|
|
|
|
|
* gtk_tree_selection_set_mode().
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: the current selection mode
|
2001-06-24 15:34:48 +00:00
|
|
|
|
**/
|
2001-08-27 19:19:24 +00:00
|
|
|
|
GtkSelectionMode
|
2001-06-24 15:34:48 +00:00
|
|
|
|
gtk_tree_selection_get_mode (GtkTreeSelection *selection)
|
|
|
|
|
{
|
2001-08-27 19:19:24 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), GTK_SELECTION_SINGLE);
|
2001-06-24 15:34:48 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
return selection->type;
|
2001-06-24 15:34:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_set_select_function:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
2018-11-18 12:36:50 +00:00
|
|
|
|
* @func: (nullable): The selection function. May be %NULL
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* @data: The selection function’s data. May be %NULL
|
2010-08-10 11:30:21 +00:00
|
|
|
|
* @destroy: The destroy function for user data. May be %NULL
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2010-08-10 11:30:21 +00:00
|
|
|
|
* Sets the selection function.
|
|
|
|
|
*
|
|
|
|
|
* If set, this function is called before any node is selected or unselected,
|
|
|
|
|
* giving some control over which nodes are selected. The select function
|
|
|
|
|
* should return %TRUE if the state of the node may be toggled, and %FALSE
|
|
|
|
|
* if the state of the node should be left unchanged.
|
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_selection_set_select_function (GtkTreeSelection *selection,
|
|
|
|
|
GtkTreeSelectionFunc func,
|
2001-02-28 00:35:25 +00:00
|
|
|
|
gpointer data,
|
2008-06-18 09:12:32 +00:00
|
|
|
|
GDestroyNotify destroy)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2010-12-19 05:01:22 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (selection->destroy)
|
|
|
|
|
selection->destroy (selection->user_data);
|
2002-03-03 05:41:28 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
selection->user_func = func;
|
|
|
|
|
selection->user_data = data;
|
|
|
|
|
selection->destroy = destroy;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-06-20 11:01:18 +00:00
|
|
|
|
/**
|
2010-09-18 16:42:15 +00:00
|
|
|
|
* gtk_tree_selection_get_select_function: (skip)
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
2008-06-20 11:01:18 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns the current selection function.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: The function.
|
2008-06-20 11:01:18 +00:00
|
|
|
|
**/
|
|
|
|
|
GtkTreeSelectionFunc
|
|
|
|
|
gtk_tree_selection_get_select_function (GtkTreeSelection *selection)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), NULL);
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
return selection->user_func;
|
2008-06-20 11:01:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
2010-09-18 16:42:15 +00:00
|
|
|
|
* gtk_tree_selection_get_user_data: (skip)
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2000-10-16 07:03:54 +00:00
|
|
|
|
* Returns the user data for the selection function.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: The user data.
|
2000-10-16 07:03:54 +00:00
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gpointer
|
|
|
|
|
gtk_tree_selection_get_user_data (GtkTreeSelection *selection)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), NULL);
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
return selection->user_data;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-09-08 18:23:47 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_get_tree_view:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`
|
2001-09-08 18:23:47 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns the tree view associated with @selection.
|
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* Returns: (transfer none): A `GtkTreeView`
|
2001-09-08 18:23:47 +00:00
|
|
|
|
**/
|
|
|
|
|
GtkTreeView *
|
2001-01-04 23:36:19 +00:00
|
|
|
|
gtk_tree_selection_get_tree_view (GtkTreeSelection *selection)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), NULL);
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
return selection->tree_view;
|
2001-01-04 23:36:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_get_selected:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
|
|
|
|
* @model: (out) (optional) (transfer none): A pointer to set to the `GtkTreeModel`
|
|
|
|
|
* @iter: (out) (optional): The `GtkTreeIter`
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2000-10-26 00:36:47 +00:00
|
|
|
|
* Sets @iter to the currently selected node if @selection is set to
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* %GTK_SELECTION_SINGLE or %GTK_SELECTION_BROWSE. @iter may be NULL if you
|
2001-08-27 19:19:24 +00:00
|
|
|
|
* just want to test if @selection has any selected nodes. @model is filled
|
|
|
|
|
* with the current model as a convenience. This function will not work if you
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* use @selection is %GTK_SELECTION_MULTIPLE.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: TRUE, if there is a selected node.
|
2000-10-16 07:03:54 +00:00
|
|
|
|
**/
|
2000-10-26 00:36:47 +00:00
|
|
|
|
gboolean
|
2000-11-09 16:52:17 +00:00
|
|
|
|
gtk_tree_selection_get_selected (GtkTreeSelection *selection,
|
|
|
|
|
GtkTreeModel **model,
|
|
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBTree *tree;
|
|
|
|
|
GtkTreeRBNode *node;
|
2001-01-27 00:50:38 +00:00
|
|
|
|
GtkTreePath *anchor_path;
|
2013-11-20 17:37:15 +00:00
|
|
|
|
gboolean retval = FALSE;
|
2002-04-13 20:48:31 +00:00
|
|
|
|
gboolean found_node;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2000-10-26 00:36:47 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), FALSE);
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_val_if_fail (selection->type != GTK_SELECTION_MULTIPLE, FALSE);
|
|
|
|
|
g_return_val_if_fail (selection->tree_view != NULL, FALSE);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2004-10-06 18:51:03 +00:00
|
|
|
|
/* Clear the iter */
|
|
|
|
|
if (iter)
|
|
|
|
|
memset (iter, 0, sizeof (GtkTreeIter));
|
|
|
|
|
|
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
|
|
|
|
if (model)
|
2019-12-17 01:54:23 +00:00
|
|
|
|
*model = gtk_tree_view_get_model (selection->tree_view);
|
2001-01-27 00:50:38 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
anchor_path = _gtk_tree_view_get_anchor_path (selection->tree_view);
|
2001-01-27 00:50:38 +00:00
|
|
|
|
|
|
|
|
|
if (anchor_path == NULL)
|
|
|
|
|
return FALSE;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
found_node = !_gtk_tree_view_find_node (selection->tree_view,
|
2002-04-13 20:48:31 +00:00
|
|
|
|
anchor_path,
|
|
|
|
|
&tree,
|
|
|
|
|
&node);
|
|
|
|
|
|
2019-01-07 03:28:09 +00:00
|
|
|
|
if (found_node && GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED))
|
2001-01-27 00:50:38 +00:00
|
|
|
|
{
|
2002-04-13 20:48:31 +00:00
|
|
|
|
/* we only want to return the anchor if it exists in the rbtree and
|
|
|
|
|
* is selected.
|
2001-01-27 00:50:38 +00:00
|
|
|
|
*/
|
2002-04-13 20:48:31 +00:00
|
|
|
|
if (iter == NULL)
|
|
|
|
|
retval = TRUE;
|
|
|
|
|
else
|
2019-12-17 01:54:23 +00:00
|
|
|
|
retval = gtk_tree_model_get_iter (gtk_tree_view_get_model (selection->tree_view),
|
2002-04-13 20:48:31 +00:00
|
|
|
|
iter,
|
|
|
|
|
anchor_path);
|
2001-01-27 00:50:38 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2002-04-13 20:48:31 +00:00
|
|
|
|
/* We don't want to return the anchor if it isn't actually selected.
|
|
|
|
|
*/
|
|
|
|
|
retval = FALSE;
|
2001-01-27 00:50:38 +00:00
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2001-01-27 00:50:38 +00:00
|
|
|
|
gtk_tree_path_free (anchor_path);
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2001-01-27 00:50:38 +00:00
|
|
|
|
return retval;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-06-05 21:25:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_get_selected_rows:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
|
|
|
|
* @model: (out) (optional) (transfer none): A pointer to set to the `GtkTreeModel`
|
2002-06-05 21:25:52 +00:00
|
|
|
|
*
|
|
|
|
|
* Creates a list of path of all selected rows. Additionally, if you are
|
|
|
|
|
* planning on modifying the model after calling this function, you may
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* want to convert the returned list into a list of `GtkTreeRowReference`s.
|
2004-04-23 19:06:02 +00:00
|
|
|
|
* To do this, you can use gtk_tree_row_reference_new().
|
2002-06-05 21:25:52 +00:00
|
|
|
|
*
|
|
|
|
|
* To free the return value, use:
|
2014-01-27 19:55:18 +00:00
|
|
|
|
* |[<!-- language="C" -->
|
2011-12-10 04:26:06 +00:00
|
|
|
|
* g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
|
2007-11-25 06:51:19 +00:00
|
|
|
|
* ]|
|
2002-06-05 21:25:52 +00:00
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* Returns: (element-type GtkTreePath) (transfer full): A `GList` containing a `GtkTreePath` for each selected row.
|
2002-06-05 21:25:52 +00:00
|
|
|
|
**/
|
|
|
|
|
GList *
|
|
|
|
|
gtk_tree_selection_get_selected_rows (GtkTreeSelection *selection,
|
|
|
|
|
GtkTreeModel **model)
|
|
|
|
|
{
|
|
|
|
|
GList *list = NULL;
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBTree *tree = NULL;
|
|
|
|
|
GtkTreeRBNode *node = NULL;
|
2002-06-05 21:25:52 +00:00
|
|
|
|
GtkTreePath *path;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), NULL);
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_val_if_fail (selection->tree_view != NULL, NULL);
|
2002-06-05 21:25:52 +00:00
|
|
|
|
|
2006-10-02 01:29:24 +00:00
|
|
|
|
if (model)
|
2019-12-17 01:54:23 +00:00
|
|
|
|
*model = gtk_tree_view_get_model (selection->tree_view);
|
2006-10-02 01:29:24 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
tree = _gtk_tree_view_get_rbtree (selection->tree_view);
|
2010-11-30 07:36:07 +00:00
|
|
|
|
|
|
|
|
|
if (tree == NULL || tree->root == NULL)
|
2002-06-05 21:25:52 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (selection->type == GTK_SELECTION_NONE)
|
2002-06-05 21:25:52 +00:00
|
|
|
|
return NULL;
|
2019-12-17 01:54:23 +00:00
|
|
|
|
else if (selection->type != GTK_SELECTION_MULTIPLE)
|
2002-06-05 21:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
|
|
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
|
|
|
|
|
{
|
2019-12-17 01:54:23 +00:00
|
|
|
|
path = gtk_tree_model_get_path (gtk_tree_view_get_model (selection->tree_view), &iter);
|
2002-06-05 21:25:52 +00:00
|
|
|
|
list = g_list_append (list, path);
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-07 03:28:09 +00:00
|
|
|
|
node = gtk_tree_rbtree_first (tree);
|
2002-06-05 21:25:52 +00:00
|
|
|
|
path = gtk_tree_path_new_first ();
|
|
|
|
|
|
2013-11-20 17:38:01 +00:00
|
|
|
|
while (node != NULL)
|
2002-06-05 21:25:52 +00:00
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
if (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED))
|
2004-02-18 23:42:46 +00:00
|
|
|
|
list = g_list_prepend (list, gtk_tree_path_copy (path));
|
2002-06-05 21:25:52 +00:00
|
|
|
|
|
|
|
|
|
if (node->children)
|
|
|
|
|
{
|
|
|
|
|
tree = node->children;
|
2019-01-07 03:28:09 +00:00
|
|
|
|
node = gtk_tree_rbtree_first (tree);
|
2002-06-05 21:25:52 +00:00
|
|
|
|
|
|
|
|
|
gtk_tree_path_append_index (path, 0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gboolean done = FALSE;
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
node = gtk_tree_rbtree_next (tree, node);
|
2002-06-05 21:25:52 +00:00
|
|
|
|
if (node != NULL)
|
|
|
|
|
{
|
|
|
|
|
done = TRUE;
|
|
|
|
|
gtk_tree_path_next (path);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
node = tree->parent_node;
|
|
|
|
|
tree = tree->parent_tree;
|
|
|
|
|
|
|
|
|
|
if (!tree)
|
|
|
|
|
{
|
|
|
|
|
gtk_tree_path_free (path);
|
2004-02-18 23:42:46 +00:00
|
|
|
|
|
|
|
|
|
goto done;
|
2002-06-05 21:25:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_tree_path_up (path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while (!done);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
|
2004-02-18 23:42:46 +00:00
|
|
|
|
done:
|
|
|
|
|
return g_list_reverse (list);
|
2002-06-05 21:25:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2019-01-07 03:28:09 +00:00
|
|
|
|
gtk_tree_selection_count_selected_rows_helper (GtkTreeRBTree *tree,
|
|
|
|
|
GtkTreeRBNode *node,
|
|
|
|
|
gpointer data)
|
2002-06-05 21:25:52 +00:00
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int *count = (int *)data;
|
2002-06-05 21:25:52 +00:00
|
|
|
|
|
2013-11-20 17:38:01 +00:00
|
|
|
|
g_return_if_fail (node != NULL);
|
|
|
|
|
|
2019-01-07 03:28:09 +00:00
|
|
|
|
if (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED))
|
2002-06-05 21:25:52 +00:00
|
|
|
|
(*count)++;
|
|
|
|
|
|
|
|
|
|
if (node->children)
|
2019-01-07 03:28:09 +00:00
|
|
|
|
gtk_tree_rbtree_traverse (node->children, node->children->root,
|
|
|
|
|
G_PRE_ORDER,
|
|
|
|
|
gtk_tree_selection_count_selected_rows_helper, data);
|
2002-06-05 21:25:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_count_selected_rows:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
2002-06-05 21:25:52 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns the number of rows that have been selected in @tree.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: The number of rows selected.
|
2002-06-05 21:25:52 +00:00
|
|
|
|
**/
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int
|
2002-06-05 21:25:52 +00:00
|
|
|
|
gtk_tree_selection_count_selected_rows (GtkTreeSelection *selection)
|
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int count = 0;
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBTree *tree;
|
2002-06-05 21:25:52 +00:00
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), 0);
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_val_if_fail (selection->tree_view != NULL, 0);
|
2002-06-05 21:25:52 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
tree = _gtk_tree_view_get_rbtree (selection->tree_view);
|
2010-11-30 07:36:07 +00:00
|
|
|
|
|
|
|
|
|
if (tree == NULL || tree->root == NULL)
|
2002-06-05 21:25:52 +00:00
|
|
|
|
return 0;
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (selection->type == GTK_SELECTION_SINGLE ||
|
|
|
|
|
selection->type == GTK_SELECTION_BROWSE)
|
2002-06-05 21:25:52 +00:00
|
|
|
|
{
|
|
|
|
|
if (gtk_tree_selection_get_selected (selection, NULL, NULL))
|
2019-01-07 03:28:09 +00:00
|
|
|
|
return 1;
|
2002-06-05 21:25:52 +00:00
|
|
|
|
else
|
2019-01-07 03:28:09 +00:00
|
|
|
|
return 0;
|
2002-06-05 21:25:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-01-07 03:28:09 +00:00
|
|
|
|
gtk_tree_rbtree_traverse (tree, tree->root,
|
|
|
|
|
G_PRE_ORDER,
|
|
|
|
|
gtk_tree_selection_count_selected_rows_helper,
|
|
|
|
|
&count);
|
2002-06-05 21:25:52 +00:00
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
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_tree_selection_selected_foreach helper */
|
|
|
|
|
static void
|
|
|
|
|
model_changed (gpointer data)
|
|
|
|
|
{
|
|
|
|
|
gboolean *stop = (gboolean *)data;
|
|
|
|
|
|
|
|
|
|
*stop = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_selected_foreach:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
2010-09-18 16:42:15 +00:00
|
|
|
|
* @func: (scope call): The function to call for each selected node.
|
2000-10-16 07:03:54 +00:00
|
|
|
|
* @data: user data to pass to the function.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2002-06-05 21:25:52 +00:00
|
|
|
|
* Calls a function for each selected node. Note that you cannot modify
|
|
|
|
|
* the tree or selection from within this function. As a result,
|
|
|
|
|
* gtk_tree_selection_get_selected_rows() might be more useful.
|
2000-10-16 07:03:54 +00:00
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
|
|
|
|
|
GtkTreeSelectionForeachFunc func,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
GtkTreePath *path;
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBTree *tree;
|
|
|
|
|
GtkTreeRBNode *node;
|
2000-10-26 00:36:47 +00:00
|
|
|
|
GtkTreeIter iter;
|
2005-11-29 19:34:15 +00:00
|
|
|
|
GtkTreeModel *model;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2005-11-29 19:34:15 +00:00
|
|
|
|
gulong inserted_id, deleted_id, reordered_id, changed_id;
|
2005-07-12 23:01:17 +00:00
|
|
|
|
gboolean stop = FALSE;
|
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
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_if_fail (selection->tree_view != NULL);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
tree = _gtk_tree_view_get_rbtree (selection->tree_view);
|
2010-11-30 07:36:07 +00:00
|
|
|
|
|
|
|
|
|
if (func == NULL || tree == NULL || tree->root == NULL)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
model = gtk_tree_view_get_model (selection->tree_view);
|
2010-11-30 07:36:07 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (selection->type == GTK_SELECTION_SINGLE ||
|
|
|
|
|
selection->type == GTK_SELECTION_BROWSE)
|
2001-04-03 19:13:08 +00:00
|
|
|
|
{
|
2019-12-17 01:54:23 +00:00
|
|
|
|
path = _gtk_tree_view_get_anchor_path (selection->tree_view);
|
2010-11-30 07:36:07 +00:00
|
|
|
|
|
|
|
|
|
if (path)
|
2001-06-29 07:28:08 +00:00
|
|
|
|
{
|
2010-11-30 07:36:07 +00:00
|
|
|
|
gtk_tree_model_get_iter (model, &iter, path);
|
|
|
|
|
(* func) (model, path, &iter, data);
|
2001-06-29 07:28:08 +00:00
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
}
|
2001-04-03 19:13:08 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-07 03:28:09 +00:00
|
|
|
|
node = gtk_tree_rbtree_first (tree);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2005-11-29 19:34:15 +00:00
|
|
|
|
g_object_ref (model);
|
|
|
|
|
|
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
|
|
|
|
/* connect to signals to monitor changes in treemodel */
|
2008-08-08 14:23:32 +00:00
|
|
|
|
inserted_id = g_signal_connect_swapped (model, "row-inserted",
|
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_CALLBACK (model_changed),
|
|
|
|
|
&stop);
|
2008-08-08 14:23:32 +00:00
|
|
|
|
deleted_id = g_signal_connect_swapped (model, "row-deleted",
|
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_CALLBACK (model_changed),
|
|
|
|
|
&stop);
|
2008-08-08 14:23:32 +00:00
|
|
|
|
reordered_id = g_signal_connect_swapped (model, "rows-reordered",
|
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_CALLBACK (model_changed),
|
|
|
|
|
&stop);
|
2019-12-17 01:54:23 +00:00
|
|
|
|
changed_id = g_signal_connect_swapped (selection->tree_view, "notify::model",
|
2005-11-29 19:34:15 +00:00
|
|
|
|
G_CALLBACK (model_changed),
|
|
|
|
|
&stop);
|
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
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
/* find the node internally */
|
2002-02-24 04:18:44 +00:00
|
|
|
|
path = gtk_tree_path_new_first ();
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2013-11-20 17:38:01 +00:00
|
|
|
|
while (node != NULL)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
if (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED))
|
2005-07-12 23:01:17 +00:00
|
|
|
|
{
|
2005-11-29 19:34:15 +00:00
|
|
|
|
gtk_tree_model_get_iter (model, &iter, path);
|
|
|
|
|
(* func) (model, path, &iter, data);
|
2005-07-12 23:01:17 +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
|
|
|
|
|
|
|
|
|
if (stop)
|
|
|
|
|
goto out;
|
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
if (node->children)
|
|
|
|
|
{
|
|
|
|
|
tree = node->children;
|
2019-01-07 03:28:09 +00:00
|
|
|
|
node = gtk_tree_rbtree_first (tree);
|
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
|
|
|
|
|
2005-07-12 23:01:17 +00:00
|
|
|
|
gtk_tree_path_append_index (path, 0);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gboolean done = FALSE;
|
2005-07-12 23:01:17 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
do
|
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
node = gtk_tree_rbtree_next (tree, node);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
if (node != NULL)
|
|
|
|
|
{
|
|
|
|
|
done = TRUE;
|
2001-06-29 07:28:08 +00:00
|
|
|
|
gtk_tree_path_next (path);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
node = tree->parent_node;
|
|
|
|
|
tree = tree->parent_tree;
|
2005-07-12 23:01:17 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
if (tree == NULL)
|
2001-06-29 07:28:08 +00:00
|
|
|
|
{
|
|
|
|
|
/* we've run out of tree */
|
|
|
|
|
/* We're done with this function */
|
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
|
|
|
|
|
|
|
|
|
goto out;
|
2001-06-29 07:28:08 +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
|
|
|
|
|
2001-06-29 07:28:08 +00:00
|
|
|
|
gtk_tree_path_up (path);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while (!done);
|
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
if (path)
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
|
2005-11-29 19:34:15 +00:00
|
|
|
|
g_signal_handler_disconnect (model, inserted_id);
|
|
|
|
|
g_signal_handler_disconnect (model, deleted_id);
|
|
|
|
|
g_signal_handler_disconnect (model, reordered_id);
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_signal_handler_disconnect (selection->tree_view, changed_id);
|
2005-11-29 19:34:15 +00:00
|
|
|
|
g_object_unref (model);
|
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
|
|
|
|
|
|
|
|
|
/* check if we have to spew a scary message */
|
|
|
|
|
if (stop)
|
2005-11-29 19:34:15 +00:00
|
|
|
|
g_warning ("The model has been modified from within gtk_tree_selection_selected_foreach.\n"
|
|
|
|
|
"This function is for observing the selections of the tree only. If\n"
|
|
|
|
|
"you are trying to get all selected items from the tree, try using\n"
|
2016-02-28 16:06:25 +00:00
|
|
|
|
"gtk_tree_selection_get_selected_rows instead.");
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_select_path:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
|
|
|
|
* @path: The `GtkTreePath` to be selected.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2000-10-16 07:03:54 +00:00
|
|
|
|
* Select the row at @path.
|
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_selection_select_path (GtkTreeSelection *selection,
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreePath *path)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBNode *node;
|
|
|
|
|
GtkTreeRBTree *tree;
|
2002-04-08 17:42:45 +00:00
|
|
|
|
gboolean ret;
|
Merge from stable.
Mon Aug 25 23:21:43 2003 Kristian Rietveld <kris@gtk.org>
Merge from stable.
Fixes #115871, reported by Michael Natterer.
* gtk/gtktreeprivate.h: added GtkTreeSelectMode enum,
added ctrl_pressed and shift_pressed bitfields,
(_gtk_tree_selection_internal_select_node): replace GdkModifierType
arg with GtkTreeSelectMode.
* gtk/gtktreeselection.c (gtk_tree_selection_set_mode),
(gtk_tree_selection_select_path), (gtk_tree_selection_unselect_path),
(_gtk_tree_selection_internal_select_node): all updated for
GdkModifierType -> GtkTreeSelectMode move.
* gtk/gtktreeview.c (gtk_tree_view_button_press): set ctrl_pressed
and shift_pressed around selection handling block,
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_selection_cursor_parent),
(gtk_tree_view_real_set_cursor): use ctrl_pressed and shift_pressed,
instead of checking the event state. And also updates for the
GdkModifierType -> GtkTreeSelectMode move.
2003-08-25 21:33:00 +00:00
|
|
|
|
GtkTreeSelectMode mode = 0;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_if_fail (selection->tree_view != NULL);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
g_return_if_fail (path != NULL);
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
ret = _gtk_tree_view_find_node (selection->tree_view,
|
2002-04-08 17:42:45 +00:00
|
|
|
|
path,
|
|
|
|
|
&tree,
|
|
|
|
|
&node);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2019-01-07 03:28:09 +00:00
|
|
|
|
if (node == NULL || GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED) ||
|
2002-04-08 17:42:45 +00:00
|
|
|
|
ret == TRUE)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (selection->type == GTK_SELECTION_MULTIPLE)
|
Merge from stable.
Mon Aug 25 23:21:43 2003 Kristian Rietveld <kris@gtk.org>
Merge from stable.
Fixes #115871, reported by Michael Natterer.
* gtk/gtktreeprivate.h: added GtkTreeSelectMode enum,
added ctrl_pressed and shift_pressed bitfields,
(_gtk_tree_selection_internal_select_node): replace GdkModifierType
arg with GtkTreeSelectMode.
* gtk/gtktreeselection.c (gtk_tree_selection_set_mode),
(gtk_tree_selection_select_path), (gtk_tree_selection_unselect_path),
(_gtk_tree_selection_internal_select_node): all updated for
GdkModifierType -> GtkTreeSelectMode move.
* gtk/gtktreeview.c (gtk_tree_view_button_press): set ctrl_pressed
and shift_pressed around selection handling block,
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_selection_cursor_parent),
(gtk_tree_view_real_set_cursor): use ctrl_pressed and shift_pressed,
instead of checking the event state. And also updates for the
GdkModifierType -> GtkTreeSelectMode move.
2003-08-25 21:33:00 +00:00
|
|
|
|
mode = GTK_TREE_SELECT_MODE_TOGGLE;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
_gtk_tree_selection_internal_select_node (selection,
|
|
|
|
|
node,
|
|
|
|
|
tree,
|
|
|
|
|
path,
|
Merge from stable.
Mon Aug 25 23:21:43 2003 Kristian Rietveld <kris@gtk.org>
Merge from stable.
Fixes #115871, reported by Michael Natterer.
* gtk/gtktreeprivate.h: added GtkTreeSelectMode enum,
added ctrl_pressed and shift_pressed bitfields,
(_gtk_tree_selection_internal_select_node): replace GdkModifierType
arg with GtkTreeSelectMode.
* gtk/gtktreeselection.c (gtk_tree_selection_set_mode),
(gtk_tree_selection_select_path), (gtk_tree_selection_unselect_path),
(_gtk_tree_selection_internal_select_node): all updated for
GdkModifierType -> GtkTreeSelectMode move.
* gtk/gtktreeview.c (gtk_tree_view_button_press): set ctrl_pressed
and shift_pressed around selection handling block,
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_selection_cursor_parent),
(gtk_tree_view_real_set_cursor): use ctrl_pressed and shift_pressed,
instead of checking the event state. And also updates for the
GdkModifierType -> GtkTreeSelectMode move.
2003-08-25 21:33:00 +00:00
|
|
|
|
mode,
|
2002-04-09 19:48:32 +00:00
|
|
|
|
FALSE);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_unselect_path:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
|
|
|
|
* @path: The `GtkTreePath` to be unselected.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2000-10-16 07:03:54 +00:00
|
|
|
|
* Unselects the row at @path.
|
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_selection_unselect_path (GtkTreeSelection *selection,
|
|
|
|
|
GtkTreePath *path)
|
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBNode *node;
|
|
|
|
|
GtkTreeRBTree *tree;
|
2002-04-08 17:42:45 +00:00
|
|
|
|
gboolean ret;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_if_fail (selection->tree_view != NULL);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
g_return_if_fail (path != NULL);
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
ret = _gtk_tree_view_find_node (selection->tree_view,
|
2002-04-08 17:42:45 +00:00
|
|
|
|
path,
|
|
|
|
|
&tree,
|
|
|
|
|
&node);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2019-01-07 03:28:09 +00:00
|
|
|
|
if (node == NULL || !GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED) ||
|
2002-04-08 17:42:45 +00:00
|
|
|
|
ret == TRUE)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
_gtk_tree_selection_internal_select_node (selection,
|
|
|
|
|
node,
|
|
|
|
|
tree,
|
|
|
|
|
path,
|
Merge from stable.
Mon Aug 25 23:21:43 2003 Kristian Rietveld <kris@gtk.org>
Merge from stable.
Fixes #115871, reported by Michael Natterer.
* gtk/gtktreeprivate.h: added GtkTreeSelectMode enum,
added ctrl_pressed and shift_pressed bitfields,
(_gtk_tree_selection_internal_select_node): replace GdkModifierType
arg with GtkTreeSelectMode.
* gtk/gtktreeselection.c (gtk_tree_selection_set_mode),
(gtk_tree_selection_select_path), (gtk_tree_selection_unselect_path),
(_gtk_tree_selection_internal_select_node): all updated for
GdkModifierType -> GtkTreeSelectMode move.
* gtk/gtktreeview.c (gtk_tree_view_button_press): set ctrl_pressed
and shift_pressed around selection handling block,
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_selection_cursor_parent),
(gtk_tree_view_real_set_cursor): use ctrl_pressed and shift_pressed,
instead of checking the event state. And also updates for the
GdkModifierType -> GtkTreeSelectMode move.
2003-08-25 21:33:00 +00:00
|
|
|
|
GTK_TREE_SELECT_MODE_TOGGLE,
|
2002-04-09 19:48:32 +00:00
|
|
|
|
TRUE);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
2000-10-26 00:36:47 +00:00
|
|
|
|
* gtk_tree_selection_select_iter:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
|
|
|
|
* @iter: The `GtkTreeIter` to be selected.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2000-10-26 00:36:47 +00:00
|
|
|
|
* Selects the specified iterator.
|
2000-10-16 07:03:54 +00:00
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
2000-10-26 00:36:47 +00:00
|
|
|
|
gtk_tree_selection_select_iter (GtkTreeSelection *selection,
|
|
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
|
|
|
|
GtkTreePath *path;
|
2010-11-30 07:36:07 +00:00
|
|
|
|
GtkTreeModel *model;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_if_fail (selection->tree_view != NULL);
|
2010-11-30 07:36:07 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
model = gtk_tree_view_get_model (selection->tree_view);
|
2010-11-30 07:36:07 +00:00
|
|
|
|
g_return_if_fail (model != NULL);
|
2001-01-27 20:50:52 +00:00
|
|
|
|
g_return_if_fail (iter != NULL);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2010-11-30 07:36:07 +00:00
|
|
|
|
path = gtk_tree_model_get_path (model, iter);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
if (path == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
gtk_tree_selection_select_path (selection, path);
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
2000-10-26 00:36:47 +00:00
|
|
|
|
* gtk_tree_selection_unselect_iter:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
|
|
|
|
* @iter: The `GtkTreeIter` to be unselected.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2000-10-26 00:36:47 +00:00
|
|
|
|
* Unselects the specified iterator.
|
2000-10-16 07:03:54 +00:00
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
2000-10-26 00:36:47 +00:00
|
|
|
|
gtk_tree_selection_unselect_iter (GtkTreeSelection *selection,
|
|
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
|
|
|
|
GtkTreePath *path;
|
2010-11-30 07:36:07 +00:00
|
|
|
|
GtkTreeModel *model;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_if_fail (selection->tree_view != NULL);
|
2010-11-30 07:36:07 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
model = gtk_tree_view_get_model (selection->tree_view);
|
2010-11-30 07:36:07 +00:00
|
|
|
|
g_return_if_fail (model != NULL);
|
2001-01-27 20:50:52 +00:00
|
|
|
|
g_return_if_fail (iter != NULL);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2010-11-30 07:36:07 +00:00
|
|
|
|
path = gtk_tree_model_get_path (model, iter);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
if (path == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
2002-03-13 04:23:50 +00:00
|
|
|
|
gtk_tree_selection_unselect_path (selection, path);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-10 05:35:12 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_path_is_selected:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
|
|
|
|
* @path: A `GtkTreePath` to check selection on.
|
2001-10-10 05:35:12 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns %TRUE if the row pointed to by @path is currently selected. If @path
|
|
|
|
|
* does not point to a valid location, %FALSE is returned
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if @path is selected.
|
2001-10-10 05:35:12 +00:00
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
gtk_tree_selection_path_is_selected (GtkTreeSelection *selection,
|
|
|
|
|
GtkTreePath *path)
|
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBNode *node;
|
|
|
|
|
GtkTreeRBTree *tree;
|
2002-04-08 17:42:45 +00:00
|
|
|
|
gboolean ret;
|
2001-10-10 05:35:12 +00:00
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), FALSE);
|
|
|
|
|
g_return_val_if_fail (path != NULL, FALSE);
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_val_if_fail (selection->tree_view != NULL, FALSE);
|
2004-07-09 00:53:48 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (gtk_tree_view_get_model (selection->tree_view) == NULL)
|
2004-07-09 00:53:48 +00:00
|
|
|
|
return FALSE;
|
2001-10-10 05:35:12 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
ret = _gtk_tree_view_find_node (selection->tree_view,
|
2002-04-08 17:42:45 +00:00
|
|
|
|
path,
|
|
|
|
|
&tree,
|
|
|
|
|
&node);
|
2001-10-10 05:35:12 +00:00
|
|
|
|
|
2019-01-07 03:28:09 +00:00
|
|
|
|
if ((node == NULL) || !GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED) ||
|
2002-04-08 17:42:45 +00:00
|
|
|
|
ret == TRUE)
|
2001-10-10 05:35:12 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_iter_is_selected:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`
|
|
|
|
|
* @iter: A valid `GtkTreeIter`
|
2001-10-10 05:35:12 +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
|
|
|
|
* Returns %TRUE if the row at @iter is currently selected.
|
2001-10-10 05:35:12 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE, if @iter is selected
|
2001-10-10 05:35:12 +00:00
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
gtk_tree_selection_iter_is_selected (GtkTreeSelection *selection,
|
|
|
|
|
GtkTreeIter *iter)
|
|
|
|
|
{
|
|
|
|
|
GtkTreePath *path;
|
2010-11-30 07:36:07 +00:00
|
|
|
|
GtkTreeModel *model;
|
2001-10-10 05:35:12 +00:00
|
|
|
|
gboolean retval;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), FALSE);
|
|
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_val_if_fail (selection->tree_view != NULL, FALSE);
|
2001-10-10 05:35:12 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
model = gtk_tree_view_get_model (selection->tree_view);
|
2010-11-30 07:36:07 +00:00
|
|
|
|
g_return_val_if_fail (model != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
path = gtk_tree_model_get_path (model, iter);
|
2001-10-10 05:35:12 +00:00
|
|
|
|
if (path == NULL)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
retval = gtk_tree_selection_path_is_selected (selection, path);
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
/* Wish I was in python, right now... */
|
|
|
|
|
struct _TempTuple {
|
|
|
|
|
GtkTreeSelection *selection;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int dirty;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
2019-01-07 03:28:09 +00:00
|
|
|
|
select_all_helper (GtkTreeRBTree *tree,
|
|
|
|
|
GtkTreeRBNode *node,
|
Fix GtkTreeNode *node ->GtkTreeNode node issue.
2000-10-15 <jrb@redhat.com>
* gtk/gtktreeview.c, gtk/gtktreeview.h, gtk/gtktreestore.h,
gtk/gtktreestore.c, gtk/gtkliststore.h, gtk/gtkliststore.c,
gtk/gtkmodelsimple.c, gtk/gtkmodelsimple.h, gtk/gtktreedatalist.c,
gtk/gtktreemodel.h, gtk/gtktreeselection.c,
gtk/gtktreeselection.h: Fix GtkTreeNode *node ->GtkTreeNode node
issue.
2000-10-15 17:46:23 +00:00
|
|
|
|
gpointer data)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct _TempTuple *tuple = data;
|
|
|
|
|
|
|
|
|
|
if (node->children)
|
2019-01-07 03:28:09 +00:00
|
|
|
|
gtk_tree_rbtree_traverse (node->children,
|
2000-10-05 01:04:57 +00:00
|
|
|
|
node->children->root,
|
|
|
|
|
G_PRE_ORDER,
|
|
|
|
|
select_all_helper,
|
|
|
|
|
data);
|
2019-01-07 03:28:09 +00:00
|
|
|
|
if (!GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED))
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2000-10-06 00:06:00 +00:00
|
|
|
|
tuple->dirty = gtk_tree_selection_real_select_node (tuple->selection, tree, node, TRUE) || tuple->dirty;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-06 00:06:00 +00:00
|
|
|
|
|
|
|
|
|
/* We have a real_{un,}select_all function that doesn't emit the signal, so we
|
|
|
|
|
* can use it in other places without fear of the signal being emitted.
|
|
|
|
|
*/
|
2020-07-24 13:54:49 +00:00
|
|
|
|
static int
|
2000-10-06 00:06:00 +00:00
|
|
|
|
gtk_tree_selection_real_select_all (GtkTreeSelection *selection)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct _TempTuple *tuple;
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBTree *tree;
|
2001-03-10 01:34:48 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
tree = _gtk_tree_view_get_rbtree (selection->tree_view);
|
2010-11-30 07:36:07 +00:00
|
|
|
|
|
|
|
|
|
if (tree == NULL)
|
2000-10-06 00:06:00 +00:00
|
|
|
|
return FALSE;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2001-03-10 01:34:48 +00:00
|
|
|
|
/* Mark all nodes selected */
|
|
|
|
|
tuple = g_new (struct _TempTuple, 1);
|
|
|
|
|
tuple->selection = selection;
|
|
|
|
|
tuple->dirty = FALSE;
|
|
|
|
|
|
2019-01-07 03:28:09 +00:00
|
|
|
|
gtk_tree_rbtree_traverse (tree, tree->root,
|
|
|
|
|
G_PRE_ORDER,
|
|
|
|
|
select_all_helper,
|
|
|
|
|
tuple);
|
2001-03-10 01:34:48 +00:00
|
|
|
|
if (tuple->dirty)
|
2000-10-06 00:06:00 +00:00
|
|
|
|
{
|
|
|
|
|
g_free (tuple);
|
2001-03-10 01:34:48 +00:00
|
|
|
|
return TRUE;
|
2000-10-06 00:06:00 +00:00
|
|
|
|
}
|
2001-03-10 01:34:48 +00:00
|
|
|
|
g_free (tuple);
|
|
|
|
|
return FALSE;
|
2000-10-06 00:06:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_select_all:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* Selects all the nodes. @selection must be set to %GTK_SELECTION_MULTIPLE
|
2001-08-27 19:19:24 +00:00
|
|
|
|
* mode.
|
2000-10-16 07:03:54 +00:00
|
|
|
|
**/
|
2000-10-06 00:06:00 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_selection_select_all (GtkTreeSelection *selection)
|
|
|
|
|
{
|
2010-12-19 05:01:22 +00:00
|
|
|
|
|
2000-10-06 00:06:00 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_if_fail (selection->tree_view != NULL);
|
2004-07-09 00:53:48 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (_gtk_tree_view_get_rbtree (selection->tree_view) == NULL ||
|
|
|
|
|
gtk_tree_view_get_model (selection->tree_view) == NULL)
|
2001-08-13 17:23:41 +00:00
|
|
|
|
return;
|
2004-07-09 00:53:48 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_if_fail (selection->type == GTK_SELECTION_MULTIPLE);
|
2000-10-06 00:06:00 +00:00
|
|
|
|
|
|
|
|
|
if (gtk_tree_selection_real_select_all (selection))
|
2002-10-07 19:10:39 +00:00
|
|
|
|
g_signal_emit (selection, tree_selection_signals[CHANGED], 0);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2019-01-07 03:28:09 +00:00
|
|
|
|
unselect_all_helper (GtkTreeRBTree *tree,
|
|
|
|
|
GtkTreeRBNode *node,
|
|
|
|
|
gpointer data)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct _TempTuple *tuple = data;
|
|
|
|
|
|
|
|
|
|
if (node->children)
|
2019-01-07 03:28:09 +00:00
|
|
|
|
gtk_tree_rbtree_traverse (node->children,
|
|
|
|
|
node->children->root,
|
|
|
|
|
G_PRE_ORDER,
|
|
|
|
|
unselect_all_helper,
|
|
|
|
|
data);
|
|
|
|
|
if (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED))
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2000-10-06 00:06:00 +00:00
|
|
|
|
tuple->dirty = gtk_tree_selection_real_select_node (tuple->selection, tree, node, FALSE) || tuple->dirty;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-16 09:54:41 +00:00
|
|
|
|
static gboolean
|
2000-10-06 00:06:00 +00:00
|
|
|
|
gtk_tree_selection_real_unselect_all (GtkTreeSelection *selection)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct _TempTuple *tuple;
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (selection->type == GTK_SELECTION_SINGLE ||
|
|
|
|
|
selection->type == GTK_SELECTION_BROWSE)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBTree *tree = NULL;
|
|
|
|
|
GtkTreeRBNode *node = NULL;
|
2001-01-27 00:50:38 +00:00
|
|
|
|
GtkTreePath *anchor_path;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
anchor_path = _gtk_tree_view_get_anchor_path (selection->tree_view);
|
2001-01-27 00:50:38 +00:00
|
|
|
|
|
|
|
|
|
if (anchor_path == NULL)
|
|
|
|
|
return FALSE;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_find_node (selection->tree_view,
|
2001-01-27 00:50:38 +00:00
|
|
|
|
anchor_path,
|
2000-10-05 01:04:57 +00:00
|
|
|
|
&tree,
|
|
|
|
|
&node);
|
2001-01-27 00:50:38 +00:00
|
|
|
|
|
|
|
|
|
gtk_tree_path_free (anchor_path);
|
remove validation idle
2001-02-08 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_destroy_layout): remove
validation idle
* demos/gtk-demo/main.c (create_tree): adjust to changes in text
cell renderer
* demos/pixbuf-demo.c (timeout): remove deprecated
gtk_widget_draw
* demos/testpixbuf-save.c (main): remove deprecated
gtk_drawing_area_size
* gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate
buttons even if the model isn't setup. gtk_tree_view_check_dirty()
at the start of the allocation.
(gtk_tree_view_check_dirty): handle column->button == NULL, handle
unsetup or NULL model.
* gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the
even/odd/sorted cells in the tree view.
* gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all):
bugfixes
* gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row
backgrounds with draw_flat_box using different detail for even/odd
rows.
* gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each
row, so we can draw the alternating colors thing
* gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a
property from a synonym property, notify for the synonym.
Also, nuke the background_gdk_set and foreground_gdk_set synonyms
(gtk_text_tag_get_property): Always return the font, even if
all its fields aren't set
* gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't
store the attr list; it leaves us with no way to change attributes
in _render according to the render flags, and no way to implement
get_property. Instead store all the specific text attributes.
Separate whether an attribute is enabled from its value. Sync all
properties with GtkTextTag, make them all consistent, etc.
* gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so
renderers can highlight the sort row/column
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use
accessor functions to get values; this has the side effect of
showing up which accessor functions were missing. Added those.
* gtk/gtktreeviewcolumn.h: Replace set_justification with
set_alignment, to be consistent with GtkLabel, GtkMisc
* gtk/gtktreeviewcolumn.c: Added code to display sort indicator
arrow.
* gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h
* gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
|
|
|
|
|
|
|
|
|
if (tree == NULL)
|
|
|
|
|
return FALSE;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2019-01-07 03:28:09 +00:00
|
|
|
|
if (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED))
|
2000-10-06 00:06:00 +00:00
|
|
|
|
{
|
2001-02-28 00:35:25 +00:00
|
|
|
|
if (gtk_tree_selection_real_select_node (selection, tree, node, FALSE))
|
|
|
|
|
{
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_set_anchor_path (selection->tree_view, NULL);
|
2001-02-28 00:35:25 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2000-10-06 00:06:00 +00:00
|
|
|
|
}
|
|
|
|
|
return FALSE;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
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
|
|
|
|
else
|
2001-02-28 21:37:50 +00:00
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBTree *tree;
|
2010-11-30 07:36:07 +00:00
|
|
|
|
|
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
|
|
|
|
tuple = g_new (struct _TempTuple, 1);
|
|
|
|
|
tuple->selection = selection;
|
|
|
|
|
tuple->dirty = FALSE;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
tree = _gtk_tree_view_get_rbtree (selection->tree_view);
|
2019-01-07 03:28:09 +00:00
|
|
|
|
gtk_tree_rbtree_traverse (tree, tree->root,
|
|
|
|
|
G_PRE_ORDER,
|
|
|
|
|
unselect_all_helper,
|
|
|
|
|
tuple);
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
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
|
|
|
|
if (tuple->dirty)
|
|
|
|
|
{
|
|
|
|
|
g_free (tuple);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2000-10-06 00:06:00 +00:00
|
|
|
|
g_free (tuple);
|
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
|
|
|
|
return FALSE;
|
2000-10-06 00:06:00 +00:00
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_unselect_all:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2000-10-16 07:03:54 +00:00
|
|
|
|
* Unselects all the nodes.
|
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
2000-10-06 00:06:00 +00:00
|
|
|
|
gtk_tree_selection_unselect_all (GtkTreeSelection *selection)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2010-12-19 05:01:22 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_if_fail (selection->tree_view != NULL);
|
2004-07-09 00:53:48 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (_gtk_tree_view_get_rbtree (selection->tree_view) == NULL ||
|
|
|
|
|
gtk_tree_view_get_model (selection->tree_view) == NULL)
|
2001-08-13 17:23:41 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2000-10-06 00:06:00 +00:00
|
|
|
|
if (gtk_tree_selection_real_unselect_all (selection))
|
2002-10-07 19:10:39 +00:00
|
|
|
|
g_signal_emit (selection, tree_selection_signals[CHANGED], 0);
|
2000-10-06 00:06:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-06-05 21:25:52 +00:00
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
RANGE_SELECT,
|
|
|
|
|
RANGE_UNSELECT
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-24 13:54:49 +00:00
|
|
|
|
static int
|
2002-06-05 21:25:52 +00:00
|
|
|
|
gtk_tree_selection_real_modify_range (GtkTreeSelection *selection,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int mode,
|
2000-10-06 00:06:00 +00:00
|
|
|
|
GtkTreePath *start_path,
|
|
|
|
|
GtkTreePath *end_path)
|
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBNode *start_node = NULL, *end_node = NULL;
|
|
|
|
|
GtkTreeRBTree *start_tree, *end_tree;
|
2002-11-20 01:05:26 +00:00
|
|
|
|
GtkTreePath *anchor_path = NULL;
|
2000-10-06 00:06:00 +00:00
|
|
|
|
gboolean dirty = FALSE;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
switch (gtk_tree_path_compare (start_path, end_path))
|
|
|
|
|
{
|
2001-04-23 23:03:53 +00:00
|
|
|
|
case 1:
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_find_node (selection->tree_view,
|
2000-10-05 01:04:57 +00:00
|
|
|
|
end_path,
|
|
|
|
|
&start_tree,
|
|
|
|
|
&start_node);
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_find_node (selection->tree_view,
|
2000-10-05 01:04:57 +00:00
|
|
|
|
start_path,
|
|
|
|
|
&end_tree,
|
|
|
|
|
&end_node);
|
2003-01-14 22:30:41 +00:00
|
|
|
|
anchor_path = start_path;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
break;
|
|
|
|
|
case 0:
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_find_node (selection->tree_view,
|
2000-10-05 01:04:57 +00:00
|
|
|
|
start_path,
|
|
|
|
|
&start_tree,
|
|
|
|
|
&start_node);
|
|
|
|
|
end_tree = start_tree;
|
|
|
|
|
end_node = start_node;
|
2002-11-18 19:33:28 +00:00
|
|
|
|
anchor_path = start_path;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
break;
|
2001-04-23 23:03:53 +00:00
|
|
|
|
case -1:
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_find_node (selection->tree_view,
|
2000-10-05 01:04:57 +00:00
|
|
|
|
start_path,
|
|
|
|
|
&start_tree,
|
|
|
|
|
&start_node);
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_find_node (selection->tree_view,
|
2000-10-05 01:04:57 +00:00
|
|
|
|
end_path,
|
|
|
|
|
&end_tree,
|
|
|
|
|
&end_node);
|
2002-11-18 19:33:28 +00:00
|
|
|
|
anchor_path = start_path;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
break;
|
2017-10-06 19:19:42 +00:00
|
|
|
|
default:
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
break;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-10 08:26:34 +00:00
|
|
|
|
/* Invalid start or end node? */
|
|
|
|
|
if (start_node == NULL || end_node == NULL)
|
|
|
|
|
return dirty;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2002-11-18 19:33:28 +00:00
|
|
|
|
if (anchor_path)
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_set_anchor_path (selection->tree_view, anchor_path);
|
2002-11-18 19:33:28 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
do
|
|
|
|
|
{
|
2002-06-05 21:25:52 +00:00
|
|
|
|
dirty |= gtk_tree_selection_real_select_node (selection, start_tree, start_node, (mode == RANGE_SELECT)?TRUE:FALSE);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
if (start_node == end_node)
|
2000-10-06 00:06:00 +00:00
|
|
|
|
break;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
if (start_node->children)
|
|
|
|
|
{
|
|
|
|
|
start_tree = start_node->children;
|
2019-01-07 03:28:09 +00:00
|
|
|
|
start_node = gtk_tree_rbtree_first (start_tree);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
gtk_tree_rbtree_next_full (start_tree, start_node, &start_tree, &start_node);
|
2001-08-22 22:27:41 +00:00
|
|
|
|
if (start_tree == NULL)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2001-08-22 22:27:41 +00:00
|
|
|
|
/* we just ran out of tree. That means someone passed in bogus values.
|
|
|
|
|
*/
|
|
|
|
|
return dirty;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while (TRUE);
|
2000-10-06 00:06:00 +00:00
|
|
|
|
|
|
|
|
|
return dirty;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-16 07:03:54 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_select_range:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
2000-10-16 07:03:54 +00:00
|
|
|
|
* @start_path: The initial node of the range.
|
|
|
|
|
* @end_path: The final node of the range.
|
2001-02-28 21:37:50 +00:00
|
|
|
|
*
|
2000-10-16 07:03:54 +00:00
|
|
|
|
* Selects a range of nodes, determined by @start_path and @end_path inclusive.
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection must be set to %GTK_SELECTION_MULTIPLE mode.
|
2000-10-16 07:03:54 +00:00
|
|
|
|
**/
|
2000-10-06 00:06:00 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_tree_selection_select_range (GtkTreeSelection *selection,
|
|
|
|
|
GtkTreePath *start_path,
|
|
|
|
|
GtkTreePath *end_path)
|
|
|
|
|
{
|
2010-12-19 05:01:22 +00:00
|
|
|
|
|
2000-10-06 00:06:00 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_if_fail (selection->tree_view != NULL);
|
|
|
|
|
g_return_if_fail (selection->type == GTK_SELECTION_MULTIPLE);
|
|
|
|
|
g_return_if_fail (gtk_tree_view_get_model (selection->tree_view) != NULL);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2002-06-05 21:25:52 +00:00
|
|
|
|
if (gtk_tree_selection_real_modify_range (selection, RANGE_SELECT, start_path, end_path))
|
2002-10-07 19:10:39 +00:00
|
|
|
|
g_signal_emit (selection, tree_selection_signals[CHANGED], 0);
|
2002-06-05 21:25:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_tree_selection_unselect_range:
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @selection: A `GtkTreeSelection`.
|
2002-06-05 21:25:52 +00:00
|
|
|
|
* @start_path: The initial node of the range.
|
|
|
|
|
* @end_path: The initial node of the range.
|
|
|
|
|
*
|
|
|
|
|
* Unselects a range of nodes, determined by @start_path and @end_path
|
|
|
|
|
* inclusive.
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gtk_tree_selection_unselect_range (GtkTreeSelection *selection,
|
|
|
|
|
GtkTreePath *start_path,
|
|
|
|
|
GtkTreePath *end_path)
|
|
|
|
|
{
|
2010-12-19 05:01:22 +00:00
|
|
|
|
|
2002-06-05 21:25:52 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
|
2019-12-17 01:54:23 +00:00
|
|
|
|
g_return_if_fail (selection->tree_view != NULL);
|
|
|
|
|
g_return_if_fail (gtk_tree_view_get_model (selection->tree_view) != NULL);
|
2002-06-05 21:25:52 +00:00
|
|
|
|
|
|
|
|
|
if (gtk_tree_selection_real_modify_range (selection, RANGE_UNSELECT, start_path, end_path))
|
2002-10-07 19:10:39 +00:00
|
|
|
|
g_signal_emit (selection, tree_selection_signals[CHANGED], 0);
|
2000-10-06 00:06:00 +00:00
|
|
|
|
}
|
2001-02-28 00:35:25 +00:00
|
|
|
|
|
2006-03-01 12:18:57 +00:00
|
|
|
|
gboolean
|
|
|
|
|
_gtk_tree_selection_row_is_selectable (GtkTreeSelection *selection,
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBNode *node,
|
|
|
|
|
GtkTreePath *path)
|
2004-05-27 03:31:17 +00:00
|
|
|
|
{
|
2004-07-07 15:15:35 +00:00
|
|
|
|
GtkTreeIter iter;
|
2010-11-30 07:36:07 +00:00
|
|
|
|
GtkTreeModel *model;
|
|
|
|
|
GtkTreeViewRowSeparatorFunc separator_func;
|
|
|
|
|
gpointer separator_data;
|
2004-07-07 15:15:35 +00:00
|
|
|
|
gboolean sensitive = FALSE;
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
model = gtk_tree_view_get_model (selection->tree_view);
|
2010-11-30 07:36:07 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_get_row_separator_func (selection->tree_view,
|
2010-11-30 07:36:07 +00:00
|
|
|
|
&separator_func, &separator_data);
|
|
|
|
|
|
|
|
|
|
if (!gtk_tree_model_get_iter (model, &iter, path))
|
2004-07-07 15:15:35 +00:00
|
|
|
|
sensitive = TRUE;
|
|
|
|
|
|
2010-11-30 07:36:07 +00:00
|
|
|
|
if (!sensitive && separator_func)
|
2004-07-07 15:15:35 +00:00
|
|
|
|
{
|
|
|
|
|
/* never allow separators to be selected */
|
2010-11-30 07:36:07 +00:00
|
|
|
|
if ((* separator_func) (model, &iter, separator_data))
|
2004-07-07 15:15:35 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (selection->user_func)
|
|
|
|
|
return (*selection->user_func) (selection, model, path,
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED),
|
2019-12-17 01:54:23 +00:00
|
|
|
|
selection->user_data);
|
2004-05-27 03:31:17 +00:00
|
|
|
|
else
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-10-06 00:06:00 +00:00
|
|
|
|
/* Called internally by gtktreeview.c It handles actually selecting the tree.
|
|
|
|
|
*/
|
2002-04-09 19:48:32 +00:00
|
|
|
|
|
2002-04-20 23:57:41 +00:00
|
|
|
|
/*
|
2014-02-07 19:03:49 +00:00
|
|
|
|
* docs about the “override_browse_mode”, we set this flag when we want to
|
2002-04-09 19:48:32 +00:00
|
|
|
|
* unset select the node and override the select browse mode behaviour (that is
|
|
|
|
|
* 'one node should *always* be selected').
|
|
|
|
|
*/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
void
|
|
|
|
|
_gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBNode *node,
|
|
|
|
|
GtkTreeRBTree *tree,
|
|
|
|
|
GtkTreePath *path,
|
Merge from stable.
Mon Aug 25 23:21:43 2003 Kristian Rietveld <kris@gtk.org>
Merge from stable.
Fixes #115871, reported by Michael Natterer.
* gtk/gtktreeprivate.h: added GtkTreeSelectMode enum,
added ctrl_pressed and shift_pressed bitfields,
(_gtk_tree_selection_internal_select_node): replace GdkModifierType
arg with GtkTreeSelectMode.
* gtk/gtktreeselection.c (gtk_tree_selection_set_mode),
(gtk_tree_selection_select_path), (gtk_tree_selection_unselect_path),
(_gtk_tree_selection_internal_select_node): all updated for
GdkModifierType -> GtkTreeSelectMode move.
* gtk/gtktreeview.c (gtk_tree_view_button_press): set ctrl_pressed
and shift_pressed around selection handling block,
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_selection_cursor_parent),
(gtk_tree_view_real_set_cursor): use ctrl_pressed and shift_pressed,
instead of checking the event state. And also updates for the
GdkModifierType -> GtkTreeSelectMode move.
2003-08-25 21:33:00 +00:00
|
|
|
|
GtkTreeSelectMode mode,
|
2019-01-07 03:28:09 +00:00
|
|
|
|
gboolean override_browse_mode)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int flags;
|
|
|
|
|
int dirty = FALSE;
|
2001-01-27 00:50:38 +00:00
|
|
|
|
GtkTreePath *anchor_path = NULL;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (selection->type == GTK_SELECTION_NONE)
|
2001-10-31 20:20:12 +00:00
|
|
|
|
return;
|
2001-02-28 00:35:25 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
anchor_path = _gtk_tree_view_get_anchor_path (selection->tree_view);
|
2001-01-27 00:50:38 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (selection->type == GTK_SELECTION_SINGLE ||
|
|
|
|
|
selection->type == GTK_SELECTION_BROWSE)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2002-04-09 19:48:32 +00:00
|
|
|
|
/* just unselect */
|
2019-12-17 01:54:23 +00:00
|
|
|
|
if (selection->type == GTK_SELECTION_BROWSE && override_browse_mode)
|
2002-04-09 19:48:32 +00:00
|
|
|
|
{
|
|
|
|
|
dirty = gtk_tree_selection_real_unselect_all (selection);
|
|
|
|
|
}
|
2001-02-28 00:35:25 +00:00
|
|
|
|
/* Did we try to select the same node again? */
|
2019-12-17 01:54:23 +00:00
|
|
|
|
else if (selection->type == GTK_SELECTION_SINGLE &&
|
2002-04-09 19:48:32 +00:00
|
|
|
|
anchor_path && gtk_tree_path_compare (path, anchor_path) == 0)
|
2001-02-28 00:35:25 +00:00
|
|
|
|
{
|
Merge from stable.
Mon Aug 25 23:21:43 2003 Kristian Rietveld <kris@gtk.org>
Merge from stable.
Fixes #115871, reported by Michael Natterer.
* gtk/gtktreeprivate.h: added GtkTreeSelectMode enum,
added ctrl_pressed and shift_pressed bitfields,
(_gtk_tree_selection_internal_select_node): replace GdkModifierType
arg with GtkTreeSelectMode.
* gtk/gtktreeselection.c (gtk_tree_selection_set_mode),
(gtk_tree_selection_select_path), (gtk_tree_selection_unselect_path),
(_gtk_tree_selection_internal_select_node): all updated for
GdkModifierType -> GtkTreeSelectMode move.
* gtk/gtktreeview.c (gtk_tree_view_button_press): set ctrl_pressed
and shift_pressed around selection handling block,
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_selection_cursor_parent),
(gtk_tree_view_real_set_cursor): use ctrl_pressed and shift_pressed,
instead of checking the event state. And also updates for the
GdkModifierType -> GtkTreeSelectMode move.
2003-08-25 21:33:00 +00:00
|
|
|
|
if ((mode & GTK_TREE_SELECT_MODE_TOGGLE) == GTK_TREE_SELECT_MODE_TOGGLE)
|
2001-02-28 00:35:25 +00:00
|
|
|
|
{
|
|
|
|
|
dirty = gtk_tree_selection_real_unselect_all (selection);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (anchor_path)
|
|
|
|
|
{
|
2002-01-10 00:11:32 +00:00
|
|
|
|
/* We only want to select the new node if we can unselect the old one,
|
|
|
|
|
* and we can select the new one. */
|
2006-03-01 12:18:57 +00:00
|
|
|
|
dirty = _gtk_tree_selection_row_is_selectable (selection, node, path);
|
2002-01-10 00:11:32 +00:00
|
|
|
|
|
|
|
|
|
/* if dirty is FALSE, we weren't able to select the new one, otherwise, we try to
|
|
|
|
|
* unselect the new one
|
|
|
|
|
*/
|
|
|
|
|
if (dirty)
|
|
|
|
|
dirty = gtk_tree_selection_real_unselect_all (selection);
|
|
|
|
|
|
|
|
|
|
/* if dirty is TRUE at this point, we successfully unselected the
|
|
|
|
|
* old one, and can then select the new one */
|
2001-02-28 00:35:25 +00:00
|
|
|
|
if (dirty)
|
|
|
|
|
{
|
2010-11-30 07:36:07 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_set_anchor_path (selection->tree_view, NULL);
|
2003-04-14 12:02:57 +00:00
|
|
|
|
|
2001-02-28 00:35:25 +00:00
|
|
|
|
if (gtk_tree_selection_real_select_node (selection, tree, node, TRUE))
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_set_anchor_path (selection->tree_view, path);
|
2001-02-28 00:35:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (gtk_tree_selection_real_select_node (selection, tree, node, TRUE))
|
|
|
|
|
{
|
|
|
|
|
dirty = TRUE;
|
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
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_set_anchor_path (selection->tree_view, path);
|
2001-02-28 00:35:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
2019-12-17 01:54:23 +00:00
|
|
|
|
else if (selection->type == GTK_SELECTION_MULTIPLE)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
Merge from stable.
Mon Aug 25 23:21:43 2003 Kristian Rietveld <kris@gtk.org>
Merge from stable.
Fixes #115871, reported by Michael Natterer.
* gtk/gtktreeprivate.h: added GtkTreeSelectMode enum,
added ctrl_pressed and shift_pressed bitfields,
(_gtk_tree_selection_internal_select_node): replace GdkModifierType
arg with GtkTreeSelectMode.
* gtk/gtktreeselection.c (gtk_tree_selection_set_mode),
(gtk_tree_selection_select_path), (gtk_tree_selection_unselect_path),
(_gtk_tree_selection_internal_select_node): all updated for
GdkModifierType -> GtkTreeSelectMode move.
* gtk/gtktreeview.c (gtk_tree_view_button_press): set ctrl_pressed
and shift_pressed around selection handling block,
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_selection_cursor_parent),
(gtk_tree_view_real_set_cursor): use ctrl_pressed and shift_pressed,
instead of checking the event state. And also updates for the
GdkModifierType -> GtkTreeSelectMode move.
2003-08-25 21:33:00 +00:00
|
|
|
|
if ((mode & GTK_TREE_SELECT_MODE_EXTEND) == GTK_TREE_SELECT_MODE_EXTEND
|
|
|
|
|
&& (anchor_path == NULL))
|
2001-02-28 00:35:25 +00:00
|
|
|
|
{
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_set_anchor_path (selection->tree_view, path);
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2001-02-28 00:35:25 +00:00
|
|
|
|
dirty = gtk_tree_selection_real_select_node (selection, tree, node, TRUE);
|
|
|
|
|
}
|
Merge from stable.
Mon Aug 25 23:21:43 2003 Kristian Rietveld <kris@gtk.org>
Merge from stable.
Fixes #115871, reported by Michael Natterer.
* gtk/gtktreeprivate.h: added GtkTreeSelectMode enum,
added ctrl_pressed and shift_pressed bitfields,
(_gtk_tree_selection_internal_select_node): replace GdkModifierType
arg with GtkTreeSelectMode.
* gtk/gtktreeselection.c (gtk_tree_selection_set_mode),
(gtk_tree_selection_select_path), (gtk_tree_selection_unselect_path),
(_gtk_tree_selection_internal_select_node): all updated for
GdkModifierType -> GtkTreeSelectMode move.
* gtk/gtktreeview.c (gtk_tree_view_button_press): set ctrl_pressed
and shift_pressed around selection handling block,
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_selection_cursor_parent),
(gtk_tree_view_real_set_cursor): use ctrl_pressed and shift_pressed,
instead of checking the event state. And also updates for the
GdkModifierType -> GtkTreeSelectMode move.
2003-08-25 21:33:00 +00:00
|
|
|
|
else if ((mode & (GTK_TREE_SELECT_MODE_EXTEND | GTK_TREE_SELECT_MODE_TOGGLE)) == (GTK_TREE_SELECT_MODE_EXTEND | GTK_TREE_SELECT_MODE_TOGGLE))
|
2001-02-28 00:35:25 +00:00
|
|
|
|
{
|
|
|
|
|
gtk_tree_selection_select_range (selection,
|
|
|
|
|
anchor_path,
|
|
|
|
|
path);
|
|
|
|
|
}
|
Merge from stable.
Mon Aug 25 23:21:43 2003 Kristian Rietveld <kris@gtk.org>
Merge from stable.
Fixes #115871, reported by Michael Natterer.
* gtk/gtktreeprivate.h: added GtkTreeSelectMode enum,
added ctrl_pressed and shift_pressed bitfields,
(_gtk_tree_selection_internal_select_node): replace GdkModifierType
arg with GtkTreeSelectMode.
* gtk/gtktreeselection.c (gtk_tree_selection_set_mode),
(gtk_tree_selection_select_path), (gtk_tree_selection_unselect_path),
(_gtk_tree_selection_internal_select_node): all updated for
GdkModifierType -> GtkTreeSelectMode move.
* gtk/gtktreeview.c (gtk_tree_view_button_press): set ctrl_pressed
and shift_pressed around selection handling block,
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_selection_cursor_parent),
(gtk_tree_view_real_set_cursor): use ctrl_pressed and shift_pressed,
instead of checking the event state. And also updates for the
GdkModifierType -> GtkTreeSelectMode move.
2003-08-25 21:33:00 +00:00
|
|
|
|
else if ((mode & GTK_TREE_SELECT_MODE_TOGGLE) == GTK_TREE_SELECT_MODE_TOGGLE)
|
2001-02-28 00:35:25 +00:00
|
|
|
|
{
|
|
|
|
|
flags = node->flags;
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_set_anchor_path (selection->tree_view, path);
|
2000-10-06 00:06:00 +00:00
|
|
|
|
|
2019-01-07 03:28:09 +00:00
|
|
|
|
if ((flags & GTK_TREE_RBNODE_IS_SELECTED) == GTK_TREE_RBNODE_IS_SELECTED)
|
2001-02-28 00:35:25 +00:00
|
|
|
|
dirty |= gtk_tree_selection_real_select_node (selection, tree, node, FALSE);
|
|
|
|
|
else
|
|
|
|
|
dirty |= gtk_tree_selection_real_select_node (selection, tree, node, TRUE);
|
|
|
|
|
}
|
Merge from stable.
Mon Aug 25 23:21:43 2003 Kristian Rietveld <kris@gtk.org>
Merge from stable.
Fixes #115871, reported by Michael Natterer.
* gtk/gtktreeprivate.h: added GtkTreeSelectMode enum,
added ctrl_pressed and shift_pressed bitfields,
(_gtk_tree_selection_internal_select_node): replace GdkModifierType
arg with GtkTreeSelectMode.
* gtk/gtktreeselection.c (gtk_tree_selection_set_mode),
(gtk_tree_selection_select_path), (gtk_tree_selection_unselect_path),
(_gtk_tree_selection_internal_select_node): all updated for
GdkModifierType -> GtkTreeSelectMode move.
* gtk/gtktreeview.c (gtk_tree_view_button_press): set ctrl_pressed
and shift_pressed around selection handling block,
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_selection_cursor_parent),
(gtk_tree_view_real_set_cursor): use ctrl_pressed and shift_pressed,
instead of checking the event state. And also updates for the
GdkModifierType -> GtkTreeSelectMode move.
2003-08-25 21:33:00 +00:00
|
|
|
|
else if ((mode & GTK_TREE_SELECT_MODE_EXTEND) == GTK_TREE_SELECT_MODE_EXTEND)
|
2001-02-28 00:35:25 +00:00
|
|
|
|
{
|
|
|
|
|
dirty = gtk_tree_selection_real_unselect_all (selection);
|
2002-06-05 21:25:52 +00:00
|
|
|
|
dirty |= gtk_tree_selection_real_modify_range (selection,
|
|
|
|
|
RANGE_SELECT,
|
2001-02-28 00:35:25 +00:00
|
|
|
|
anchor_path,
|
|
|
|
|
path);
|
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
else
|
2001-02-28 00:35:25 +00:00
|
|
|
|
{
|
|
|
|
|
dirty = gtk_tree_selection_real_unselect_all (selection);
|
2001-01-27 00:50:38 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
_gtk_tree_view_set_anchor_path (selection->tree_view, path);
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2001-02-28 00:35:25 +00:00
|
|
|
|
dirty |= gtk_tree_selection_real_select_node (selection, tree, node, TRUE);
|
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
2000-10-06 00:06:00 +00:00
|
|
|
|
|
2001-01-27 00:50:38 +00:00
|
|
|
|
if (anchor_path)
|
|
|
|
|
gtk_tree_path_free (anchor_path);
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2000-10-06 00:06:00 +00:00
|
|
|
|
if (dirty)
|
2005-11-29 19:34:15 +00:00
|
|
|
|
g_signal_emit (selection, tree_selection_signals[CHANGED], 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_gtk_tree_selection_emit_changed (GtkTreeSelection *selection)
|
|
|
|
|
{
|
|
|
|
|
g_signal_emit (selection, tree_selection_signals[CHANGED], 0);
|
2000-10-06 00:06:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-13 00:34:38 +00:00
|
|
|
|
/* NOTE: Any {un,}selection ever done _MUST_ be done through this function!
|
|
|
|
|
*/
|
2000-10-16 07:03:54 +00:00
|
|
|
|
|
2020-07-24 13:54:49 +00:00
|
|
|
|
static int
|
2000-10-06 00:06:00 +00:00
|
|
|
|
gtk_tree_selection_real_select_node (GtkTreeSelection *selection,
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GtkTreeRBTree *tree,
|
|
|
|
|
GtkTreeRBNode *node,
|
|
|
|
|
gboolean select)
|
2000-10-06 00:06:00 +00:00
|
|
|
|
{
|
2006-03-01 12:18:57 +00:00
|
|
|
|
gboolean toggle = FALSE;
|
2000-10-06 00:06:00 +00:00
|
|
|
|
GtkTreePath *path = NULL;
|
|
|
|
|
|
2013-11-20 17:38:01 +00:00
|
|
|
|
g_return_val_if_fail (node != NULL, FALSE);
|
|
|
|
|
|
2002-01-10 00:11:32 +00:00
|
|
|
|
select = !! select;
|
|
|
|
|
|
2019-01-07 03:28:09 +00:00
|
|
|
|
if (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED) != select)
|
2000-10-06 00:06:00 +00:00
|
|
|
|
{
|
2011-11-26 01:54:34 +00:00
|
|
|
|
path = _gtk_tree_path_new_from_rbtree (tree, node);
|
2006-06-02 18:55:59 +00:00
|
|
|
|
toggle = _gtk_tree_selection_row_is_selectable (selection, node, path);
|
2000-11-18 23:59:30 +00:00
|
|
|
|
gtk_tree_path_free (path);
|
2000-10-06 00:06:00 +00:00
|
|
|
|
}
|
2001-02-28 21:37:50 +00:00
|
|
|
|
|
2006-03-01 12:18:57 +00:00
|
|
|
|
if (toggle)
|
2000-10-06 00:06:00 +00:00
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
if (!GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED))
|
2011-12-12 15:41:21 +00:00
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GTK_TREE_RBNODE_SET_FLAG (node, GTK_TREE_RBNODE_IS_SELECTED);
|
2011-12-12 15:41:21 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2019-01-07 03:28:09 +00:00
|
|
|
|
GTK_TREE_RBNODE_UNSET_FLAG (node, GTK_TREE_RBNODE_IS_SELECTED);
|
2011-12-12 15:41:21 +00:00
|
|
|
|
}
|
2000-10-06 00:06:00 +00:00
|
|
|
|
|
2019-12-17 01:54:23 +00:00
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (selection->tree_view));
|
2010-12-19 05:01:22 +00:00
|
|
|
|
|
2000-10-06 00:06:00 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|