* Boston, MA 02111-1307, USA.
*/
-#include <config.h>
+#include "config.h"
#include <string.h>
#include "gtktreeselection.h"
#include "gtktreeprivate.h"
if (selection->destroy)
{
- GtkDestroyNotify d = selection->destroy;
+ GDestroyNotify d = selection->destroy;
selection->destroy = NULL;
d (selection->user_data);
gtk_tree_selection_set_select_function (GtkTreeSelection *selection,
GtkTreeSelectionFunc func,
gpointer data,
- GtkDestroyNotify destroy)
+ GDestroyNotify destroy)
{
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
g_return_if_fail (func != NULL);
if (selection->destroy)
{
- GtkDestroyNotify d = selection->destroy;
+ GDestroyNotify d = selection->destroy;
selection->destroy = NULL;
d (selection->user_data);
selection->destroy = destroy;
}
+/**
+ * gtk_tree_selection_get_select_function:
+ * @selection: A #GtkTreeSelection.
+ *
+ * Returns the current selection function.
+ *
+ * Return value: The function.
+ *
+ * Since: 2.14
+ **/
+GtkTreeSelectionFunc
+gtk_tree_selection_get_select_function (GtkTreeSelection *selection)
+{
+ g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), NULL);
+
+ return selection->user_func;
+}
+
/**
* gtk_tree_selection_get_user_data:
* @selection: A #GtkTreeSelection.
/**
* gtk_tree_selection_get_selected:
* @selection: A #GtkTreeSelection.
- * @model: A pointer to set to the #GtkTreeModel, or NULL.
- * @iter: The #GtkTreeIter, or NULL.
+ * @model: (out) (allow-none): A pointer to set to the #GtkTreeModel, or NULL.
+ * @iter: (allow-none): The #GtkTreeIter, or NULL.
*
* Sets @iter to the currently selected node if @selection is set to
* #GTK_SELECTION_SINGLE or #GTK_SELECTION_BROWSE. @iter may be NULL if you
/**
* gtk_tree_selection_get_selected_rows:
* @selection: A #GtkTreeSelection.
- * @model: A pointer to set to the #GtkTreeModel, or NULL.
+ * @model: (allow-none): A pointer to set to the #GtkTreeModel, or NULL.
*
* Creates a list of path of all selected rows. Additionally, if you are
* planning on modifying the model after calling this function, you may
* To do this, you can use gtk_tree_row_reference_new().
*
* To free the return value, use:
- * <informalexample><programlisting>
- * g_list_foreach (list, gtk_tree_path_free, NULL);
+ * |[
+ * g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
* g_list_free (list);
- * </programlisting></informalexample>
+ * ]|
*
- * Return value: A #GList containing a #GtkTreePath for each selected row.
+ * Return value: (element-type GtkTreePath) (transfer full): A #GList containing a #GtkTreePath for each selected row.
*
* Since: 2.2
**/
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), NULL);
g_return_val_if_fail (selection->tree_view != NULL, NULL);
+ if (model)
+ *model = selection->tree_view->priv->model;
+
if (selection->tree_view->priv->tree == NULL ||
selection->tree_view->priv->tree->root == NULL)
return NULL;
- if (model)
- *model = selection->tree_view->priv->model;
-
if (selection->type == GTK_SELECTION_NONE)
return NULL;
else if (selection->type != GTK_SELECTION_MULTIPLE)
g_object_ref (model);
/* connect to signals to monitor changes in treemodel */
- inserted_id = g_signal_connect_swapped (model, "row_inserted",
+ inserted_id = g_signal_connect_swapped (model, "row-inserted",
G_CALLBACK (model_changed),
&stop);
- deleted_id = g_signal_connect_swapped (model, "row_deleted",
+ deleted_id = g_signal_connect_swapped (model, "row-deleted",
G_CALLBACK (model_changed),
&stop);
- reordered_id = g_signal_connect_swapped (model, "rows_reordered",
+ reordered_id = g_signal_connect_swapped (model, "rows-reordered",
G_CALLBACK (model_changed),
&stop);
changed_id = g_signal_connect_swapped (selection->tree_view, "notify::model",