gui/sidebar: Add a function for getting an iter from x, y coordinates
This will be used for drag and drop, so that we can figure out what playlist tracks are being added to. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
fc5e6eb043
commit
a9970c455f
|
@ -486,3 +486,19 @@ gboolean gui_sidebar_iter_from_string(const gchar *path, GtkTreeIter *child)
|
||||||
__gui_sidebar_filter_iter_convert(&iter, child);
|
__gui_sidebar_filter_iter_convert(&iter, child);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean gui_sidebar_iter_from_xy(gint x, gint y, GtkTreeIter *child)
|
||||||
|
{
|
||||||
|
GtkTreeModel *model = GTK_TREE_MODEL(gui_sidebar_filter());
|
||||||
|
GtkTreePath *path;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
if (!gtk_tree_view_get_path_at_pos(gui_sidebar_treeview(), x, y,
|
||||||
|
&path, NULL, NULL, NULL))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
gtk_tree_model_get_iter(model, &iter, path);
|
||||||
|
__gui_sidebar_filter_iter_convert(&iter, child);
|
||||||
|
gtk_tree_path_free(path);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -76,6 +76,9 @@ gboolean gui_sidebar_iter_find(GtkTreeIter *, const gchar *,
|
||||||
/* Called to set the a GtkTreeIter to the row at path string */
|
/* Called to set the a GtkTreeIter to the row at path string */
|
||||||
gboolean gui_sidebar_iter_from_string(const gchar *, GtkTreeIter *);
|
gboolean gui_sidebar_iter_from_string(const gchar *, GtkTreeIter *);
|
||||||
|
|
||||||
|
/* Called to set the GtkTreeIter to the row at (x, y) */
|
||||||
|
gboolean gui_sidebar_iter_from_xy(gint, gint, GtkTreeIter *);
|
||||||
|
|
||||||
/* Called to get the sidebar widget. */
|
/* Called to get the sidebar widget. */
|
||||||
static inline GtkPaned *gui_sidebar()
|
static inline GtkPaned *gui_sidebar()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue