aboutsummaryrefslogtreecommitdiffstats
path: root/lib/widgets
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 /lib/widgets
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 'lib/widgets')
-rw-r--r--lib/widgets/ephy-node-view.c19
-rw-r--r--lib/widgets/ephy-node-view.h82
-rw-r--r--lib/widgets/ephy-tree-model-sort.c51
-rw-r--r--lib/widgets/ephy-tree-model-sort.h10
4 files changed, 97 insertions, 65 deletions
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c
index 5f01667d7..9a4291bdc 100644
--- a/lib/widgets/ephy-node-view.c
+++ b/lib/widgets/ephy-node-view.c
@@ -1158,13 +1158,14 @@ ephy_node_view_add_data_column (EphyNodeView *view,
return column;
}
-GtkTreeViewColumn *
+int
ephy_node_view_add_column (EphyNodeView *view,
const char *title,
GType value_type,
guint prop_id,
EphyNodeViewFlags flags,
- EphyTreeModelNodeValueFunc icon_func)
+ EphyTreeModelNodeValueFunc icon_func,
+ GtkTreeViewColumn **ret)
{
GtkTreeViewColumn *gcolumn;
@@ -1236,7 +1237,10 @@ ephy_node_view_add_column (EphyNodeView *view,
gtk_tree_view_column_set_sort_column_id (gcolumn, column);
}
- return gcolumn;
+ if (ret != NULL)
+ *ret = gcolumn;
+
+ return column;
}
void
@@ -1409,7 +1413,8 @@ void
ephy_node_view_enable_drag_source (EphyNodeView *view,
GtkTargetEntry *types,
int n_types,
- int column)
+ int base_drag_column,
+ int extra_drag_column)
{
GtkWidget *treeview;
@@ -1420,8 +1425,10 @@ ephy_node_view_enable_drag_source (EphyNodeView *view,
view->priv->source_target_list =
gtk_target_list_new (types, n_types);
- ephy_tree_model_sort_set_column_id (EPHY_TREE_MODEL_SORT (view->priv->sortmodel),
- column);
+ ephy_tree_model_sort_set_base_drag_column_id (EPHY_TREE_MODEL_SORT (view->priv->sortmodel),
+ base_drag_column);
+ ephy_tree_model_sort_set_extra_drag_column_id (EPHY_TREE_MODEL_SORT (view->priv->sortmodel),
+ extra_drag_column);
g_signal_connect_object (G_OBJECT (view),
"button_release_event",
diff --git a/lib/widgets/ephy-node-view.h b/lib/widgets/ephy-node-view.h
index d5a4590eb..dab2f6da8 100644
--- a/lib/widgets/ephy-node-view.h
+++ b/lib/widgets/ephy-node-view.h
@@ -71,61 +71,63 @@ typedef struct
void (*node_dropped) (EphyNodeView *view, EphyNode *node, GList *uris);
} EphyNodeViewClass;
-GType ephy_node_view_get_type (void);
+GType ephy_node_view_get_type (void);
-GtkWidget *ephy_node_view_new (EphyNode *root,
- EphyNodeFilter *filter);
+GtkWidget *ephy_node_view_new (EphyNode *root,
+ EphyNodeFilter *filter);
-void ephy_node_view_enable_dnd (EphyNodeView *view);
+void ephy_node_view_enable_dnd (EphyNodeView *view);
-void ephy_node_view_add_toggle (EphyNodeView *view,
- EphyTreeModelNodeValueFunc value_func,
- gpointer data);
+void ephy_node_view_add_toggle (EphyNodeView *view,
+ EphyTreeModelNodeValueFunc value_func,
+ gpointer data);
-GtkTreeViewColumn *ephy_node_view_add_column (EphyNodeView *view,
- const char *title,
- GType value_type,
- guint prop_id,
- EphyNodeViewFlags flags,
- EphyTreeModelNodeValueFunc icon_func);
+int ephy_node_view_add_column (EphyNodeView *view,
+ const char *title,
+ GType value_type,
+ guint prop_id,
+ EphyNodeViewFlags flags,
+ EphyTreeModelNodeValueFunc icon_func,
+ GtkTreeViewColumn **column);
-int ephy_node_view_add_data_column (EphyNodeView *view,
- GType value_type,
- guint prop_id,
- EphyTreeModelNodeValueFunc func,
- gpointer data);
+int ephy_node_view_add_data_column (EphyNodeView *view,
+ GType value_type,
+ guint prop_id,
+ EphyTreeModelNodeValueFunc func,
+ gpointer data);
-void ephy_node_view_set_sort (EphyNodeView *view,
- GType value_type,
- guint prop_id,
- GtkSortType sort_type);
+void ephy_node_view_set_sort (EphyNodeView *view,
+ GType value_type,
+ guint prop_id,
+ GtkSortType sort_type);
-void ephy_node_view_set_priority (EphyNodeView *view,
- guint priority_prop_id);
+void ephy_node_view_set_priority (EphyNodeView *view,
+ guint priority_prop_id);
-void ephy_node_view_remove (EphyNodeView *view);
+void ephy_node_view_remove (EphyNodeView *view);
-GList *ephy_node_view_get_selection (EphyNodeView *view);
+GList *ephy_node_view_get_selection (EphyNodeView *view);
-void ephy_node_view_select_node (EphyNodeView *view,
- EphyNode *node);
+void ephy_node_view_select_node (EphyNodeView *view,
+ EphyNode *node);
-void ephy_node_view_enable_drag_source (EphyNodeView *view,
- GtkTargetEntry *types,
- int n_types,
- int column_id);
+void ephy_node_view_enable_drag_source (EphyNodeView *view,
+ GtkTargetEntry *types,
+ int n_types,
+ int base_drag_column_id,
+ int extra_drag_column_id);
-void ephy_node_view_enable_drag_dest (EphyNodeView *view,
- GtkTargetEntry *types,
- int n_types);
+void ephy_node_view_enable_drag_dest (EphyNodeView *view,
+ GtkTargetEntry *types,
+ int n_types);
-void ephy_node_view_edit (EphyNodeView *view,
- gboolean remove_if_cancelled);
+void ephy_node_view_edit (EphyNodeView *view,
+ gboolean remove_if_cancelled);
-gboolean ephy_node_view_is_target (EphyNodeView *view);
+gboolean ephy_node_view_is_target (EphyNodeView *view);
-void ephy_node_view_popup (EphyNodeView *view,
- GtkWidget *menu);
+void ephy_node_view_popup (EphyNodeView *view,
+ GtkWidget *menu);
G_END_DECLS
diff --git a/lib/widgets/ephy-tree-model-sort.c b/lib/widgets/ephy-tree-model-sort.c
index c20af59d0..1c9ae1e4f 100644
--- a/lib/widgets/ephy-tree-model-sort.c
+++ b/lib/widgets/ephy-tree-model-sort.c
@@ -48,7 +48,8 @@ static gboolean ephy_tree_model_sort_multi_drag_data_delete (EggTreeMultiDragSou
struct _EphyTreeModelSortPrivate
{
char *str_list;
- int drag_column_id;
+ int base_drag_column_id;
+ int extra_drag_column_id;
};
static GObjectClass *parent_class = NULL;
@@ -108,7 +109,8 @@ ephy_tree_model_sort_init (EphyTreeModelSort *ma)
{
ma->priv = EPHY_TREE_MODEL_SORT_GET_PRIVATE (ma);
- ma->priv->drag_column_id = -1;
+ ma->priv->base_drag_column_id = -1;
+ ma->priv->extra_drag_column_id = -1;
}
static void
@@ -146,14 +148,21 @@ ephy_tree_model_sort_multi_drag_source_init (EggTreeMultiDragSourceIface *iface)
static gboolean
ephy_tree_model_sort_multi_row_draggable (EggTreeMultiDragSource *drag_source, GList *path_list)
{
- return (EPHY_TREE_MODEL_SORT (drag_source)->priv->drag_column_id > 0);
+ return (EPHY_TREE_MODEL_SORT (drag_source)->priv->base_drag_column_id >= 0);
}
void
-ephy_tree_model_sort_set_column_id (EphyTreeModelSort *ms,
- int id)
+ephy_tree_model_sort_set_base_drag_column_id (EphyTreeModelSort *ms,
+ int id)
{
- ms->priv->drag_column_id = id;
+ ms->priv->base_drag_column_id = id;
+}
+
+void
+ephy_tree_model_sort_set_extra_drag_column_id (EphyTreeModelSort *ms,
+ int id)
+{
+ ms->priv->extra_drag_column_id = id;
}
static gboolean
@@ -171,29 +180,41 @@ each_property_get_data_binder (EphyDragEachSelectedItemDataGet iteratee,
GList *path_list = (GList *) (context[0]);
GList *i;
EphyTreeModelSort *model = EPHY_TREE_MODEL_SORT (context[1]);
- GValue value = {0, };
+ GValue base_value = {0, }, extra_value = {0, };
for (i = path_list; i != NULL; i = i->next)
{
GtkTreeIter iter;
GtkTreePath *path = NULL;
- const char *svalue;
+ const char *base_data, *extra_data;
path = gtk_tree_row_reference_get_path (i->data);
gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path);
+
gtk_tree_model_get_value (GTK_TREE_MODEL (model), &iter,
- model->priv->drag_column_id,
- &value);
- svalue = g_value_get_string (&value);
+ model->priv->base_drag_column_id,
+ &base_value);
+ base_data = g_value_get_string (&base_value);
+
+ if (model->priv->extra_drag_column_id >= 0) {
+ gtk_tree_model_get_value (GTK_TREE_MODEL (model), &iter,
+ model->priv->extra_drag_column_id,
+ &extra_value);
+ extra_data = g_value_get_string (&extra_value);
+ } else
+ extra_data = NULL;
- g_return_if_fail (svalue != NULL);
+ g_return_if_fail (base_data != NULL);
- LOG ("Data get %s", svalue)
+ LOG ("Data get %s (%s)", base_data, extra_data)
- iteratee (svalue, NULL, data);
+ iteratee (base_data, extra_data, data);
gtk_tree_path_free (path);
- g_value_unset (&value);
+ g_value_unset (&base_value);
+
+ if (model->priv->extra_drag_column_id >= 0)
+ g_value_unset (&extra_value);
}
}
diff --git a/lib/widgets/ephy-tree-model-sort.h b/lib/widgets/ephy-tree-model-sort.h
index c24fc214b..d985b089d 100644
--- a/lib/widgets/ephy-tree-model-sort.h
+++ b/lib/widgets/ephy-tree-model-sort.h
@@ -50,12 +50,14 @@ typedef struct
void (*node_from_iter) (EphyTreeModelSort *model, GtkTreeIter *iter, void **node);
} EphyTreeModelSortClass;
-GType ephy_tree_model_sort_get_type (void);
+GType ephy_tree_model_sort_get_type (void);
-GtkTreeModel *ephy_tree_model_sort_new (GtkTreeModel *child_model);
+GtkTreeModel *ephy_tree_model_sort_new (GtkTreeModel *child_model);
-void ephy_tree_model_sort_set_column_id (EphyTreeModelSort *ms,
- int id);
+void ephy_tree_model_sort_set_base_drag_column_id (EphyTreeModelSort *ms,
+ int id);
+void ephy_tree_model_sort_set_extra_drag_column_id (EphyTreeModelSort *ms,
+ int id);
G_END_DECLS