aboutsummaryrefslogtreecommitdiffstats
path: root/src/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 /src/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 'src/toolbar.c')
-rwxr-xr-xsrc/toolbar.c77
1 files changed, 56 insertions, 21 deletions
diff --git a/src/toolbar.c b/src/toolbar.c
index f8ecf0316..76e992e7f 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -27,6 +27,7 @@
#include "ephy-spinner-action.h"
#include "ephy-location-action.h"
#include "ephy-favicon-action.h"
+#include "ephy-topic-action.h"
#include "ephy-go-action.h"
#include "ephy-navigation-action.h"
#include "ephy-bookmark-action.h"
@@ -132,27 +133,30 @@ get_bookmark_action (Toolbar *t, EphyBookmarks *bookmarks, gulong id, const char
return action;
}
-static EggAction *
-toolbar_get_action (EphyEditableToolbar *etoolbar,
- const char *type,
- const char *name)
+static char *
+toolbar_get_action_name (EphyEditableToolbar *etoolbar,
+ const char *drag_type,
+ const char *data)
{
Toolbar *t = TOOLBAR (etoolbar);
- EggAction *action = NULL;
EphyBookmarks *bookmarks;
gulong id = 0;
- char action_name[255];
+ char *res = NULL;
bookmarks = ephy_shell_get_bookmarks (ephy_shell);
- if (type && (strcmp (type, EPHY_DND_URL_TYPE) == 0))
+ if (drag_type && (strcmp (drag_type, EPHY_DND_TOPIC_TYPE) == 0))
+ {
+ res = g_strdup_printf ("GoTopicId%s", data);
+ }
+ else if (drag_type && (strcmp (drag_type, EPHY_DND_URL_TYPE) == 0))
{
GtkWidget *new_bookmark;
const char *url;
const char *title = NULL;
GList *uris;
- uris = ephy_dnd_uri_list_extract_uris (name);
+ uris = ephy_dnd_uri_list_extract_uris ((char *)data);
g_return_val_if_fail (uris != NULL, NULL);
url = (const char *)uris->data;
if (uris->next)
@@ -176,29 +180,59 @@ toolbar_get_action (EphyEditableToolbar *etoolbar,
g_list_foreach (uris, (GFunc)g_free, NULL);
g_list_free (uris);
+
+ if (id != 0)
+ {
+ res = g_strdup_printf ("GoBookmarkId%ld", id);
+ }
+ else
+ {
+ res = NULL;
+ }
+ }
+
+ return res;
+}
+
+static EggAction *
+toolbar_get_action (EphyEditableToolbar *etoolbar,
+ const char *name)
+{
+ Toolbar *t = TOOLBAR (etoolbar);
+ EggAction *action = NULL;
+ gulong id = 0;
+ EphyBookmarks *bookmarks;
+
+ bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+
+ action = EPHY_EDITABLE_TOOLBAR_CLASS
+ (parent_class)->get_action (etoolbar, name);
+ if (action)
+ {
+ return action;
}
else if (g_str_has_prefix (name, "GoBookmarkId"))
{
if (!ephy_str_to_int (name + strlen ("GoBookmarkId"), &id))
{
- id = 0;
+ return NULL;
}
- }
- if (id != 0)
+ action = get_bookmark_action (t, bookmarks, id, name);
+ }
+ else if (g_str_has_prefix (name, "GoTopicId"))
{
- snprintf (action_name, 255, "GoBookmarkId%ld", id);
- action = EPHY_EDITABLE_TOOLBAR_CLASS
- (parent_class)->get_action (etoolbar, NULL, action_name);
- if (action == NULL)
+ if (!ephy_str_to_int (name + strlen ("GoTopicId"), &id))
{
- action = get_bookmark_action (t, bookmarks, id, action_name);
+ return NULL;
}
- }
- else
- {
- action = EPHY_EDITABLE_TOOLBAR_CLASS
- (parent_class)->get_action (etoolbar, type, name);
+
+ action = ephy_topic_action_new (name, id);
+ g_signal_connect (action, "go_location",
+ G_CALLBACK (go_location_cb),
+ t->priv->window);
+ egg_action_group_add_action (t->priv->action_group, action);
+ g_object_unref (action);
}
return action;
@@ -218,6 +252,7 @@ toolbar_class_init (ToolbarClass *klass)
object_class->get_property = toolbar_get_property;
eet_class->get_action = toolbar_get_action;
+ eet_class->get_action_name = toolbar_get_action_name;
g_object_class_install_property (object_class,
PROP_EPHY_WINDOW,