aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJorn Baayen <jbaayen@gnome.org>2005-01-22 03:33:03 +0800
committerJorn Baayen <jbaayen@src.gnome.org>2005-01-22 03:33:03 +0800
commit549171e9af818b784548fc2bed4bd375006b7adc (patch)
tree5a3e639a8fe9f2175adde95c9e60ae77a76a8016 /src
parent39f7d93acea222b6b3e1cd53875ac16f5cbdea4f (diff)
downloadgsoc2013-epiphany-549171e9af818b784548fc2bed4bd375006b7adc.tar
gsoc2013-epiphany-549171e9af818b784548fc2bed4bd375006b7adc.tar.gz
gsoc2013-epiphany-549171e9af818b784548fc2bed4bd375006b7adc.tar.bz2
gsoc2013-epiphany-549171e9af818b784548fc2bed4bd375006b7adc.tar.lz
gsoc2013-epiphany-549171e9af818b784548fc2bed4bd375006b7adc.tar.xz
gsoc2013-epiphany-549171e9af818b784548fc2bed4bd375006b7adc.tar.zst
gsoc2013-epiphany-549171e9af818b784548fc2bed4bd375006b7adc.zip
Add proper _NETSCAPE_URL drag support, supplying the URL as well as the
2005-01-21 Jorn Baayen <jbaayen@gnome.org> * lib/widgets/ephy-node-view.c: (ephy_node_view_add_column), (ephy_node_view_enable_drag_source): * lib/widgets/ephy-node-view.h: * lib/widgets/ephy-tree-model-sort.c: (ephy_tree_model_sort_init), (ephy_tree_model_sort_multi_row_draggable), (ephy_tree_model_sort_set_base_drag_column_id), (ephy_tree_model_sort_set_extra_drag_column_id), (each_property_get_data_binder): * lib/widgets/ephy-tree-model-sort.h: * src/bookmarks/ephy-bookmark-action.c: (drag_data_get_cb): * src/bookmarks/ephy-bookmarks-editor.c: (ephy_bookmarks_editor_construct): * src/bookmarks/ephy-topics-selector.c: (ephy_topics_selector_constructor): * src/ephy-encoding-dialog.c: (ephy_encoding_dialog_init): * src/ephy-history-window.c: (ephy_history_window_construct): Add proper _NETSCAPE_URL drag support, supplying the URL as well as the title. As a side effect most data_columns in NodeViews have been obsoleted. Fixes #163937.
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/ephy-bookmark-action.c11
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c37
-rw-r--r--src/bookmarks/ephy-topics-selector.c2
-rw-r--r--src/ephy-encoding-dialog.c2
-rw-r--r--src/ephy-history-window.c52
5 files changed, 54 insertions, 50 deletions
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c
index f219853d6..876c386f4 100644
--- a/src/bookmarks/ephy-bookmark-action.c
+++ b/src/bookmarks/ephy-bookmark-action.c
@@ -402,7 +402,8 @@ drag_data_get_cb (GtkWidget *widget, GdkDragContext *context,
GtkSelectionData *selection_data, guint info,
guint32 time, EphyBookmarkAction *action)
{
- const char *address;
+ const char *address, *title;
+ char *data;
g_return_if_fail (action->priv->node != NULL);
@@ -410,8 +411,14 @@ drag_data_get_cb (GtkWidget *widget, GdkDragContext *context,
EPHY_NODE_BMK_PROP_LOCATION);
g_return_if_fail (address != NULL);
+ title = ephy_node_get_property_string (action->priv->node,
+ EPHY_NODE_BMK_PROP_TITLE);
+ g_return_if_fail (title != NULL);
+
+ data = g_strdup_printf ("%s\n%s", address, title);
gtk_selection_data_set (selection_data, selection_data->target, 8,
- (unsigned char *) address, strlen (address));
+ (unsigned char *) data, strlen (data));
+ g_free (data);
}
static int
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 550212608..4bc02e83d 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -1575,7 +1575,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
EphyNode *node;
GtkUIManager *ui_merge;
GtkActionGroup *action_group;
- int col_id, details_value;
+ int col_id, url_col_id, title_col_id, details_value;
ephy_gui_ensure_window_group (GTK_WINDOW (editor));
@@ -1645,9 +1645,16 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
col_id = ephy_node_view_add_data_column (EPHY_NODE_VIEW (key_view),
G_TYPE_STRING, -1,
provide_keyword_uri, editor);
+ ephy_node_view_add_column (EPHY_NODE_VIEW (key_view), _("Topics"),
+ G_TYPE_STRING,
+ EPHY_NODE_KEYWORD_PROP_NAME,
+ EPHY_NODE_VIEW_SHOW_PRIORITY |
+ EPHY_NODE_VIEW_EDITABLE |
+ EPHY_NODE_VIEW_SEARCHABLE, NULL, NULL);
ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (key_view),
topic_drag_types,
- n_topic_drag_types, col_id);
+ n_topic_drag_types,
+ col_id, -1);
ephy_node_view_enable_drag_dest (EPHY_NODE_VIEW (key_view),
topic_drag_dest_types,
n_topic_drag_dest_types);
@@ -1657,12 +1664,6 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
"changed",
G_CALLBACK (view_selection_changed_cb),
editor);
- ephy_node_view_add_column (EPHY_NODE_VIEW (key_view), _("Topics"),
- G_TYPE_STRING,
- EPHY_NODE_KEYWORD_PROP_NAME,
- EPHY_NODE_VIEW_SHOW_PRIORITY |
- EPHY_NODE_VIEW_EDITABLE |
- EPHY_NODE_VIEW_SEARCHABLE, NULL);
ephy_node_view_set_priority (EPHY_NODE_VIEW (key_view),
EPHY_NODE_KEYWORD_PROP_PRIORITY);
ephy_node_view_set_sort (EPHY_NODE_VIEW (key_view), G_TYPE_STRING,
@@ -1713,24 +1714,20 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
/* Bookmarks View */
bm_view = ephy_node_view_new (node, editor->priv->bookmarks_filter);
add_focus_monitor (editor, bm_view);
- col_id = ephy_node_view_add_data_column (EPHY_NODE_VIEW (bm_view),
- G_TYPE_STRING,
- EPHY_NODE_BMK_PROP_LOCATION,
- NULL, NULL);
- ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (bm_view),
- bmk_drag_types,
- n_bmk_drag_types,
- col_id);
- editor->priv->title_col = ephy_node_view_add_column
+ title_col_id = ephy_node_view_add_column
(EPHY_NODE_VIEW (bm_view), _("Title"),
G_TYPE_STRING, EPHY_NODE_BMK_PROP_TITLE,
EPHY_NODE_VIEW_EDITABLE |
EPHY_NODE_VIEW_SEARCHABLE,
- provide_favicon);
- editor->priv->address_col = ephy_node_view_add_column
+ provide_favicon, &(editor->priv->title_col));
+ url_col_id = ephy_node_view_add_column
(EPHY_NODE_VIEW (bm_view), _("Address"),
G_TYPE_STRING, EPHY_NODE_BMK_PROP_LOCATION,
- 0, NULL);
+ 0, NULL, &(editor->priv->address_col));
+ ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (bm_view),
+ bmk_drag_types,
+ n_bmk_drag_types,
+ url_col_id, title_col_id);
ephy_node_view_set_sort (EPHY_NODE_VIEW (bm_view), G_TYPE_STRING,
EPHY_NODE_BMK_PROP_TITLE, GTK_SORT_ASCENDING);
gtk_container_add (GTK_CONTAINER (scrolled_window), bm_view);
diff --git a/src/bookmarks/ephy-topics-selector.c b/src/bookmarks/ephy-topics-selector.c
index 6e16946ab..57cee2cd0 100644
--- a/src/bookmarks/ephy-topics-selector.c
+++ b/src/bookmarks/ephy-topics-selector.c
@@ -200,7 +200,7 @@ ephy_topics_selector_constructor (GType type,
EPHY_NODE_KEYWORD_PROP_NAME,
EPHY_NODE_VIEW_SHOW_PRIORITY |
EPHY_NODE_VIEW_EDITABLE |
- EPHY_NODE_VIEW_SEARCHABLE, NULL);
+ EPHY_NODE_VIEW_SEARCHABLE, NULL, NULL);
ephy_node_view_set_sort (EPHY_NODE_VIEW (selector), G_TYPE_STRING,
EPHY_NODE_KEYWORD_PROP_NAME, GTK_SORT_ASCENDING);
diff --git a/src/ephy-encoding-dialog.c b/src/ephy-encoding-dialog.c
index 2e3a301eb..8d9f1cb71 100644
--- a/src/ephy-encoding-dialog.c
+++ b/src/ephy-encoding-dialog.c
@@ -311,7 +311,7 @@ ephy_encoding_dialog_init (EphyEncodingDialog *dialog)
G_TYPE_STRING,
EPHY_NODE_ENCODING_PROP_TITLE_ELIDED,
EPHY_NODE_VIEW_SEARCHABLE,
- NULL);
+ NULL, NULL);
ephy_node_view_set_sort (EPHY_NODE_VIEW (treeview), G_TYPE_STRING,
EPHY_NODE_ENCODING_PROP_TITLE_ELIDED,
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 01f864338..3343c5a04 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -1189,7 +1189,7 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
EphyNode *node;
GtkUIManager *ui_merge;
GtkActionGroup *action_group;
- int col_id, details_value;
+ int url_col_id, title_col_id, details_value;
gtk_window_set_title (GTK_WINDOW (editor), _("History"));
gtk_window_set_icon_name (GTK_WINDOW (editor), EPHY_STOCK_HISTORY);
@@ -1249,21 +1249,24 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
editor->priv->sites_filter = ephy_node_filter_new ();
sites_view = ephy_node_view_new (node, editor->priv->sites_filter);
add_focus_monitor (editor, sites_view);
- col_id = ephy_node_view_add_data_column (EPHY_NODE_VIEW (sites_view),
- G_TYPE_STRING,
- EPHY_NODE_PAGE_PROP_LOCATION,
- NULL, NULL);
+ url_col_id = ephy_node_view_add_data_column (EPHY_NODE_VIEW (sites_view),
+ G_TYPE_STRING,
+ EPHY_NODE_PAGE_PROP_LOCATION,
+ NULL, NULL);
+ title_col_id = ephy_node_view_add_column (EPHY_NODE_VIEW (sites_view), _("Sites"),
+ G_TYPE_STRING,
+ EPHY_NODE_PAGE_PROP_TITLE,
+ EPHY_NODE_VIEW_SEARCHABLE |
+ EPHY_NODE_VIEW_SHOW_PRIORITY,
+ provide_favicon,
+ NULL);
ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (sites_view),
page_drag_types,
- n_page_drag_types, col_id);
+ n_page_drag_types,
+ url_col_id,
+ title_col_id);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (sites_view));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
- ephy_node_view_add_column (EPHY_NODE_VIEW (sites_view), _("Sites"),
- G_TYPE_STRING,
- EPHY_NODE_PAGE_PROP_TITLE,
- EPHY_NODE_VIEW_SEARCHABLE |
- EPHY_NODE_VIEW_SHOW_PRIORITY,
- provide_favicon);
ephy_node_view_set_priority (EPHY_NODE_VIEW (sites_view),
EPHY_NODE_PAGE_PROP_PRIORITY);
ephy_node_view_set_sort (EPHY_NODE_VIEW (sites_view), G_TYPE_STRING,
@@ -1313,24 +1316,21 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
add_focus_monitor (editor, pages_view);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pages_view));
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (pages_view), TRUE);
- col_id = ephy_node_view_add_data_column (EPHY_NODE_VIEW (pages_view),
- G_TYPE_STRING,
- EPHY_NODE_PAGE_PROP_LOCATION,
- NULL, NULL);
- ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (pages_view),
- page_drag_types,
- n_page_drag_types, col_id);
- col = ephy_node_view_add_column (EPHY_NODE_VIEW (pages_view), _("Title"),
- G_TYPE_STRING, EPHY_NODE_PAGE_PROP_TITLE,
- EPHY_NODE_VIEW_SORTABLE |
- EPHY_NODE_VIEW_SEARCHABLE, NULL);
+ title_col_id = ephy_node_view_add_column (EPHY_NODE_VIEW (pages_view), _("Title"),
+ G_TYPE_STRING, EPHY_NODE_PAGE_PROP_TITLE,
+ EPHY_NODE_VIEW_SORTABLE |
+ EPHY_NODE_VIEW_SEARCHABLE, NULL, &col);
gtk_tree_view_column_set_max_width (col, 250);
editor->priv->title_col = col;
- col = ephy_node_view_add_column (EPHY_NODE_VIEW (pages_view), _("Address"),
- G_TYPE_STRING, EPHY_NODE_PAGE_PROP_LOCATION,
- EPHY_NODE_VIEW_SORTABLE, NULL);
+ url_col_id = ephy_node_view_add_column (EPHY_NODE_VIEW (pages_view), _("Address"),
+ G_TYPE_STRING, EPHY_NODE_PAGE_PROP_LOCATION,
+ EPHY_NODE_VIEW_SORTABLE, NULL, &col);
gtk_tree_view_column_set_max_width (col, 200);
editor->priv->address_col = col;
+ ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (pages_view),
+ page_drag_types,
+ n_page_drag_types,
+ url_col_id, title_col_id);
ephy_node_view_set_sort (EPHY_NODE_VIEW (pages_view), G_TYPE_INT,
EPHY_NODE_PAGE_PROP_LAST_VISIT,
GTK_SORT_DESCENDING);