[epiphany] Remove code to support bookmark/topic toolbar



commit 2b63143ef7d712e62347536b363a16ad4953ad0c
Author: Xan Lopez <xan igalia com>
Date:   Wed Dec 14 17:37:54 2011 +0100

    Remove code to support bookmark/topic toolbar

 src/bookmarks/ephy-bookmarks-editor.c |  179 ++-------------
 src/bookmarks/ephy-bookmarks-ui.c     |  397 ++-------------------------------
 src/bookmarks/ephy-bookmarks-ui.h     |    4 -
 src/ephy-shell.c                      |    3 -
 4 files changed, 45 insertions(+), 538 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index f0a77fd..0158fdf 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -18,37 +18,36 @@
  */
 
 #include "config.h"
-
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-#include <glib/gi18n.h>
-#include <string.h>
-
 #include "ephy-bookmarks-editor.h"
-#include "ephy-bookmarks-import.h"
+
+#include "ephy-bookmark-action.h"
 #include "ephy-bookmarks-export.h"
+#include "ephy-bookmarks-import.h"
 #include "ephy-bookmarks-ui.h"
-#include "ephy-bookmark-action.h"
-#include "ephy-topic-action.h"
+#include "ephy-debug.h"
+#include "ephy-dnd.h"
+#include "ephy-favicon-cache.h"
+#include "ephy-file-chooser.h"
+#include "ephy-file-helpers.h"
+#include "ephy-gui.h"
 #include "ephy-node-common.h"
 #include "ephy-node-view.h"
-#include "ephy-window.h"
-#include "ephy-dnd.h"
+#include "ephy-prefs.h"
+#include "ephy-search-entry.h"
+#include "ephy-session.h"
 #include "ephy-settings.h"
 #include "ephy-shell.h"
-#include "ephy-session.h"
-#include "ephy-file-helpers.h"
-#include "ephy-file-chooser.h"
-#include "popup-commands.h"
 #include "ephy-state.h"
-#include "window-commands.h"
-#include "ephy-gui.h"
 #include "ephy-stock-icons.h"
-#include "ephy-search-entry.h"
-#include "ephy-favicon-cache.h"
-#include "ephy-debug.h"
-#include "egg-toolbars-model.h"
-#include "ephy-prefs.h"
+#include "ephy-topic-action.h"
+#include "ephy-window.h"
+#include "popup-commands.h"
+#include "window-commands.h"
+
+#include <gdk/gdkkeysyms.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <string.h>
 
 static const GtkTargetEntry topic_drag_dest_types [] =
 {
@@ -97,8 +96,6 @@ static void cmd_open_bookmarks_in_tabs    (GtkAction *action,
 					   EphyBookmarksEditor *editor);
 static void cmd_open_bookmarks_in_browser (GtkAction *action,
 					   EphyBookmarksEditor *editor);
-static void cmd_toolbar			  (GtkAction *action,
-					   EphyBookmarksEditor *editor);
 static void cmd_delete			  (GtkAction *action,
 					   EphyBookmarksEditor *editor);
 static void cmd_bookmark_properties	  (GtkAction *action,
@@ -211,9 +208,6 @@ static const GtkActionEntry ephy_bookmark_popup_entries [] = {
 };
 
 static const GtkToggleActionEntry ephy_bookmark_toggle_entries [] = {
-	{ "ShowOnToolbar", NULL, N_("_Show on Toolbar"), NULL,
-	  N_("Show the selected bookmark on a toolbar"), 
-	  G_CALLBACK (cmd_toolbar), FALSE },
 	/* View Menu */
 	{ "ViewTitle", NULL, N_("_Title"), NULL,
 	  N_("Show the title column"), NULL, TRUE },
@@ -396,118 +390,6 @@ delete_topic_dialog_construct (GtkWindow *parent,
 	return dialog;
 }
 
-static gint
-get_bookmarks_bar (EggToolbarsModel *model)
-{
-	gint tpos;
-	const char *tname;
-	
-	for (tpos = 0; tpos < egg_toolbars_model_n_toolbars (model); tpos++)
-	{
-		tname = egg_toolbars_model_toolbar_nth (model, tpos);
-
-		if (tname != NULL &&
-		    strcmp (tname, "BookmarksBar") == 0)
-			break;
-	}
-	
-	if (tpos == egg_toolbars_model_n_toolbars (model))
-	{		
-		tpos = egg_toolbars_model_add_toolbar (model, -1, "BookmarksBar");
-	}
-	
-	return tpos;
-}
-
-static void
-cmd_toolbar (GtkAction *action,
-	     EphyBookmarksEditor *editor)
-{
-	EggToolbarsModel *model;
-	EphyNode *node;
-	gboolean show;
-	gint flags, tpos = 0;
-	GList *selection;
-	GList *l;
-	
-	model = EGG_TOOLBARS_MODEL (ephy_shell_get_toolbars_model (ephy_shell_get_default (), FALSE));
-		
-	if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->bm_view)))
-	{
-		char name[EPHY_BOOKMARK_ACTION_NAME_BUFFER_SIZE];
-
-		selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->bm_view));
-		
-		node = selection->data;
-
-		EPHY_BOOKMARK_ACTION_NAME_PRINTF (name, node);
-
-		flags = egg_toolbars_model_get_name_flags (model, name);
-		show = ((flags & EGG_TB_MODEL_NAME_USED) == 0);
-		
-		if (show)
-		{
-			tpos = get_bookmarks_bar (model);
-		}
-
-		for (l = selection; l; l = l->next)
-		{
-			node = l->data;
-
-			EPHY_BOOKMARK_ACTION_NAME_PRINTF (name, node);
-
-			flags = egg_toolbars_model_get_name_flags (model, name);
-			if(show && ((flags & EGG_TB_MODEL_NAME_USED) == 0))
-			{
-				egg_toolbars_model_add_item (model, tpos, -1, name);
-			}
-			else if(!show && ((flags & EGG_TB_MODEL_NAME_USED) != 0))
-			{
-				egg_toolbars_model_delete_item (model, name);
-			}
-		}
-
-		g_list_free (selection);
-	}
-	else if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->key_view)))
-	{
-		char name[EPHY_TOPIC_ACTION_NAME_BUFFER_SIZE];
-
-		selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->key_view));
-	  
-		node = selection->data;
-
-		EPHY_TOPIC_ACTION_NAME_PRINTF (name, node);
-
-		flags = egg_toolbars_model_get_name_flags (model, name);
-		show = ((flags & EGG_TB_MODEL_NAME_USED) == 0);
-
-		if (show)
-		{
-			tpos = get_bookmarks_bar (model);
-		}
-
-		for (l = selection; l; l = l->next)
-		{
-			node = l->data;
-
-			EPHY_TOPIC_ACTION_NAME_PRINTF (name, node);
-
-			flags = egg_toolbars_model_get_name_flags (model, name);
-			if(show && ((flags & EGG_TB_MODEL_NAME_USED) == 0))
-			{
-				egg_toolbars_model_add_item (model, tpos, -1, name);
-			}
-			else if(!show && ((flags & EGG_TB_MODEL_NAME_USED) != 0))
-			{
-				egg_toolbars_model_delete_item (model, name);
-			}
-		}
-
-		g_list_free (selection);
-	}
-}
-
 static void
 cmd_delete (GtkAction *action,
 	    EphyBookmarksEditor *editor)
@@ -1202,10 +1084,7 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
 	gboolean key_normal = FALSE;
 	gboolean cut, copy, paste, select_all;
 	gboolean mutable = TRUE;
-	gboolean showtoolbar = FALSE;
-	gboolean ontoolbar = FALSE;
 
-	EggToolbarsModel *model;
 	GtkActionGroup *action_group;
 	GtkAction *action;
 	GList *selected;
@@ -1214,9 +1093,6 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
 
 	LOG ("Update menu sensitivity");
 
-	model = EGG_TOOLBARS_MODEL (ephy_shell_get_toolbars_model 
-				    (ephy_shell_get_default(), FALSE));
-	
 	bmk_focus = ephy_node_view_is_target
 		(EPHY_NODE_VIEW (editor->priv->bm_view));
 	key_focus = ephy_node_view_is_target
@@ -1265,9 +1141,6 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
 
 		EPHY_TOPIC_ACTION_NAME_PRINTF (name, node);
 
-		ontoolbar = ((egg_toolbars_model_get_name_flags (model, name)
-			      & EGG_TB_MODEL_NAME_USED) != 0);
-
 		g_list_free (selected);
 	}
 
@@ -1283,9 +1156,6 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
 		
 		EPHY_BOOKMARK_ACTION_NAME_PRINTF (name, node);
 
-		ontoolbar = ((egg_toolbars_model_get_name_flags (model, name)
-			      & EGG_TB_MODEL_NAME_USED) != 0);
-
 		g_list_free (selected);
 	}
 
@@ -1312,8 +1182,6 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
 	delete = (bmk_focus && bmk_selection && mutable) ||
 		 (key_selection && key_focus && key_normal);
 	properties = bmk_focus && single_bmk_selected && mutable;
-	showtoolbar = (bmk_focus && bmk_selection) ||
-	              (key_focus && key_selection);
 
 	action_group = editor->priv->action_group;
 	action = gtk_action_group_get_action (action_group, "OpenInWindow");
@@ -1337,11 +1205,6 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
 	gtk_action_set_sensitive (action, paste);
 	action = gtk_action_group_get_action (action_group, "SelectAll");
 	g_object_set (action, "sensitive", select_all, NULL);
-	action = gtk_action_group_get_action (action_group, "ShowOnToolbar");
-	gtk_action_set_sensitive (action, showtoolbar);
-	g_signal_handlers_block_by_func (action, cmd_toolbar, editor);
-	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), ontoolbar);
-	g_signal_handlers_unblock_by_func (action, cmd_toolbar, editor);
 }
 
 static gboolean
diff --git a/src/bookmarks/ephy-bookmarks-ui.c b/src/bookmarks/ephy-bookmarks-ui.c
index 7ce3a0d..f7970d9 100644
--- a/src/bookmarks/ephy-bookmarks-ui.c
+++ b/src/bookmarks/ephy-bookmarks-ui.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
  *  Copyright  2005 Peter Harvey
  *  Copyright  2006 Christian Persch
@@ -19,33 +20,32 @@
  */
 
 #include "config.h"
-
-#include "ephy-bookmarks.h"
 #include "ephy-bookmarks-ui.h"
-#include "ephy-bookmarks-menu.h"
-#include "ephy-bookmark-action.h"
-#include "ephy-topic-action.h"
+
 #include "ephy-bookmark-action-group.h"
-#include "ephy-topic-action-group.h"
-#include "ephy-related-action.h"
-#include "ephy-open-tabs-action.h"
-#include "ephy-topic-factory-action.h"
+#include "ephy-bookmark-action.h"
 #include "ephy-bookmark-factory-action.h"
 #include "ephy-bookmark-properties.h"
-#include "ephy-node-common.h"
-#include "ephy-link.h"
+#include "ephy-bookmarks-menu.h"
+#include "ephy-bookmarks.h"
+#include "ephy-debug.h"
 #include "ephy-dnd.h"
 #include "ephy-embed-shell.h"
-#include "ephy-history.h"
-#include "ephy-shell.h"
-#include "ephy-string.h"
-#include "ephy-debug.h"
 #include "ephy-file-helpers.h"
 #include "ephy-gui.h"
-#include "ephy-stock-icons.h"
+#include "ephy-history.h"
+#include "ephy-link.h"
+#include "ephy-node-common.h"
+#include "ephy-open-tabs-action.h"
 #include "ephy-prefs.h"
+#include "ephy-related-action.h"
 #include "ephy-settings.h"
-#include "egg-editable-toolbar.h"
+#include "ephy-shell.h"
+#include "ephy-stock-icons.h"
+#include "ephy-string.h"
+#include "ephy-topic-action-group.h"
+#include "ephy-topic-action.h"
+#include "ephy-topic-factory-action.h"
 
 #include <string.h>
 #include <glib/gi18n.h>
@@ -108,78 +108,6 @@ activate_bookmarks_menu (GtkAction *action, EphyWindow *window)
 	}
 }
 
-#if 0
-static void
-activate_bookmark_properties (GtkAction *action,
-			      EggEditableToolbar *etoolbar)
-{
-	GtkAction *baction;
-	GtkWidget *widget;
-
-	widget = gtk_widget_get_ancestor (egg_editable_toolbar_get_selected (etoolbar),
-					  GTK_TYPE_TOOL_ITEM);
-	baction = widget ? gtk_activatable_get_related_action (GTK_ACTIVATABLE (widget)) : NULL;
-	g_return_if_fail (EPHY_IS_BOOKMARK_ACTION (baction));
-
-	ephy_bookmarks_ui_show_bookmark (ephy_bookmark_action_get_bookmark
-						 (EPHY_BOOKMARK_ACTION (baction)));
-}
-
-static void
-activate_bookmark_open_tab (GtkAction *action,
-			    EggEditableToolbar *etoolbar)
-{
-	GtkAction *baction;
-	GtkWidget *widget;
-
-	widget = gtk_widget_get_ancestor (egg_editable_toolbar_get_selected (etoolbar),
-					  GTK_TYPE_TOOL_ITEM);
-	baction = widget ? gtk_activatable_get_related_action (GTK_ACTIVATABLE (widget)) : NULL;
-	g_return_if_fail (EPHY_IS_BOOKMARK_ACTION (baction));
-
-	ephy_bookmark_action_activate (EPHY_BOOKMARK_ACTION (baction), widget,
-				       EPHY_LINK_NEW_TAB);
-}
-
-static void
-activate_bookmark_open_window (GtkAction *action,
-			       EggEditableToolbar *etoolbar)
-{
-	GtkAction *baction;
-	GtkWidget *widget;
-
-	widget = gtk_widget_get_ancestor (egg_editable_toolbar_get_selected (etoolbar),
-					  GTK_TYPE_TOOL_ITEM);
-	baction = widget ? gtk_activatable_get_related_action (GTK_ACTIVATABLE (widget)) : NULL;
-	g_return_if_fail (EPHY_IS_BOOKMARK_ACTION (baction));
-
-	ephy_bookmark_action_activate (EPHY_BOOKMARK_ACTION (baction), widget,
-				       EPHY_LINK_NEW_WINDOW);
-}
-
-static void
-selected_bookmark_action (EggEditableToolbar *etoolbar,
-			  GParamSpec *pspec,
-			  GtkAction *action)
-{
-	GtkAction *baction;
-	GtkWidget *widget;
-	gboolean visible;
-	
-	visible = FALSE;
-	
-	if (!egg_editable_toolbar_get_edit_mode (etoolbar))
-	{
-		widget = egg_editable_toolbar_get_selected (etoolbar);
-		widget = widget ? gtk_widget_get_ancestor (widget, GTK_TYPE_TOOL_ITEM) : NULL;
-		baction = widget ? gtk_activatable_get_related_action (GTK_ACTIVATABLE (widget)) : NULL;
-		visible = EPHY_IS_BOOKMARK_ACTION (baction);
-	}
-	  
-	gtk_action_set_visible (action, visible);
-}
-#endif
-
 static void
 erase_bookmarks_menu (EphyWindow *window)
 {
@@ -243,9 +171,6 @@ ephy_bookmarks_ui_attach_window (EphyWindow *window)
 	EphyNode *topics;
 	BookmarksWindowData *data;
 	GtkUIManager *manager;
-#if 0
-	EggEditableToolbar *etoolbar;
-#endif
 	GtkActionGroup *actions;
 	GtkAction *action;
 
@@ -256,9 +181,6 @@ ephy_bookmarks_ui_attach_window (EphyWindow *window)
 	g_return_if_fail (data == NULL);
 
 	manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window));
-#if 0
-	etoolbar = EGG_EDITABLE_TOOLBAR (ephy_window_get_toolbar (window));
-#endif
 
 	data = g_new0 (BookmarksWindowData, 1);
 	g_object_set_data_full (G_OBJECT (window), BM_WINDOW_DATA_KEY, data, g_free);
@@ -282,76 +204,6 @@ ephy_bookmarks_ui_attach_window (EphyWindow *window)
 				 G_CONNECT_SWAPPED | G_CONNECT_AFTER);
 	g_object_unref (actions);
 	
-	/* Create and add an action group specifically foor bookmarks on the toolbar */
-	actions = gtk_action_group_new ("BookmarkToolbarActions");
-	gtk_ui_manager_insert_action_group (manager, actions, 0);	
-	g_object_unref (actions);
-
-	/* Add factory actions */
-	action = ephy_topic_factory_action_new ("AddTopicToToolbar");
-	gtk_action_group_add_action (actions, action);
-	g_object_unref (action);
-	
-	action = ephy_bookmark_factory_action_new ("AddBookmarkToToolbar");
-	gtk_action_group_add_action (actions, action);
-	g_object_unref (action);
-
-	/* Add the dynamic 'related topic' action */
-	action = ephy_related_action_new (EPHY_LINK (window), manager, "RelatedTopic");
-	gtk_action_group_add_action (actions, action);
-	g_object_unref (action);
-
-	/* Add popup menu actions that are specific to the bookmark widgets */
-	action = gtk_action_new ("ToolbarBookmarkProperties", _("_Properties"), 
-				 _("Show properties for this bookmark"), GTK_STOCK_PROPERTIES);
-#if 0
-	g_signal_connect_object (action, "activate",
-				 G_CALLBACK (activate_bookmark_properties), 
-				 G_OBJECT (etoolbar), 0);
-	g_signal_connect_object (etoolbar, "notify::selected",
-				 G_CALLBACK (selected_bookmark_action),
-				 G_OBJECT (action), 0);
-#endif
-	gtk_action_group_add_action (actions, action);
-	g_object_unref (action);
-
-	/* FIXME ngettext */
-	action = gtk_action_new ("ToolbarBookmarkOpenInTab", _("Open in New _Tab"),
-				 _("Open this bookmark in a new tab"), STOCK_NEW_TAB);
-#if 0
-	g_signal_connect_object (action, "activate",
-				 G_CALLBACK (activate_bookmark_open_tab), 
-				 G_OBJECT (etoolbar), 0);
-	g_signal_connect_object (etoolbar, "notify::selected",
-				 G_CALLBACK (selected_bookmark_action),
-				 G_OBJECT (action), 0);
-#endif
-	gtk_action_group_add_action (actions, action);
-	g_object_unref (action);
-
-	/* FIXME ngettext */
-	action = gtk_action_new ("ToolbarBookmarkOpenInWindow", _("Open in New _Window"), 
-				 _("Open this bookmark in a new window"), GTK_STOCK_NEW);
-#if 0
-	g_signal_connect_object (action, "activate",
-				 G_CALLBACK (activate_bookmark_open_window),
-				 G_OBJECT (etoolbar), 0);
-	g_signal_connect_object (etoolbar, "notify::selected",
-				 G_CALLBACK (selected_bookmark_action),
-				 G_OBJECT (action), 0);
-#endif
-	gtk_action_group_add_action (actions, action);
-	g_object_unref (action);
-
-	data->toolbar_menu = gtk_ui_manager_add_ui_from_string (manager,
-	   "<popup name=\"ToolbarPopup\">"
-	   "<placeholder name=\"SpecificItemsGroup\">"
-	   "<menuitem action=\"ToolbarBookmarkOpenInTab\"/>"
-	   "<menuitem action=\"ToolbarBookmarkOpenInWindow\"/>"
-	   "<menuitem action=\"ToolbarBookmarkProperties\"/>"
-	   "</placeholder>"
-	   "</popup>", -1, NULL);  
-
 	/* Add signal handlers for the bookmark database */
 	ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_ADDED,
 					 (EphyNodeCallback)node_added_cb,
@@ -379,7 +231,9 @@ ephy_bookmarks_ui_attach_window (EphyWindow *window)
 				 G_OBJECT (window), 0);
 
 	/* Setup empty menu strings and add signal handlers to build the menus on demand */
-	if (!bookmarks_menu_string) bookmarks_menu_string = g_string_new ("");
+	if (!bookmarks_menu_string)
+            bookmarks_menu_string = g_string_new ("");
+
 	action = find_action (manager, "Bookmarks");
 	g_signal_connect_object (action, "activate",
 				 G_CALLBACK (activate_bookmarks_menu),
@@ -398,8 +252,10 @@ ephy_bookmarks_ui_detach_window (EphyWindow *window)
 	GtkAction *action;
 
 	g_return_if_fail (data != 0);
-	if (data->bookmarks_menu) gtk_ui_manager_remove_ui (manager, data->bookmarks_menu);
-	if (data->toolbar_menu) gtk_ui_manager_remove_ui (manager, data->toolbar_menu);
+
+	if (data->bookmarks_menu)
+		gtk_ui_manager_remove_ui (manager, data->bookmarks_menu);
+
 	g_object_set_data (G_OBJECT (window), BM_WINDOW_DATA_KEY, 0);
 	
 	ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_ADDED,
@@ -508,210 +364,5 @@ ephy_bookmarks_ui_show_bookmark (EphyNode *bookmark)
 				      gtk_get_current_event_time ());
 }
 
-/* Below this line we have functions relating to toolbar code */
-
-static EggToolbarsItemType bookmark_type;
-static EggToolbarsItemType topic_type;
-static EphyBookmarks *eb;
 
-static gboolean
-topic_has_data (EggToolbarsItemType *type,
-		const char *name)
-{
-	EphyNode *node, *topics;
-	guint node_id;
-	
-	if (sscanf (name, EPHY_TOPIC_ACTION_NAME_FORMAT, &node_id) != 1) return FALSE;
 
-	node = ephy_bookmarks_get_from_id (eb, node_id);
-	if (node == NULL) return FALSE;
-
-	topics = ephy_bookmarks_get_keywords (eb);
-
-	return ephy_node_has_child (topics, node);
-}
-
-static char *
-topic_get_data (EggToolbarsItemType *type,
-		const char *name)
-{
-	EphyNode *node;
-	guint node_id;
-	
-	if (sscanf (name, EPHY_TOPIC_ACTION_NAME_FORMAT, &node_id) != 1) return NULL;
-
-	node = ephy_bookmarks_get_from_id (eb, node_id);
-	g_return_val_if_fail (node != NULL, NULL);
-
-	return ephy_bookmarks_get_topic_uri (eb, node);
-}
-
-static char *
-topic_get_name (EggToolbarsItemType *type,
-		const char *data)
-{
-	EphyNode *topic;
-
-	topic = ephy_bookmarks_find_keyword (eb, data, FALSE);
-	if (topic == NULL) return NULL;
-
-	return EPHY_TOPIC_ACTION_NAME_STRDUP_PRINTF (topic);
-}
-
-static gboolean
-bookmark_has_data (EggToolbarsItemType *type,
-		   const char *name)
-{
-	EphyNode *node;
-	guint node_id;
-
-	if (sscanf (name, EPHY_BOOKMARK_ACTION_NAME_FORMAT, &node_id) != 1) return FALSE;
-
-	node = ephy_bookmarks_get_from_id (eb, node_id);
-	if (node == NULL) return FALSE;
-
-	return (ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_LOCATION) != NULL);
-}
-
-static char *
-bookmark_get_data (EggToolbarsItemType *type,
-		   const char *name)
-{
-	EphyNode *node;
-	guint node_id;
-
-	if (sscanf (name, EPHY_BOOKMARK_ACTION_NAME_FORMAT, &node_id) != 1) return NULL;
-
-	node = ephy_bookmarks_get_from_id (eb, node_id);
-	g_return_val_if_fail (node != NULL, NULL);
-
-	return g_strdup (ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_LOCATION));
-}
-
-static char *
-bookmark_get_name (EggToolbarsItemType *type,
-		   const char *data)
-{
-	EphyNode *node;
-	gchar **netscape_url;
-
-	netscape_url = g_strsplit (data, "\n", 2);
-	if (netscape_url == NULL || netscape_url[0] == '\0')
-	{
-		g_strfreev (netscape_url);
-
-		return NULL;
-	}
-
-	node = ephy_bookmarks_find_bookmark (eb, netscape_url[0]);
-	g_strfreev (netscape_url);
-
-	if (node == NULL) return NULL;
-
-	return EPHY_BOOKMARK_ACTION_NAME_STRDUP_PRINTF (node);
-}
-
-static char *
-bookmark_new_name (EggToolbarsItemType *type,
-		   const char *data)
-{
-	EphyNode *node;
-	gchar **netscape_url;
-
-	netscape_url = g_strsplit (data, "\n", 2);
-	if (netscape_url == NULL || netscape_url[0] == '\0' || g_strv_length (netscape_url) < 2)
-	{
-		g_strfreev (netscape_url);
-
-		return NULL;
-	}
-
-	node = ephy_bookmarks_add (eb, netscape_url[1], netscape_url[0]);
-	g_strfreev (netscape_url);
-
-	return EPHY_BOOKMARK_ACTION_NAME_STRDUP_PRINTF (node);
-}
-
-static void
-toolbar_node_removed_cb (EphyNode *parent,
-			 EphyNode *child,
-			 guint index,
-			 EggToolbarsModel *model)
-{
-	char name[EPHY_BOOKMARKS_UI_ACTION_NAME_BUFFER_SIZE];
-	
-	switch (ephy_node_get_id (parent))
-	{
-		case BOOKMARKS_NODE_ID:
-			EPHY_BOOKMARK_ACTION_NAME_PRINTF (name, child);
-			break;
-		case KEYWORDS_NODE_ID:
-			EPHY_TOPIC_ACTION_NAME_PRINTF (name, child);
-			break;
-	 	default:
-			return;
-	}
-
-	egg_toolbars_model_delete_item (model, name);
-}
-
-void
-ephy_bookmarks_ui_attach_toolbar_model (EggToolbarsModel *model)
-{
-	EphyNode *bookmarks;
-	EphyNode *topics;
-	GList *types;
-
-	eb = ephy_shell_get_bookmarks (ephy_shell);        
-	bookmarks = ephy_bookmarks_get_bookmarks (eb);
-	topics = ephy_bookmarks_get_keywords (eb);
-	types = egg_toolbars_model_get_types (model);
-
-	topic_type.type = gdk_atom_intern (EPHY_DND_TOPIC_TYPE, TRUE);
-	topic_type.has_data = topic_has_data;
-	topic_type.get_data = topic_get_data;
-	topic_type.new_name = NULL;
-	topic_type.get_name = topic_get_name;
-
-	bookmark_type.type = gdk_atom_intern (EPHY_DND_URL_TYPE, TRUE);
-	bookmark_type.has_data = bookmark_has_data;
-	bookmark_type.get_data = bookmark_get_data;
-	bookmark_type.new_name = bookmark_new_name;
-	bookmark_type.get_name = bookmark_get_name;
-
-	types = g_list_prepend (types, &bookmark_type);
-	types = g_list_prepend (types, &topic_type);
-	egg_toolbars_model_set_types (model, types);
-
-	ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_REMOVED,
-					 (EphyNodeCallback)toolbar_node_removed_cb,
-					 G_OBJECT (model));
-	ephy_node_signal_connect_object (topics, EPHY_NODE_CHILD_REMOVED,
-					 (EphyNodeCallback)toolbar_node_removed_cb,
-					 G_OBJECT (model));
-
-	egg_toolbars_model_set_name_flags (model, "AddTopicToToolbar", 
-					   EGG_TB_MODEL_NAME_KNOWN |
-					   EGG_TB_MODEL_NAME_INFINITE);
-	egg_toolbars_model_set_name_flags (model, "AddBookmarkToToolbar", 
-					   EGG_TB_MODEL_NAME_KNOWN |
-					   EGG_TB_MODEL_NAME_INFINITE);
-	egg_toolbars_model_set_name_flags (model, "RelatedTopic", 
-					   EGG_TB_MODEL_NAME_KNOWN);
-}
-
-
-void
-ephy_bookmarks_ui_detach_toolbar_model (EggToolbarsModel *model)
-{
-	EphyBookmarks *eb = ephy_shell_get_bookmarks (ephy_shell);        
-	EphyNode *bookmarks = ephy_bookmarks_get_bookmarks (eb);
-	EphyNode *topics = ephy_bookmarks_get_keywords (eb);
-	
-	ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_REMOVED,
-					    (EphyNodeCallback)toolbar_node_removed_cb,
-					    G_OBJECT (model));
-	ephy_node_signal_disconnect_object (topics, EPHY_NODE_CHILD_REMOVED,
-					    (EphyNodeCallback)toolbar_node_removed_cb,
-					    G_OBJECT (model));
-}
diff --git a/src/bookmarks/ephy-bookmarks-ui.h b/src/bookmarks/ephy-bookmarks-ui.h
index eb971ad..2dfbebc 100644
--- a/src/bookmarks/ephy-bookmarks-ui.h
+++ b/src/bookmarks/ephy-bookmarks-ui.h
@@ -56,10 +56,6 @@ void	ephy_bookmarks_ui_attach_window		(EphyWindow *window);
 
 void	ephy_bookmarks_ui_detach_window		(EphyWindow *window);
 
-void	ephy_bookmarks_ui_attach_toolbar_model	(EggToolbarsModel *model);
-
-void	ephy_bookmarks_ui_detach_toolbar_model	(EggToolbarsModel *model);
-
 void	ephy_bookmarks_ui_add_bookmark		(GtkWindow *parent,
 						 const char *location,
 						 const char *title);
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 664ffc1..217b79b 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -26,7 +26,6 @@
 #include "egg-toolbars-model.h"
 #include "ephy-bookmarks-editor.h"
 #include "ephy-bookmarks-import.h"
-#include "ephy-bookmarks-ui.h"
 #include "ephy-debug.h"
 #include "ephy-embed-container.h"
 #include "ephy-embed-single.h"
@@ -865,8 +864,6 @@ ephy_shell_get_toolbars_model (EphyShell *shell, gboolean fullscreen)
     if (shell->priv->toolbars_model == NULL) {
       shell->priv->toolbars_model = ephy_toolbars_model_new ();
 
-      ephy_bookmarks_ui_attach_toolbar_model (shell->priv->toolbars_model);
-
       ephy_toolbars_model_load
         (EPHY_TOOLBARS_MODEL (shell->priv->toolbars_model));
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]