aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-06-04 19:59:38 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-06-04 19:59:38 +0800
commit29bbfe00469fe536bbf0f1025cde834cec3bec0b (patch)
tree63a51af7a1f508ba64b5e0e8bec023eee2af7f98
parent15358f9939f56b8ba5bc9df4499a72d65535ce41 (diff)
downloadgsoc2013-epiphany-29bbfe00469fe536bbf0f1025cde834cec3bec0b.tar
gsoc2013-epiphany-29bbfe00469fe536bbf0f1025cde834cec3bec0b.tar.gz
gsoc2013-epiphany-29bbfe00469fe536bbf0f1025cde834cec3bec0b.tar.bz2
gsoc2013-epiphany-29bbfe00469fe536bbf0f1025cde834cec3bec0b.tar.lz
gsoc2013-epiphany-29bbfe00469fe536bbf0f1025cde834cec3bec0b.tar.xz
gsoc2013-epiphany-29bbfe00469fe536bbf0f1025cde834cec3bec0b.tar.zst
gsoc2013-epiphany-29bbfe00469fe536bbf0f1025cde834cec3bec0b.zip
Implement bookmarks menu, might need to be optimized later.
2003-06-04 Marco Pesenti Gritti <marco@it.gnome.org> * src/bookmarks/Makefile.am: * src/bookmarks/ephy-bookmark-action.c: (connect_proxy): * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_class_init), (bookmarks_changed_cb), (bookmarks_removed_cb), (ephy_bookmarks_set_keyword), (ephy_bookmarks_unset_keyword), (ephy_bookmarks_get_favorites), (ephy_bookmarks_get_not_categorized): * src/bookmarks/ephy-bookmarks.h: * src/ephy-window.c: (ephy_window_init), (ephy_window_finalize): Implement bookmarks menu, might need to be optimized later.
-rw-r--r--ChangeLog14
-rw-r--r--src/bookmarks/Makefile.am2
-rw-r--r--src/bookmarks/ephy-bookmark-action.c3
-rw-r--r--src/bookmarks/ephy-bookmarks-menu.c443
-rw-r--r--src/bookmarks/ephy-bookmarks-menu.h58
-rw-r--r--src/bookmarks/ephy-bookmarks.c31
-rw-r--r--src/bookmarks/ephy-bookmarks.h7
-rw-r--r--src/ephy-window.c4
8 files changed, 557 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 463389905..e22dfe2ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2003-06-04 Marco Pesenti Gritti <marco@it.gnome.org>
+ * src/bookmarks/Makefile.am:
+ * src/bookmarks/ephy-bookmark-action.c: (connect_proxy):
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_class_init),
+ (bookmarks_changed_cb), (bookmarks_removed_cb),
+ (ephy_bookmarks_set_keyword), (ephy_bookmarks_unset_keyword),
+ (ephy_bookmarks_get_favorites),
+ (ephy_bookmarks_get_not_categorized):
+ * src/bookmarks/ephy-bookmarks.h:
+ * src/ephy-window.c: (ephy_window_init), (ephy_window_finalize):
+
+ Implement bookmarks menu, might need to be optimized later.
+
+2003-06-04 Marco Pesenti Gritti <marco@it.gnome.org>
+
* data/ui/epiphany-ui.xml.in:
Add a bookmarks menu. (still not the tree)
diff --git a/src/bookmarks/Makefile.am b/src/bookmarks/Makefile.am
index 6df51dd14..4425d0aa5 100644
--- a/src/bookmarks/Makefile.am
+++ b/src/bookmarks/Makefile.am
@@ -28,6 +28,8 @@ libephybookmarks_la_SOURCES = \
ephy-bookmarks-export.h \
ephy-bookmarks-import.c \
ephy-bookmarks-import.h \
+ ephy-bookmarks-menu.c \
+ ephy-bookmarks-menu.h \
ephy-bookmark-properties.c \
ephy-bookmark-properties.h \
ephy-new-bookmark.c \
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c
index 046d24798..96e011f6f 100644
--- a/src/bookmarks/ephy-bookmark-action.c
+++ b/src/bookmarks/ephy-bookmark-action.c
@@ -287,7 +287,8 @@ connect_proxy (EggAction *action, GtkWidget *proxy)
g_signal_connect (proxy, "activate", G_CALLBACK (activate_cb), action);
}
- if (EPHY_BOOKMARK_ACTION (action)->priv->smart_url)
+ if (EPHY_BOOKMARK_ACTION (action)->priv->smart_url &&
+ EGG_IS_TOOL_ITEM (proxy))
{
GtkWidget *entry;
diff --git a/src/bookmarks/ephy-bookmarks-menu.c b/src/bookmarks/ephy-bookmarks-menu.c
new file mode 100644
index 000000000..89348a5e8
--- /dev/null
+++ b/src/bookmarks/ephy-bookmarks-menu.c
@@ -0,0 +1,443 @@
+/*
+ * Copyright (C) 2002 Ricardo Fernández Pascual
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ephy-bookmarks-menu.h"
+#include "ephy-bookmark-action.h"
+#include "egg-menu-merge.h"
+#include "ephy-shell.h"
+#include "ephy-node-common.h"
+#include "ephy-debug.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <libxml/entities.h>
+
+#define EMPTY_ACTION_NAME "GoBookmarkEmpty"
+
+/**
+ * Private data
+ */
+struct _EphyBookmarksMenuPrivate
+{
+ EphyWindow *window;
+ EphyBookmarks *bookmarks;
+ EggActionGroup *action_group;
+ guint ui_id;
+};
+
+/**
+ * Private functions, only availble from this file
+ */
+static void ephy_bookmarks_menu_class_init (EphyBookmarksMenuClass *klass);
+static void ephy_bookmarks_menu_init (EphyBookmarksMenu *menu);
+static void ephy_bookmarks_menu_finalize (GObject *o);
+
+enum
+{
+ PROP_0,
+ PROP_EPHY_WINDOW
+};
+
+static gpointer parent_class;
+
+GType
+ephy_bookmarks_menu_get_type (void)
+{
+ static GType ephy_bookmarks_menu_type = 0;
+
+ if (ephy_bookmarks_menu_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyBookmarksMenuClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ephy_bookmarks_menu_class_init,
+ NULL,
+ NULL, /* class_data */
+ sizeof (EphyBookmarksMenu),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_bookmarks_menu_init
+ };
+
+ ephy_bookmarks_menu_type = g_type_register_static (G_TYPE_OBJECT,
+ "EphyBookmarksMenu",
+ &our_info, 0);
+ }
+ return ephy_bookmarks_menu_type;
+}
+
+static void
+ephy_bookmarks_menu_clean (EphyBookmarksMenu *menu)
+{
+ EphyBookmarksMenuPrivate *p = menu->priv;
+ EggMenuMerge *merge = EGG_MENU_MERGE (p->window->ui_merge);
+
+ if (p->ui_id >= 0)
+ {
+ egg_menu_merge_remove_ui (merge, p->ui_id);
+ egg_menu_merge_ensure_update (merge);
+ }
+
+ if (p->action_group != NULL)
+ {
+ egg_menu_merge_remove_action_group (merge, p->action_group);
+ g_object_unref (p->action_group);
+ }
+}
+
+static void
+go_location_cb (EggAction *action, char *location, EphyWindow *window)
+{
+ EphyEmbed *embed;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ ephy_embed_load_url (embed, location);
+}
+
+static int
+sort_topics (gconstpointer a, gconstpointer b)
+{
+ EphyNode *node_a = (EphyNode *)a;
+ EphyNode *node_b = (EphyNode *)b;
+ EphyNodePriority priority_a, priority_b;
+ char *str_a = NULL;
+ char *str_b = NULL;
+ int retval;
+
+ priority_a = ephy_node_get_property_int (node_a, EPHY_NODE_KEYWORD_PROP_PRIORITY);
+ priority_b = ephy_node_get_property_int (node_b, EPHY_NODE_KEYWORD_PROP_PRIORITY);
+
+ if (priority_a < priority_b)
+ {
+ retval = -1;
+ }
+ else if (priority_a > priority_b)
+ {
+ retval = 1;
+ }
+ else
+ {
+ str_a = g_utf8_casefold (ephy_node_get_property_string (node_a, EPHY_NODE_KEYWORD_PROP_NAME),
+ -1);
+ str_b = g_utf8_casefold (ephy_node_get_property_string (node_b, EPHY_NODE_KEYWORD_PROP_NAME),
+ -1);
+ retval = g_utf8_collate (str_a, str_b);
+ g_free (str_a);
+ g_free (str_b);
+ }
+
+ return retval;
+}
+
+static int
+sort_bookmarks (gconstpointer a, gconstpointer b)
+{
+ EphyNode *node_a = (EphyNode *)a;
+ EphyNode *node_b = (EphyNode *)b;
+ char *str_a = NULL;
+ char *str_b = NULL;
+ int retval;
+
+ str_a = g_utf8_casefold (ephy_node_get_property_string (node_a, EPHY_NODE_BMK_PROP_TITLE),
+ -1);
+ str_b = g_utf8_casefold (ephy_node_get_property_string (node_b, EPHY_NODE_BMK_PROP_TITLE),
+ -1);
+ retval = g_utf8_collate (str_a, str_b);
+ g_free (str_a);
+ g_free (str_b);
+
+ return retval;
+}
+
+static void
+add_bookmarks_menu (EphyBookmarksMenu *menu, EphyNode *node, GString *xml)
+{
+ GPtrArray *children;
+ EphyBookmarksMenuPrivate *p = menu->priv;
+
+ children = ephy_node_get_children (node);
+
+ if (children->len < 1)
+ {
+ g_string_append (xml, "<menuitem name=\"");
+ g_string_append (xml, EMPTY_ACTION_NAME"Menu");
+ g_string_append (xml, "Menu");
+ g_string_append (xml, "\" verb=\"");
+ g_string_append (xml, EMPTY_ACTION_NAME);
+ g_string_append (xml, "\"/>\n");
+ }
+ else
+ {
+ GList *node_list = NULL, *l;
+ int i;
+
+ for (i = 0; i < children->len; ++i)
+ {
+ node_list = g_list_append (node_list,
+ g_ptr_array_index (children, i));
+ }
+
+ node_list = g_list_sort (node_list, (GCompareFunc)sort_bookmarks);
+
+ for (l = node_list; l != NULL; l = l->next)
+ {
+ EggAction *action;
+ EphyNode *child;
+ long id;
+ char *verb;
+
+ child = l->data;
+ id = ephy_node_get_id (child);
+ verb = g_strdup_printf ("OpenBookmark%ld", id);
+
+ action = ephy_bookmark_action_new (verb, id);
+ egg_action_group_add_action (p->action_group, action);
+ g_object_unref (action);
+ g_signal_connect (action, "go_location",
+ G_CALLBACK (go_location_cb), p->window);
+
+ g_string_append (xml, "<menuitem name=\"");
+ g_string_append (xml, verb);
+ g_string_append (xml, "Menu");
+ g_string_append (xml, "\" verb=\"");
+ g_string_append (xml, verb);
+ g_string_append (xml, "\"/>\n");
+
+ g_free (verb);
+ }
+
+ g_list_free (node_list);
+ }
+
+ ephy_node_thaw (node);
+}
+
+static void
+ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu)
+{
+ EphyBookmarksMenuPrivate *p = menu->priv;
+ GString *xml;
+ gint i;
+ EphyNode *topics;
+ EphyNode *not_categorized;
+ GPtrArray *children;
+ EggMenuMerge *merge = EGG_MENU_MERGE (p->window->ui_merge);
+ GList *node_list = NULL, *l;
+ EggAction *empty;
+
+ LOG ("Rebuilding recent history menu")
+
+ ephy_bookmarks_menu_clean (menu);
+
+ topics = ephy_bookmarks_get_keywords (p->bookmarks);
+ not_categorized = ephy_bookmarks_get_not_categorized (p->bookmarks);
+ children = ephy_node_get_children (topics);
+
+ xml = g_string_new (NULL);
+ g_string_append (xml, "<Root><menu><submenu name=\"BookmarksMenu\">"
+ "<placeholder name=\"BookmarksTree\">"
+ "<separator name=\"BookmarksSep1\"/>");
+
+ p->action_group = egg_action_group_new ("BookmarksActions");
+ egg_menu_merge_insert_action_group (merge, p->action_group, 0);
+
+ empty = g_object_new (EGG_TYPE_ACTION,
+ "name", EMPTY_ACTION_NAME,
+ "label", _("Empty"),
+ "sensitive", FALSE,
+ NULL);
+ egg_action_group_add_action (p->action_group, empty);
+ g_object_unref (empty);
+
+ for (i = 0; i < children->len; ++i)
+ {
+ EphyNode *kid;
+ EphyNodePriority priority;
+
+ kid = g_ptr_array_index (children, i);
+
+ priority = ephy_node_get_property_int
+ (kid, EPHY_NODE_KEYWORD_PROP_PRIORITY);
+
+ if (priority == EPHY_NODE_NORMAL_PRIORITY)
+ {
+ node_list = g_list_append (node_list, kid);
+ }
+ }
+ ephy_node_thaw (topics);
+
+ node_list = g_list_sort (node_list, (GCompareFunc)sort_topics);
+
+ for (l = node_list; l != NULL; l = l->next)
+ {
+ char *verb;
+ const char *title;
+ EphyNode *child;
+ EggAction *action;
+
+ child = l->data;
+ title = ephy_node_get_property_string (child, EPHY_NODE_KEYWORD_PROP_NAME);
+
+ verb = g_strdup_printf ("OpenTopic%ld", ephy_node_get_id (child));
+ action = g_object_new (EGG_TYPE_ACTION,
+ "name", verb,
+ "label", title,
+ NULL);
+ egg_action_group_add_action (p->action_group, action);
+ g_object_unref (action);
+
+ g_string_append (xml, "<submenu name=\"");
+ g_string_append (xml, verb);
+ g_string_append (xml, "Menu");
+ g_string_append (xml, "\" verb=\"");
+ g_string_append (xml, verb);
+ g_string_append (xml, "\">\n");
+
+ add_bookmarks_menu (menu, child, xml);
+
+ g_string_append (xml, "</submenu>");
+
+ g_free (verb);
+ }
+
+ add_bookmarks_menu (menu, not_categorized, xml);
+
+ g_string_append (xml, "</placeholder></submenu></menu></Root>");
+
+ if (children->len > 0)
+ {
+ GError *error = NULL;
+ LOG ("Merging ui\n%s",xml->str);
+ p->ui_id = egg_menu_merge_add_ui_from_string
+ (merge, xml->str, -1, &error);
+ }
+
+ g_string_free (xml, TRUE);
+ g_list_free (node_list);
+}
+
+static void
+ephy_bookmarks_menu_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyBookmarksMenu *m = EPHY_BOOKMARKS_MENU (object);
+
+ switch (prop_id)
+ {
+ case PROP_EPHY_WINDOW:
+ m->priv->window = g_value_get_object (value);
+ ephy_bookmarks_menu_rebuild (m);
+ break;
+ }
+}
+
+static void
+ephy_bookmarks_menu_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyBookmarksMenu *m = EPHY_BOOKMARKS_MENU (object);
+
+ switch (prop_id)
+ {
+ case PROP_EPHY_WINDOW:
+ g_value_set_object (value, m->priv->window);
+ break;
+ }
+}
+
+
+static void
+ephy_bookmarks_menu_class_init (EphyBookmarksMenuClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = ephy_bookmarks_menu_finalize;
+ object_class->set_property = ephy_bookmarks_menu_set_property;
+ object_class->get_property = ephy_bookmarks_menu_get_property;
+
+ g_object_class_install_property (object_class,
+ PROP_EPHY_WINDOW,
+ g_param_spec_object ("EphyWindow",
+ "EphyWindow",
+ "Parent window",
+ EPHY_WINDOW_TYPE,
+ G_PARAM_READWRITE));
+}
+
+static void
+bookmarks_tree_changed_cb (EphyBookmarks *bookmarks, EphyBookmarksMenu *menu)
+{
+ ephy_bookmarks_menu_rebuild (menu);
+}
+
+static void
+ephy_bookmarks_menu_init (EphyBookmarksMenu *menu)
+{
+ EphyBookmarksMenuPrivate *p = g_new0 (EphyBookmarksMenuPrivate, 1);
+
+ menu->priv = p;
+
+ menu->priv->bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+ g_signal_connect (menu->priv->bookmarks, "tree_changed",
+ G_CALLBACK (bookmarks_tree_changed_cb),
+ menu);
+
+ menu->priv->ui_id = -1;
+ menu->priv->action_group = NULL;
+}
+
+static void
+ephy_bookmarks_menu_finalize (GObject *o)
+{
+ EphyBookmarksMenu *menu = EPHY_BOOKMARKS_MENU (o);
+ EphyBookmarksMenuPrivate *p = menu->priv;
+
+ if (p->action_group != NULL)
+ {
+ egg_menu_merge_remove_action_group
+ (EGG_MENU_MERGE (p->window->ui_merge),
+ p->action_group);
+ g_object_unref (p->action_group);
+ }
+
+ g_free (p);
+
+ G_OBJECT_CLASS (parent_class)->finalize (o);
+}
+
+EphyBookmarksMenu *
+ephy_bookmarks_menu_new (EphyWindow *window)
+{
+ EphyBookmarksMenu *ret = g_object_new (EPHY_TYPE_BOOKMARKS_MENU,
+ "EphyWindow", window,
+ NULL);
+ return ret;
+}
diff --git a/src/bookmarks/ephy-bookmarks-menu.h b/src/bookmarks/ephy-bookmarks-menu.h
new file mode 100644
index 000000000..a00185331
--- /dev/null
+++ b/src/bookmarks/ephy-bookmarks-menu.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2002 Ricardo Fernández Pascual
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_BOOKMARKS_MENU_H
+#define EPHY_BOOKMARKS_MENU_H
+
+#include "ephy-window.h"
+
+/* object forward declarations */
+
+typedef struct _EphyBookmarksMenu EphyBookmarksMenu;
+typedef struct _EphyBookmarksMenuClass EphyBookmarksMenuClass;
+typedef struct _EphyBookmarksMenuPrivate EphyBookmarksMenuPrivate;
+
+/**
+ * Editor object
+ */
+
+#define EPHY_TYPE_BOOKMARKS_MENU (ephy_bookmarks_menu_get_type())
+#define EPHY_BOOKMARKS_MENU(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EPHY_TYPE_BOOKMARKS_MENU, EphyBookmarksMenu))
+#define EPHY_BOOKMARKS_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EPHY_TYPE_BOOKMARKS_MENU, EphyBookmarksMenuClass))
+#define EPHY_IS_BOOKMARKS_MENU(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EPHY_TYPE_BOOKMARKS_MENU))
+#define EPHY_IS_BOOKMARKS_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EPHY_TYPE_BOOKMARKS_MENU))
+#define EPHY_BOOKMARKS_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_BOOKMARKS_MENU, EphyBookmarksMenuClass))
+
+struct _EphyBookmarksMenuClass
+{
+ GObjectClass parent_class;
+};
+
+struct _EphyBookmarksMenu
+{
+ GObject parent_object;
+
+ EphyBookmarksMenuPrivate *priv;
+};
+
+GType ephy_bookmarks_menu_get_type (void);
+
+EphyBookmarksMenu *ephy_bookmarks_menu_new (EphyWindow *window);
+
+#endif
+
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index ab15fcba0..86a10d457 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -89,6 +89,15 @@ enum
PROP_TOOLBARS_MODEL
};
+/* Signals */
+enum
+{
+ TREE_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint ephy_bookmarks_signals[LAST_SIGNAL] = { 0 };
+
static void
ephy_bookmarks_class_init (EphyBookmarksClass *klass);
static void
@@ -288,6 +297,16 @@ ephy_bookmarks_class_init (EphyBookmarksClass *klass)
object_class->set_property = ephy_bookmarks_set_property;
object_class->get_property = ephy_bookmarks_get_property;
+ ephy_bookmarks_signals[TREE_CHANGED] =
+ g_signal_new ("tree_changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyBookmarksClass, tree_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
g_object_class_install_property (object_class,
PROP_TOOLBARS_MODEL,
g_param_spec_object ("toolbars_model",
@@ -513,6 +532,7 @@ bookmarks_changed_cb (EphyNode *node,
EphyBookmarks *eb)
{
ephy_bookmarks_emit_data_changed (eb);
+ g_signal_emit (G_OBJECT (eb), ephy_bookmarks_signals[TREE_CHANGED], 0);
}
static void
@@ -522,6 +542,7 @@ bookmarks_removed_cb (EphyNode *node,
EphyBookmarks *eb)
{
ephy_bookmarks_emit_data_changed (eb);
+ g_signal_emit (G_OBJECT (eb), ephy_bookmarks_signals[TREE_CHANGED], 0);
}
static char *
@@ -1083,6 +1104,8 @@ ephy_bookmarks_set_keyword (EphyBookmarks *eb,
update_topics_list (bookmark, list);
g_free (list);
+
+ g_signal_emit (G_OBJECT (eb), ephy_bookmarks_signals[TREE_CHANGED], 0);
}
void
@@ -1109,6 +1132,8 @@ ephy_bookmarks_unset_keyword (EphyBookmarks *eb,
update_topics_list (bookmark, list);
g_free (list);
+
+ g_signal_emit (G_OBJECT (eb), ephy_bookmarks_signals[TREE_CHANGED], 0);
}
EphyNode *
@@ -1130,6 +1155,12 @@ ephy_bookmarks_get_favorites (EphyBookmarks *eb)
}
EphyNode *
+ephy_bookmarks_get_not_categorized (EphyBookmarks *eb)
+{
+ return eb->priv->notcategorized;
+}
+
+EphyNode *
ephy_bookmarks_get_from_id (EphyBookmarks *eb, long id)
{
return ephy_node_db_get_node_from_id (eb->priv->db, id);
diff --git a/src/bookmarks/ephy-bookmarks.h b/src/bookmarks/ephy-bookmarks.h
index 8ef47ce7d..0119315ce 100644
--- a/src/bookmarks/ephy-bookmarks.h
+++ b/src/bookmarks/ephy-bookmarks.h
@@ -57,10 +57,7 @@ struct EphyBookmarksClass
{
GObjectClass parent_class;
- void (* bookmark_remove) (EphyBookmarks *eb,
- long id);
- void (* topic_remove) (EphyBookmarks *eb,
- long id);
+ void (* tree_changed) (EphyBookmarks *eb);
};
GType ephy_bookmarks_get_type (void);
@@ -124,6 +121,8 @@ EphyNode *ephy_bookmarks_get_keywords (EphyBookmarks *eb);
EphyNode *ephy_bookmarks_get_bookmarks (EphyBookmarks *eb);
+EphyNode *ephy_bookmarks_get_not_categorized (EphyBookmarks *eb);
+
G_END_DECLS
#endif
diff --git a/src/ephy-window.c b/src/ephy-window.c
index b4f47c9d5..f73606b50 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -23,6 +23,7 @@
#endif
#include "ephy-window.h"
+#include "ephy-bookmarks-menu.h"
#include "ephy-favorites-menu.h"
#include "ephy-state.h"
#include "ephy-gobject-misc.h"
@@ -269,6 +270,7 @@ struct EphyWindowPrivate
EphyFavoritesMenu *fav_menu;
EphyEncodingMenu *enc_menu;
EphyTabsMenu *tabs_menu;
+ EphyBookmarksMenu *bmk_menu;
PPViewToolbar *ppview_toolbar;
GtkNotebook *notebook;
EphyTab *active_tab;
@@ -604,6 +606,7 @@ ephy_window_init (EphyWindow *window)
window->priv->tabs_menu = ephy_tabs_menu_new (window);
window->priv->fav_menu = ephy_favorites_menu_new (window);
window->priv->enc_menu = ephy_encoding_menu_new (window);
+ window->priv->bmk_menu = ephy_bookmarks_menu_new (window);
/* Once window is fully created, add it to the session list*/
session_add_window (session, window);
@@ -663,6 +666,7 @@ ephy_window_finalize (GObject *object)
g_object_unref (window->priv->fav_menu);
g_object_unref (window->priv->enc_menu);
g_object_unref (window->priv->tabs_menu);
+ g_object_unref (window->priv->bmk_menu);
if (window->priv->ppview_toolbar)
{