aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-07-12 03:47:25 +0800
committerChristian Persch <chpe@src.gnome.org>2005-07-12 03:47:25 +0800
commit9f25938b8101d5ea10d547d709bc136d4aeddb6b (patch)
tree468a723c1d628db2c98d42b5f7c257c8743f756c
parentd439bc7993fd7d4d490ee4d7a45943dfd5624c9d (diff)
downloadgsoc2013-epiphany-9f25938b8101d5ea10d547d709bc136d4aeddb6b.tar
gsoc2013-epiphany-9f25938b8101d5ea10d547d709bc136d4aeddb6b.tar.gz
gsoc2013-epiphany-9f25938b8101d5ea10d547d709bc136d4aeddb6b.tar.bz2
gsoc2013-epiphany-9f25938b8101d5ea10d547d709bc136d4aeddb6b.tar.lz
gsoc2013-epiphany-9f25938b8101d5ea10d547d709bc136d4aeddb6b.tar.xz
gsoc2013-epiphany-9f25938b8101d5ea10d547d709bc136d4aeddb6b.tar.zst
gsoc2013-epiphany-9f25938b8101d5ea10d547d709bc136d4aeddb6b.zip
Check all selected nodes if they allow dragging.
2005-07-11 Christian Persch <chpe@cvs.gnome.org> * lib/widgets/ephy-node-view.c: (check_node_is_drag_source), (can_drag_selection), (button_release_cb), (motion_notify_cb): Check all selected nodes if they allow dragging. * src/bookmarks/ephy-bookmarks-editor.c: (ephy_bookmarks_editor_update_menu), (key_pressed_cb): Don't allow to delete or rename local sites, or to put them on the bookmarks bar. * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_init): Fix capitalisation.
-rw-r--r--ChangeLog17
-rw-r--r--lib/widgets/ephy-node-view.c40
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c15
-rw-r--r--src/bookmarks/ephy-bookmarks.c2
4 files changed, 68 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 846a1d395..7aafd0bde 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2005-07-11 Christian Persch <chpe@cvs.gnome.org>
+
+ * lib/widgets/ephy-node-view.c: (check_node_is_drag_source),
+ (can_drag_selection), (button_release_cb), (motion_notify_cb):
+
+ Check all selected nodes if they allow dragging.
+
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (ephy_bookmarks_editor_update_menu), (key_pressed_cb):
+
+ Don't allow to delete or rename local sites, or to put them
+ on the bookmarks bar.
+
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_init):
+
+ Fix capitalisation.
+
2005-07-10 Christian Persch <chpe@cvs.gnome.org>
* lib/ephy-node-common.h:
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c
index 23cc2fc60..010195e48 100644
--- a/lib/widgets/ephy-node-view.c
+++ b/lib/widgets/ephy-node-view.c
@@ -663,6 +663,42 @@ did_not_drag (EphyNodeView *view,
}
}
+typedef struct
+{
+ EphyNodeView *view;
+ gboolean result;
+}
+ForeachData;
+
+static void
+check_node_is_drag_source (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ ForeachData *data)
+{
+ EphyNode *node;
+
+ node = get_node_from_path (data->view, path);
+ data->result = data->result &&
+ node != NULL &&
+ ephy_node_get_is_drag_source (node);
+}
+
+static gboolean
+can_drag_selection (EphyNodeView *view)
+{
+ GtkTreeView *tree_view = GTK_TREE_VIEW (view);
+ GtkTreeSelection *selection;
+ ForeachData data = { view, TRUE };
+
+ selection = gtk_tree_view_get_selection (tree_view);
+ gtk_tree_selection_selected_foreach (selection,
+ (GtkTreeSelectionForeachFunc) check_node_is_drag_source,
+ &data);
+
+ return data.result;
+}
+
static void
drag_data_get_cb (GtkWidget *widget,
GdkDragContext *context,
@@ -707,6 +743,7 @@ button_release_cb (GtkWidget *widget,
did_not_drag (view, event);
return TRUE;
}
+ view->priv->drag_started = FALSE;
}
return FALSE;
}
@@ -727,7 +764,8 @@ motion_notify_cb (GtkWidget *widget,
{
if (gtk_drag_check_threshold (widget, view->priv->drag_x,
view->priv->drag_y, event->x,
- event->y))
+ event->y)
+ && can_drag_selection (view))
{
context = gtk_drag_begin
(widget, view->priv->source_target_list,
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 2049ad0df..860e9da3a 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -1255,10 +1255,10 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
open_in_tab = (bmk_focus && bmk_selection);
rename = (bmk_focus && single_bmk_selected && mutable) ||
(key_selection && key_focus && key_normal);
- delete = (bmk_focus && bmk_selection) ||
+ delete = (bmk_focus && bmk_selection && mutable) ||
(key_selection && key_focus && key_normal);
properties = bmk_focus && single_bmk_selected && mutable;
- can_show_in_bookmarks_bar = (bmk_focus && single_bmk_selected) ||
+ can_show_in_bookmarks_bar = (bmk_focus && single_bmk_selected && mutable) ||
(key_selection && key_focus);
action_group = editor->priv->action_group;
@@ -1391,10 +1391,17 @@ key_pressed_cb (EphyNodeView *view,
GdkEventKey *event,
EphyBookmarksEditor *editor)
{
+ EphyBookmarksEditorPrivate *priv = editor->priv;
+ GtkAction *action;
+
if (event->keyval == GDK_Delete || event->keyval == GDK_KP_Delete)
{
- cmd_delete (NULL, editor);
- return TRUE;
+ action = gtk_action_group_get_action (priv->action_group, "Delete");
+ if (gtk_action_get_sensitive (action))
+ {
+ cmd_delete (NULL, editor);
+ return TRUE;
+ }
}
return FALSE;
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 5ca86de27..916afac02 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -1047,7 +1047,7 @@ ephy_bookmarks_init (EphyBookmarks *eb)
/* Translators: The text before the "|" is context to help you decide on
* the correct translation. You MUST OMIT it in the translated string. */
/* Translators: this topic contains the local websites bookmarks */
- g_value_set_string (&value, Q_("bookmarks|Local sites"));
+ g_value_set_string (&value, Q_("bookmarks|Local Sites"));
ephy_node_set_property (eb->priv->local,
EPHY_NODE_KEYWORD_PROP_NAME,
&value);