~ubuntu-branches/ubuntu/vivid/liferea/vivid-proposed

« back to all changes in this revision

Viewing changes to src/ui/ui_dnd.c

  • Committer: Package Import Robot
  • Author(s): bojo42
  • Date: 2012-03-29 14:17:21 UTC
  • mfrom: (1.3.9) (3.2.5 sid)
  • Revision ID: package-import@ubuntu.com-20120329141721-tbfopcrc5797wxt7
Tags: 1.8.3-0.1ubuntu1
* New upstream release (LP: #290666, #371754, #741543, #716688)
* Merge from Debian unstable (LP: #935147), remaining changes:
* debian/patches:
  - drop gtk-status-icon.patch & notification-append as in upstream
  - drop fix_systray_behavior as mostly upstreamed and rest seems unused
  - 01_ubuntu_feedlists: update & rename, move planets to "Open Source"  
  - add_X-Ubuntu-Gettext-Domain: rebase
  - libunity.patch: rebase, apply before indicator patch (liferea_shell.c)
  - libindicate_increase_version.patch: exclude from libindicate.patch
  - deactivate libindicate.patch, seems partly upstreamed and needs rework
* debian/control: libindicate-dev, libindicate-gtk-dev & libunity-dev
* debian/liferea.indicate & liferea.install: ship indicator desktop file
* debian/rules: enable libindicate

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * @file ui_dnd.c everything concerning DnD
 
2
 * @file ui_dnd.c everything concerning Drag&Drop
3
3
 *
4
 
 * Copyright (C) 2003-2007 Lars Lindner <lars.lindner@gmail.com>
 
4
 * Copyright (C) 2003-2011 Lars Lindner <lars.lindner@gmail.com>
5
5
 *
6
6
 * This program is free software; you can redistribute it and/or modify
7
7
 * it under the terms of the GNU General Public License as published by
22
22
#include "common.h"
23
23
#include "feed.h"
24
24
#include "feedlist.h"
 
25
#include "folder.h"
25
26
#include "debug.h"
26
 
#include "conf.h"
27
 
#include "ui/ui_feedlist.h"
28
 
#include "ui/ui_itemlist.h"
 
27
#include "ui/item_list_view.h"
 
28
#include "ui/feed_list_view.h"
29
29
#include "ui/ui_node.h"
30
30
#include "ui/ui_dnd.h"
31
31
#include "fl_sources/node_source.h"
80
80
static gboolean
81
81
ui_dnd_feed_drop_possible (GtkTreeDragDest *drag_dest, GtkTreePath *dest_path, GtkSelectionData *selection_data)
82
82
{
 
83
        GtkTreeModel    *model = NULL;
 
84
        GtkTreePath     *src_path = NULL;
83
85
        GtkTreeIter     iter;
84
 
        nodePtr         node;
 
86
        nodePtr         sourceNode, targetNode;
85
87
        
86
88
        debug1 (DEBUG_GUI, "DnD check if feed dropping is possible (%d)", dest_path);
 
89
 
87
90
                        
88
91
        if (!(old_feed_drop_possible) (drag_dest, dest_path, selection_data))
89
92
                return FALSE;
91
94
        if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (drag_dest), &iter, dest_path))
92
95
                return FALSE;
93
96
 
94
 
        /* If we get an iterator it's either a possible dropping
 
97
        /* Try to get an iterator, if we get none it means either feed list
 
98
           root or an "Empty" node. Both cases are fine */
 
99
        gtk_tree_model_get (GTK_TREE_MODEL (drag_dest), &iter, FS_PTR, &targetNode, -1);
 
100
        if (!targetNode)
 
101
                return TRUE;
 
102
 
 
103
        /* If we got an iterator it's either a possible dropping
95
104
           candidate (a folder or source node to drop into, or a
96
105
           iterator to insert after). In any case we have to check
97
106
           if it is a writeable node source. */
98
107
 
99
 
        gtk_tree_model_get (GTK_TREE_MODEL (drag_dest), &iter, FS_PTR, &node, -1);
100
 
 
101
 
        /* never drag nodes of read-only subscription lists */
102
 
        if (node && !(NODE_SOURCE_TYPE (node)->capabilities & NODE_SOURCE_CAPABILITY_WRITABLE_FEEDLIST))
 
108
        /* never drop into read-only subscription node sources */
 
109
        if (!(NODE_SOURCE_TYPE (targetNode)->capabilities & NODE_SOURCE_CAPABILITY_WRITABLE_FEEDLIST))
103
110
                return FALSE;
104
111
 
 
112
        /* never drag folders into non-hierarchic node sources */
 
113
        if (!gtk_tree_get_row_drag_data (selection_data, &model, &src_path))
 
114
                return TRUE;
 
115
 
 
116
        if (gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, src_path)) {
 
117
                gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, FS_PTR, &sourceNode, -1);
 
118
 
 
119
                if (IS_FOLDER(sourceNode) && !(NODE_SOURCE_TYPE (targetNode)->capabilities & NODE_SOURCE_CAPABILITY_HIERARCHIC_FEEDLIST))
 
120
                        return FALSE;
 
121
        }
 
122
 
 
123
        gtk_tree_path_free (src_path);
 
124
 
105
125
        return TRUE;
106
126
}
107
127
 
132
152
                        if (gtk_tree_model_iter_parent (GTK_TREE_MODEL (drag_dest), &parentIter, &iter)) {
133
153
                                gtk_tree_model_get (GTK_TREE_MODEL (drag_dest), &parentIter, FS_PTR, &newParent, -1);
134
154
                        } else {
 
155
                                debug0 (DEBUG_GUI, "Defaulting to feed list root as drop target");
135
156
                                gtk_tree_model_get_iter_first (GTK_TREE_MODEL (drag_dest), &parentIter);
136
157
                                newParent = feedlist_get_root ();
137
158
                        }
192
213
                        node_update_counters (newParent);
193
214
                        
194
215
                        feedlist_schedule_save ();
195
 
                        ui_itemlist_prefocus ();
196
216
                }
197
217
        }
198
218