aboutsummaryrefslogtreecommitdiffstats
path: root/lib/widgets/ephy-editable-toolbar.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-03-26 03:53:58 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-03-26 03:53:58 +0800
commitb3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7 (patch)
tree2db543911c8a7d013d10f3475e3eab6135f9b8f6 /lib/widgets/ephy-editable-toolbar.c
parent4a0747542c21fa5660cbf09d4b3aca5520ef8ca9 (diff)
downloadgsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.tar
gsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.tar.gz
gsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.tar.bz2
gsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.tar.lz
gsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.tar.xz
gsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.tar.zst
gsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.zip
Make ids private
2003-03-25 Marco Pesenti Gritti <marco@it.gnome.org> * lib/ephy-dnd.c: * lib/ephy-dnd.h: Make ids private * lib/widgets/ephy-editable-toolbar.c: (impl_get_action_name), (impl_get_action), (drag_data_received_cb), (setup_toolbar), (setup_item), (ensure_action), (ephy_editable_toolbar_class_init), (update_editor_sheet), (ephy_editable_toolbar_get_action_name), (ephy_editable_toolbar_get_action): * lib/widgets/ephy-editable-toolbar.h: Rework special actions api. * lib/widgets/ephy-tree-model-sort.c: (ephy_tree_model_sort_init), (ephy_tree_model_sort_set_drag_property), (each_url_get_data_binder), (ephy_tree_model_sort_multi_drag_data_get): * lib/widgets/ephy-tree-model-sort.h: Support nodes dnd. Need more work, see FIXME * src/bookmarks/Makefile.am: * src/bookmarks/ephy-bookmarks-editor.c: (ephy_bookmarks_editor_construct): * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_init), (ephy_bookmarks_finalize), (ephy_bookmarks_find_keyword): * src/bookmarks/ephy-node-view.c: (ephy_node_view_enable_drag_source): * src/bookmarks/ephy-node-view.h: * src/history-dialog.c: (history_dialog_setup_view): * src/toolbar.c: (toolbar_get_action_name), (toolbar_get_action), (toolbar_class_init): Support for topics dnd. The menu is still not implemented but the hard part is done. Cant finish it until the weekend :/
Diffstat (limited to 'lib/widgets/ephy-editable-toolbar.c')
-rwxr-xr-xlib/widgets/ephy-editable-toolbar.c77
1 files changed, 51 insertions, 26 deletions
diff --git a/lib/widgets/ephy-editable-toolbar.c b/lib/widgets/ephy-editable-toolbar.c
index 7307140c8..2af974a87 100755
--- a/lib/widgets/ephy-editable-toolbar.c
+++ b/lib/widgets/ephy-editable-toolbar.c
@@ -29,18 +29,12 @@
#include <libgnome/gnome-i18n.h>
#include <string.h>
-/* This is copied from gtkscrollbarwindow.c */
-#define DEFAULT_SCROLLBAR_SPACING 3
-
-#define SCROLLBAR_SPACING(w) \
- (GTK_SCROLLED_WINDOW_GET_CLASS (w)->scrollbar_spacing >= 0 ? \
- GTK_SCROLLED_WINDOW_GET_CLASS (w)->scrollbar_spacing : DEFAULT_SCROLLBAR_SPACING)
-
static GtkTargetEntry dest_drag_types [] =
{
{ "EPHY_TOOLBAR_BUTTON", 0, 0 },
/* FIXME generic way to add types */
- { EPHY_DND_URL_TYPE, 0, EPHY_DND_URL }
+ { EPHY_DND_URL_TYPE, 0, 1 },
+ { EPHY_DND_TOPIC_TYPE, 0, 2 }
};
static GtkTargetEntry source_drag_types [] =
@@ -180,23 +174,23 @@ find_action (EphyEditableToolbar *t, const char *name)
return action;
}
+static char *
+impl_get_action_name (EphyEditableToolbar *etoolbar,
+ const char *drag_type,
+ const char *data)
+{
+ return NULL;
+}
+
static EggAction *
impl_get_action (EphyEditableToolbar *etoolbar,
- const char *type,
const char *name)
{
EggAction *action;
g_return_val_if_fail (IS_EPHY_EDITABLE_TOOLBAR (etoolbar), NULL);
- if (type == NULL)
- {
- action = find_action (etoolbar, name);
- }
- else
- {
- action = NULL;
- }
+ action = find_action (etoolbar, name);
return action;
}
@@ -248,10 +242,12 @@ drag_data_received_cb (GtkWidget *widget,
EphyToolbarsItem *sibling;
const char *type = NULL;
GdkAtom target;
- EggAction *action;
+ EggAction *action = NULL;
g_return_if_fail (IS_EPHY_EDITABLE_TOOLBAR (etoolbar));
+ LOG ("Drag data received")
+
toolbar = (EphyToolbarsToolbar *)g_object_get_data (G_OBJECT (widget), "toolbar_data");
if (!toolbar)
@@ -273,8 +269,28 @@ drag_data_received_cb (GtkWidget *widget,
{
type = EPHY_DND_URL_TYPE;
}
+ else if (target == gdk_atom_intern (EPHY_DND_TOPIC_TYPE, FALSE))
+ {
+ type = EPHY_DND_TOPIC_TYPE;
+ }
+
+ if (type)
+ {
+ char *name;
+
+ name = ephy_editable_toolbar_get_action_name
+ (etoolbar, type, selection_data->data);
+ if (name != NULL)
+ {
+ action = ephy_editable_toolbar_get_action (etoolbar, name);
+ g_free (name);
+ }
+ }
+ else
+ {
+ action = ephy_editable_toolbar_get_action (etoolbar, selection_data->data);
+ }
- action = ephy_editable_toolbar_get_action (etoolbar, type, selection_data->data);
if (action)
{
ephy_toolbars_group_add_item (etoolbar->priv->group, parent, sibling,
@@ -540,7 +556,7 @@ setup_toolbar (EphyToolbarsToolbar *toolbar, EphyEditableToolbar *etoolbar)
g_object_set_data (G_OBJECT (widget), "drag_dest_set",
GINT_TO_POINTER (TRUE));
gtk_drag_dest_set (widget, GTK_DEST_DEFAULT_ALL,
- dest_drag_types, 2,
+ dest_drag_types, 3,
GDK_ACTION_MOVE | GDK_ACTION_COPY);
g_signal_connect (widget, "drag_data_received",
G_CALLBACK (drag_data_received_cb),
@@ -587,7 +603,7 @@ setup_item (EphyToolbarsItem *item, EphyEditableToolbar *etoolbar)
g_object_set_data (G_OBJECT (toolitem), "drag_dest_set",
GINT_TO_POINTER (TRUE));
gtk_drag_dest_set (toolitem, GTK_DEST_DEFAULT_ALL,
- dest_drag_types, 2,
+ dest_drag_types, 3,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
g_signal_connect (toolitem, "drag_data_received",
G_CALLBACK (drag_data_received_cb),
@@ -676,7 +692,7 @@ ensure_action (EphyToolbarsItem *item, EphyEditableToolbar *t)
g_return_if_fail (IS_EPHY_EDITABLE_TOOLBAR (t));
g_return_if_fail (item != NULL);
- ephy_editable_toolbar_get_action (t, NULL, item->action);
+ ephy_editable_toolbar_get_action (t, item->action);
}
static void
@@ -774,6 +790,7 @@ ephy_editable_toolbar_class_init (EphyEditableToolbarClass *klass)
object_class->get_property = ephy_editable_toolbar_get_property;
klass->get_action = impl_get_action;
+ klass->get_action_name = impl_get_action_name;
g_object_class_install_property (object_class,
PROP_MENU_MERGE,
@@ -1033,7 +1050,7 @@ update_editor_sheet (EphyEditableToolbar *etoolbar)
gtk_scrolled_window_add_with_viewport
(GTK_SCROLLED_WINDOW (etoolbar->priv->scrolled_window), table);
gtk_drag_dest_set (table, GTK_DEST_DEFAULT_ALL,
- dest_drag_types, 2, GDK_ACTION_MOVE);
+ dest_drag_types, 3, GDK_ACTION_MOVE);
g_signal_connect (table, "drag_data_received",
G_CALLBACK (editor_drag_data_received_cb),
etoolbar);
@@ -1057,7 +1074,7 @@ update_editor_sheet (EphyEditableToolbar *etoolbar)
EggAction *action;
action = ephy_editable_toolbar_get_action
- (etoolbar, NULL, node->action);
+ (etoolbar, node->action);
g_return_if_fail (action != NULL);
event_box = gtk_event_box_new ();
@@ -1202,11 +1219,19 @@ ephy_editable_toolbar_edit (EphyEditableToolbar *etoolbar, GtkWidget *window)
show_editor (etoolbar);
}
+char *
+ephy_editable_toolbar_get_action_name (EphyEditableToolbar *etoolbar,
+ const char *drag_type,
+ const char *data)
+{
+ EphyEditableToolbarClass *klass = EPHY_EDITABLE_TOOLBAR_GET_CLASS (etoolbar);
+ return klass->get_action_name (etoolbar, drag_type, data);
+}
+
EggAction *
ephy_editable_toolbar_get_action (EphyEditableToolbar *etoolbar,
- const char *type,
const char *name)
{
EphyEditableToolbarClass *klass = EPHY_EDITABLE_TOOLBAR_GET_CLASS (etoolbar);
- return klass->get_action (etoolbar, type, name);
+ return klass->get_action (etoolbar, name);
}