1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3
* Copyright (C) 2007 Imendio AB
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License as
7
* published by the Free Software Foundation; either version 2 of the
8
* License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* General Public License for more details.
15
* You should have received a copy of the GNU General Public
16
* License along with this program; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
23
#include "giggle-tree-view-helpers.h"
25
#include <gdk/gdkkeysyms.h>
26
#include <gtk/gtktreeselection.h>
29
remote_editor_tree_selection_get_branches (GtkTreeModel *model,
34
*branches = g_list_prepend (*branches, gtk_tree_row_reference_new (model, path));
38
remote_editor_remove_branch (GtkTreeRowReference *ref)
43
model = gtk_tree_row_reference_get_model (ref);
44
gtk_tree_model_get_iter (model, &iter,
45
gtk_tree_row_reference_get_path (ref));
46
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
48
gtk_tree_row_reference_free (ref);
52
tree_view_delete_selection_on_list_store (GtkWidget *treeview,
55
if (event->keyval == GDK_Delete) {
56
GtkTreeSelection* sel;
57
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
59
if (gtk_tree_selection_count_selected_rows (sel) > 0) {
60
GList* branches = NULL;
61
gtk_tree_selection_selected_foreach (sel,
62
(GtkTreeSelectionForeachFunc)
63
remote_editor_tree_selection_get_branches,
65
g_list_foreach (branches, (GFunc)remote_editor_remove_branch, NULL);
66
g_list_free (branches);