aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks
diff options
context:
space:
mode:
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/ephy-bookmark-action.c64
-rw-r--r--src/bookmarks/ephy-bookmark-action.h8
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c217
-rw-r--r--src/bookmarks/ephy-bookmarks-menu.c42
-rw-r--r--src/bookmarks/ephy-topic-action.c69
5 files changed, 210 insertions, 190 deletions
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c
index 42aa5cac4..9ddda53c0 100644
--- a/src/bookmarks/ephy-bookmark-action.c
+++ b/src/bookmarks/ephy-bookmark-action.c
@@ -22,13 +22,13 @@
#include <bonobo/bonobo-i18n.h>
#include <libgnomevfs/gnome-vfs-uri.h>
+#include <gtk/gtktoolitem.h>
#include "ephy-bookmark-action.h"
#include "ephy-bookmarks.h"
#include "ephy-favicon-cache.h"
#include "ephy-shell.h"
#include "ephy-string.h"
-#include "eggtoolitem.h"
#include "ephy-debug.h"
#define MAX_LABEL_LENGTH 30
@@ -83,7 +83,7 @@ ephy_bookmark_action_get_type (void)
(GInstanceInitFunc) ephy_bookmark_action_init,
};
- type = g_type_register_static (EGG_TYPE_ACTION,
+ type = g_type_register_static (GTK_TYPE_ACTION,
"EphyBookmarkAction",
&type_info, 0);
}
@@ -91,13 +91,13 @@ ephy_bookmark_action_get_type (void)
}
static GtkWidget *
-create_tool_item (EggAction *action)
+create_tool_item (GtkAction *action)
{
GtkWidget *item, *button, *hbox, *label, *icon, *entry;
LOG ("Creating tool item for action %p", action)
- item = (* EGG_ACTION_CLASS (parent_class)->create_tool_item) (action);
+ item = (* GTK_ACTION_CLASS (parent_class)->create_tool_item) (action);
hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox);
@@ -132,9 +132,9 @@ create_tool_item (EggAction *action)
}
static void
-ephy_bookmark_action_sync_smart_url (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
+ephy_bookmark_action_sync_smart_url (GtkAction *action, GParamSpec *pspec, GtkWidget *proxy)
{
- if (EGG_IS_TOOL_ITEM (proxy))
+ if (GTK_IS_TOOL_ITEM (proxy))
{
GtkWidget *entry;
gboolean smart_url;
@@ -154,7 +154,7 @@ ephy_bookmark_action_sync_smart_url (EggAction *action, GParamSpec *pspec, GtkWi
}
static void
-ephy_bookmark_action_sync_icon (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
+ephy_bookmark_action_sync_icon (GtkAction *action, GParamSpec *pspec, GtkWidget *proxy)
{
char *icon_location;
EphyFaviconCache *cache;
@@ -172,7 +172,7 @@ ephy_bookmark_action_sync_icon (EggAction *action, GParamSpec *pspec, GtkWidget
if (pixbuf == NULL) return;
- if (EGG_IS_TOOL_ITEM (proxy))
+ if (GTK_IS_TOOL_ITEM (proxy))
{
GtkImage *icon;
@@ -196,18 +196,24 @@ ephy_bookmark_action_sync_icon (EggAction *action, GParamSpec *pspec, GtkWidget
}
static void
-ephy_bookmark_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
+ephy_bookmark_action_sync_label (GtkAction *action, GParamSpec *pspec, GtkWidget *proxy)
{
GtkWidget *label;
char *label_text;
char *title;
+ GValue value = { 0, };
LOG ("Set bookmark action proxy label to %s", action->label)
-
- title = ephy_string_shorten (action->label, MAX_LABEL_LENGTH);
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (G_OBJECT (action), "label", &value);
+
+ title = ephy_string_shorten (g_value_get_string (&value),
+ MAX_LABEL_LENGTH);
+ g_value_unset (&value);
if (EPHY_BOOKMARK_ACTION (action)->priv->smart_url
- && EGG_IS_TOOL_ITEM (proxy))
+ && GTK_IS_TOOL_ITEM (proxy))
{
label_text = g_strdup_printf (_("%s:"), title);
}
@@ -216,7 +222,7 @@ ephy_bookmark_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget
label_text = g_strdup (title);
}
- if (EGG_IS_TOOL_ITEM (proxy))
+ if (GTK_IS_TOOL_ITEM (proxy))
{
label = g_object_get_data (G_OBJECT (proxy), "label");
g_return_if_fail (label != NULL);
@@ -238,7 +244,7 @@ ephy_bookmark_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget
}
static void
-activate_cb (GtkWidget *widget, EggAction *action)
+activate_cb (GtkWidget *widget, GtkAction *action)
{
char *location = NULL;
char *text = NULL;
@@ -292,7 +298,7 @@ activate_cb (GtkWidget *widget, EggAction *action)
}
static gboolean
-create_menu_proxy (EggToolItem *item, EggAction *action)
+create_menu_proxy (GtkToolItem *item, GtkAction *action)
{
EphyBookmarkAction *bm_action = EPHY_BOOKMARK_ACTION (action);
GtkWidget *menu_item;
@@ -300,14 +306,14 @@ create_menu_proxy (EggToolItem *item, EggAction *action)
LOG ("create_menu_proxy item %p, action %p", item, action);
- menu_item = EGG_ACTION_GET_CLASS (action)->create_menu_item (action);
+ menu_item = GTK_ACTION_GET_CLASS (action)->create_menu_item (action);
- EGG_ACTION_GET_CLASS (action)->connect_proxy (action, menu_item);
+ GTK_ACTION_GET_CLASS (action)->connect_proxy (action, menu_item);
menu_id = g_strdup_printf ("ephy-bookmark-action-%d-menu-id",
bm_action->priv->bookmark_id);
- egg_tool_item_set_proxy_menu_item (item, menu_id, menu_item);
+ gtk_tool_item_set_proxy_menu_item (item, menu_id, menu_item);
g_free (menu_id);
@@ -315,13 +321,13 @@ create_menu_proxy (EggToolItem *item, EggAction *action)
}
static void
-connect_proxy (EggAction *action, GtkWidget *proxy)
+connect_proxy (GtkAction *action, GtkWidget *proxy)
{
GtkWidget *button, *entry;
LOG ("Connecting action %p to proxy %p", action, proxy)
- (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+ (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
ephy_bookmark_action_sync_label (action, NULL, proxy);
g_signal_connect_object (action, "notify::label",
@@ -335,7 +341,7 @@ connect_proxy (EggAction *action, GtkWidget *proxy)
g_signal_connect_object (action, "notify::smarturl",
G_CALLBACK (ephy_bookmark_action_sync_smart_url), proxy, 0);
- if (EGG_IS_TOOL_ITEM (proxy))
+ if (GTK_IS_TOOL_ITEM (proxy))
{
button = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "button"));
g_signal_connect (button, "clicked", G_CALLBACK (activate_cb), action);
@@ -424,13 +430,13 @@ ephy_bookmark_action_finalize (GObject *object)
static void
ephy_bookmark_action_class_init (EphyBookmarkActionClass *class)
{
- EggActionClass *action_class;
+ GtkActionClass *action_class;
GObjectClass *object_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_peek_parent (class);
- action_class = EGG_ACTION_CLASS (class);
+ action_class = GTK_ACTION_CLASS (class);
- action_class->toolbar_item_type = EGG_TYPE_TOOL_ITEM;
+ action_class->toolbar_item_type = GTK_TYPE_TOOL_ITEM;
action_class->create_tool_item = create_tool_item;
action_class->menu_item_type = GTK_TYPE_IMAGE_MENU_ITEM;
action_class->connect_proxy = connect_proxy;
@@ -483,7 +489,7 @@ ephy_bookmark_action_class_init (EphyBookmarkActionClass *class)
}
static void
-sync_bookmark_properties (EggAction *action, EphyNode *bmk)
+sync_bookmark_properties (GtkAction *action, EphyNode *bmk)
{
const char *title, *location, *icon;
gboolean smart_url;
@@ -506,7 +512,7 @@ sync_bookmark_properties (EggAction *action, EphyNode *bmk)
}
static void
-bookmarks_child_changed_cb (EphyNode *node, EphyNode *child, EggAction *action)
+bookmarks_child_changed_cb (EphyNode *node, EphyNode *child, GtkAction *action)
{
gulong id;
@@ -537,19 +543,19 @@ ephy_bookmark_action_init (EphyBookmarkAction *action)
G_OBJECT (action));
}
-EggAction *
+GtkAction *
ephy_bookmark_action_new (const char *name, guint id)
{
EphyNode *bmk;
EphyBookmarks *bookmarks;
- EggAction *action;
+ GtkAction *action;
bookmarks = ephy_shell_get_bookmarks (ephy_shell);
bmk = ephy_bookmarks_get_from_id (bookmarks, id);
g_return_val_if_fail (bmk != NULL, NULL);
- action = EGG_ACTION (g_object_new (EPHY_TYPE_BOOKMARK_ACTION,
+ action = GTK_ACTION (g_object_new (EPHY_TYPE_BOOKMARK_ACTION,
"name", name,
"bookmark_id", id,
NULL));
diff --git a/src/bookmarks/ephy-bookmark-action.h b/src/bookmarks/ephy-bookmark-action.h
index 2aa7a7ed0..d17dfe104 100644
--- a/src/bookmarks/ephy-bookmark-action.h
+++ b/src/bookmarks/ephy-bookmark-action.h
@@ -20,7 +20,7 @@
#define EPHY_BOOKMARK_ACTION_H
#include <gtk/gtk.h>
-#include <egg-action.h>
+#include <gtk/gtkaction.h>
#define EPHY_TYPE_BOOKMARK_ACTION (ephy_bookmark_action_get_type ())
#define EPHY_BOOKMARK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_BOOKMARK_ACTION, EphyBookmarkAction))
@@ -35,20 +35,20 @@ typedef struct EphyBookmarkActionPrivate EphyBookmarkActionPrivate;
struct _EphyBookmarkAction
{
- EggAction parent;
+ GtkAction parent;
EphyBookmarkActionPrivate *priv;
};
struct _EphyBookmarkActionClass
{
- EggActionClass parent_class;
+ GtkActionClass parent_class;
void (*go_location) (EphyBookmarkAction *action, char *location);
};
GType ephy_bookmark_action_get_type (void);
-EggAction *ephy_bookmark_action_new (const char *name,
+GtkAction *ephy_bookmark_action_new (const char *name,
guint id);
#endif
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 952c848e6..aaf111f39 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -29,6 +29,10 @@
#include <gtk/gtkhpaned.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkvbox.h>
+#include <gtk/gtkactiongroup.h>
+#include <gtk/gtktoggleaction.h>
+#include <gtk/gtkuimanager.h>
+#include <gtk/gtktoggleaction.h>
#include <gdk/gdkkeysyms.h>
#include <bonobo/bonobo-i18n.h>
#include <libgnomeui/gnome-stock-icons.h>
@@ -45,10 +49,6 @@
#include "ephy-prefs.h"
#include "ephy-shell.h"
#include "ephy-file-helpers.h"
-#include "egg-action-group.h"
-#include "egg-toggle-action.h"
-#include "egg-menu-merge.h"
-#include "egg-toggle-action.h"
#include "popup-commands.h"
#include "ephy-state.h"
#include "window-commands.h"
@@ -94,33 +94,33 @@ static void ephy_bookmarks_editor_get_property (GObject *object,
GParamSpec *pspec);
static void ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor);
-static void cmd_open_bookmarks_in_tabs (EggAction *action,
+static void cmd_open_bookmarks_in_tabs (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_open_bookmarks_in_browser (EggAction *action,
+static void cmd_open_bookmarks_in_browser (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_show_in_bookmarks_bar (EggAction *action,
+static void cmd_show_in_bookmarks_bar (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_delete (EggAction *action,
+static void cmd_delete (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_bookmark_properties (EggAction *action,
+static void cmd_bookmark_properties (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_bookmarks_import (EggAction *action,
+static void cmd_bookmarks_import (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_add_topic (EggAction *action,
+static void cmd_add_topic (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_rename (EggAction *action,
+static void cmd_rename (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_close (EggAction *action,
+static void cmd_close (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_cut (EggAction *action,
+static void cmd_cut (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_copy (EggAction *action,
+static void cmd_copy (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_paste (EggAction *action,
+static void cmd_paste (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_select_all (EggAction *action,
+static void cmd_select_all (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_help_contents (EggAction *action,
+static void cmd_help_contents (GtkAction *action,
EphyBookmarksEditor *editor);
struct EphyBookmarksEditorPrivate
@@ -132,8 +132,8 @@ struct EphyBookmarksEditorPrivate
GtkWidget *search_entry;
GtkWidget *menu_dock;
GtkWidget *window;
- EggMenuMerge *ui_merge;
- EggActionGroup *action_group;
+ GtkUIManager *ui_merge;
+ GtkActionGroup *action_group;
int priority_col;
EphyToolbarsModel *tb_model;
GHashTable *props_dialogs;
@@ -147,58 +147,57 @@ enum
static GObjectClass *parent_class = NULL;
-static EggActionGroupEntry ephy_bookmark_popup_entries [] = {
+static GtkActionEntry ephy_bookmark_popup_entries [] = {
/* Toplevel */
- { "File", N_("_File"), NULL, NULL, NULL, NULL, NULL },
- { "Edit", N_("_Edit"), NULL, NULL, NULL, NULL, NULL },
- { "View", N_("_View"), NULL, NULL, NULL, NULL, NULL },
- { "Help", N_("_Help"), NULL, NULL, NULL, NULL, NULL },
- { "FakeToplevel", (""), NULL, NULL, NULL, NULL, NULL },
+ { "File", NULL, N_("_File") },
+ { "Edit", NULL, N_("_Edit") },
+ { "View", NULL, N_("_View") },
+ { "Help", NULL, N_("_Help") },
/* File Menu*/
- { "NewTopic", N_("_New Topic"), GTK_STOCK_NEW, "<control>N",
+ { "NewTopic", GTK_STOCK_NEW, N_("_New Topic"), "<control>N",
N_("Create a new topic"),
- G_CALLBACK (cmd_add_topic), NULL },
- { "OpenInWindow", N_("_Open in New Window"), GTK_STOCK_OPEN, "<control>O",
+ G_CALLBACK (cmd_add_topic) },
+ { "OpenInWindow", GTK_STOCK_OPEN, N_("_Open in New Window"), "<control>O",
N_("Open the selected bookmark in a new window"),
- G_CALLBACK (cmd_open_bookmarks_in_browser), NULL },
- { "OpenInTab", N_("Open in New _Tab"), NULL, "<shift><control>O",
+ G_CALLBACK (cmd_open_bookmarks_in_browser) },
+ { "OpenInTab", NULL, N_("Open in New _Tab"), "<shift><control>O",
N_("Open the selected bookmark in a new tab"),
- G_CALLBACK (cmd_open_bookmarks_in_tabs), NULL },
- { "Rename", N_("_Rename..."), NULL, "F2",
- N_("Rename the selected bookmark or topic"), G_CALLBACK (cmd_rename), NULL },
- { "Delete", N_("_Delete"), GTK_STOCK_DELETE, NULL,
+ G_CALLBACK (cmd_open_bookmarks_in_tabs) },
+ { "Rename", NULL, N_("_Rename..."), "F2",
+ N_("Rename the selected bookmark or topic"), G_CALLBACK (cmd_rename) },
+ { "Delete", GTK_STOCK_DELETE, N_("_Delete"), NULL,
N_("Delete the selected bookmark or topic"),
- G_CALLBACK (cmd_delete), NULL },
- { "ShowInBookmarksBar", N_("_Show in Bookmarks Bar"), NULL, NULL,
+ G_CALLBACK (cmd_delete) },
+ { "ShowInBookmarksBar", NULL, N_("_Show in Bookmarks Bar"), NULL,
N_("Show the selected bookmark or topic in the bookmarks bar"),
- G_CALLBACK (cmd_show_in_bookmarks_bar), NULL, TOGGLE_ACTION },
- { "Properties", N_("_Properties"), GTK_STOCK_PROPERTIES, "<alt>Return",
+ G_CALLBACK (cmd_show_in_bookmarks_bar), TRUE },
+ { "Properties", GTK_STOCK_PROPERTIES, N_("_Properties"), "<alt>Return",
N_("View or modify the properties of the selected bookmark"),
- G_CALLBACK (cmd_bookmark_properties), NULL },
- { "Import", N_("_Import Bookmarks..."), NULL, NULL,
+ G_CALLBACK (cmd_bookmark_properties) },
+ { "Import", NULL, N_("_Import Bookmarks..."), NULL,
N_("Import bookmarks from another browser or a bookmarks file"),
- G_CALLBACK (cmd_bookmarks_import), NULL },
- { "Close", N_("_Close"), GTK_STOCK_CLOSE, "<control>W",
+ G_CALLBACK (cmd_bookmarks_import) },
+ { "Close", GTK_STOCK_CLOSE, N_("_Close"), "<control>W",
N_("Close the bookmarks window"),
- G_CALLBACK (cmd_close), NULL },
+ G_CALLBACK (cmd_close) },
/* Edit Menu */
- { "Cut", N_("Cu_t"), GTK_STOCK_CUT, "<control>X",
+ { "Cut", GTK_STOCK_CUT, N_("Cu_t"), "<control>X",
N_("Cut the selection"),
- G_CALLBACK (cmd_cut), NULL },
- { "Copy", N_("_Copy"), GTK_STOCK_COPY, "<control>C",
+ G_CALLBACK (cmd_cut) },
+ { "Copy", GTK_STOCK_COPY, N_("_Copy"), "<control>C",
N_("Copy the selection"),
- G_CALLBACK (cmd_copy), NULL },
- { "Paste", N_("_Paste"), GTK_STOCK_PASTE, "<control>V",
+ G_CALLBACK (cmd_copy) },
+ { "Paste", GTK_STOCK_PASTE, N_("_Paste"), "<control>V",
N_("Paste the clipboard"),
- G_CALLBACK (cmd_paste), NULL },
- { "SelectAll", N_("Select _All"), NULL, "<control>A",
+ G_CALLBACK (cmd_paste) },
+ { "SelectAll", NULL, N_("Select _All"), "<control>A",
N_("Select all bookmarks or text"),
- G_CALLBACK (cmd_select_all), NULL },
+ G_CALLBACK (cmd_select_all) },
/* View Menu */
- { "ViewTitle", N_("_Title"), NULL, NULL,
+/* { "ViewTitle", N_("_Title"), NULL, NULL,
N_("Show only the title column"),
NULL, NULL, RADIO_ACTION, NULL },
{ "ViewLocation", N_("_Address"), NULL, NULL,
@@ -206,15 +205,15 @@ static EggActionGroupEntry ephy_bookmark_popup_entries [] = {
NULL, NULL, RADIO_ACTION, "ViewTitle" },
{ "ViewTitleLocation", N_("T_itle and Address"), NULL, NULL,
N_("Show both the title and address columns"),
- NULL, NULL, RADIO_ACTION, "ViewTitle" },
+ NULL, NULL, RADIO_ACTION, "ViewTitle" }, */
/* Help Menu */
- { "HelpContents", N_("_Contents"), GTK_STOCK_HELP, "F1",
+ { "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1",
N_("Display bookmarks help"),
- G_CALLBACK (cmd_help_contents), NULL },
- { "HelpAbout", N_("_About"), GNOME_STOCK_ABOUT, NULL,
+ G_CALLBACK (cmd_help_contents) },
+ { "HelpAbout", GNOME_STOCK_ABOUT, N_("_About"), NULL,
N_("Display credits for the web browser creators"),
- G_CALLBACK (window_cmd_help_about), NULL },
+ G_CALLBACK (window_cmd_help_about) },
};
static guint ephy_bookmark_popup_n_entries = G_N_ELEMENTS (ephy_bookmark_popup_entries);
@@ -249,7 +248,7 @@ add_text_renderer_monitor (EphyBookmarksEditor *editor)
}
static void
-cmd_add_topic (EggAction *action,
+cmd_add_topic (GtkAction *action,
EphyBookmarksEditor *editor)
{
EphyNode *node;
@@ -262,14 +261,14 @@ cmd_add_topic (EggAction *action,
}
static void
-cmd_close (EggAction *action,
+cmd_close (GtkAction *action,
EphyBookmarksEditor *editor)
{
gtk_widget_hide (GTK_WIDGET (editor));
}
static void
-cmd_rename (EggAction *action,
+cmd_rename (GtkAction *action,
EphyBookmarksEditor *editor)
{
if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->bm_view)))
@@ -297,7 +296,7 @@ get_target_window (EphyBookmarksEditor *editor)
}
static void
-cmd_show_in_bookmarks_bar (EggAction *action,
+cmd_show_in_bookmarks_bar (GtkAction *action,
EphyBookmarksEditor *editor)
{
EphyNode *node;
@@ -324,7 +323,7 @@ cmd_show_in_bookmarks_bar (EggAction *action,
node = selection->data;
id = ephy_node_get_id (node);
- state = EGG_TOGGLE_ACTION (action)->active;
+ state = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (state)
{
@@ -341,7 +340,7 @@ cmd_show_in_bookmarks_bar (EggAction *action,
}
static void
-cmd_open_bookmarks_in_tabs (EggAction *action,
+cmd_open_bookmarks_in_tabs (GtkAction *action,
EphyBookmarksEditor *editor)
{
EphyWindow *window;
@@ -367,7 +366,7 @@ cmd_open_bookmarks_in_tabs (EggAction *action,
}
static void
-cmd_open_bookmarks_in_browser (EggAction *action,
+cmd_open_bookmarks_in_browser (GtkAction *action,
EphyBookmarksEditor *editor)
{
EphyWindow *window;
@@ -393,7 +392,7 @@ cmd_open_bookmarks_in_browser (EggAction *action,
}
static void
-cmd_delete (EggAction *action,
+cmd_delete (GtkAction *action,
EphyBookmarksEditor *editor)
{
if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->bm_view)))
@@ -498,7 +497,7 @@ import_dialog_response_cb (GtkDialog *dialog, gint response,
}
static void
-cmd_bookmarks_import (EggAction *action,
+cmd_bookmarks_import (GtkAction *action,
EphyBookmarksEditor *editor)
{
GtkWidget *dialog;
@@ -556,7 +555,7 @@ cmd_bookmarks_import (EggAction *action,
}
static void
-cmd_bookmark_properties (EggAction *action,
+cmd_bookmark_properties (GtkAction *action,
EphyBookmarksEditor *editor)
{
GList *selection;
@@ -574,7 +573,7 @@ cmd_bookmark_properties (EggAction *action,
}
static void
-cmd_cut (EggAction *action,
+cmd_cut (GtkAction *action,
EphyBookmarksEditor *editor)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
@@ -586,7 +585,7 @@ cmd_cut (EggAction *action,
}
static void
-cmd_copy (EggAction *action,
+cmd_copy (GtkAction *action,
EphyBookmarksEditor *editor)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
@@ -615,7 +614,7 @@ cmd_copy (EggAction *action,
}
static void
-cmd_paste (EggAction *action,
+cmd_paste (GtkAction *action,
EphyBookmarksEditor *editor)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
@@ -627,7 +626,7 @@ cmd_paste (EggAction *action,
}
static void
-cmd_select_all (EggAction *action,
+cmd_select_all (GtkAction *action,
EphyBookmarksEditor *editor)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
@@ -647,7 +646,7 @@ cmd_select_all (EggAction *action,
}
static void
-cmd_help_contents (EggAction *action,
+cmd_help_contents (GtkAction *action,
EphyBookmarksEditor *editor)
{
ephy_gui_help (GTK_WINDOW (editor),
@@ -720,7 +719,7 @@ ephy_bookmarks_editor_finalize (GObject *object)
g_object_unref (G_OBJECT (editor->priv->bookmarks_filter));
g_object_unref (editor->priv->action_group);
- egg_menu_merge_remove_action_group (editor->priv->ui_merge,
+ gtk_ui_manager_remove_action_group (editor->priv->ui_merge,
editor->priv->action_group);
g_object_unref (editor->priv->ui_merge);
@@ -768,8 +767,8 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
gboolean bmk_multiple_selection;
gboolean cut, copy, paste, select_all;
gboolean can_show_in_bookmarks_bar, show_in_bookmarks_bar = FALSE;
- EggActionGroup *action_group;
- EggAction *action;
+ GtkActionGroup *action_group;
+ GtkAction *action;
GList *selected;
GtkWidget *focus_widget;
@@ -874,37 +873,37 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
(key_selection && key_focus);
action_group = editor->priv->action_group;
- action = egg_action_group_get_action (action_group, "OpenInWindow");
+ action = gtk_action_group_get_action (action_group, "OpenInWindow");
g_object_set (action, "sensitive", open_in_window, NULL);
g_object_set (action, "label", open_in_window_label, NULL);
- action = egg_action_group_get_action (action_group, "OpenInTab");
+ action = gtk_action_group_get_action (action_group, "OpenInTab");
g_object_set (action, "sensitive", open_in_tab, NULL);
g_object_set (action, "label", open_in_tab_label, NULL);
- action = egg_action_group_get_action (action_group, "Rename");
+ action = gtk_action_group_get_action (action_group, "Rename");
g_object_set (action, "sensitive", rename, NULL);
- action = egg_action_group_get_action (action_group, "Delete");
+ action = gtk_action_group_get_action (action_group, "Delete");
g_object_set (action, "sensitive", delete, NULL);
- action = egg_action_group_get_action (action_group, "Properties");
+ action = gtk_action_group_get_action (action_group, "Properties");
g_object_set (action, "sensitive", properties, NULL);
- action = egg_action_group_get_action (action_group, "Cut");
+ action = gtk_action_group_get_action (action_group, "Cut");
g_object_set (action, "sensitive", cut, NULL);
- action = egg_action_group_get_action (action_group, "Copy");
+ action = gtk_action_group_get_action (action_group, "Copy");
g_object_set (action, "sensitive", copy, NULL);
g_object_set (action, "label", copy_label, NULL);
- action = egg_action_group_get_action (action_group, "Paste");
+ action = gtk_action_group_get_action (action_group, "Paste");
g_object_set (action, "sensitive", paste, NULL);
- action = egg_action_group_get_action (action_group, "SelectAll");
+ action = gtk_action_group_get_action (action_group, "SelectAll");
g_object_set (action, "sensitive", select_all, NULL);
- action = egg_action_group_get_action (action_group, "ShowInBookmarksBar");
+ action = gtk_action_group_get_action (action_group, "ShowInBookmarksBar");
g_object_set (action, "sensitive", can_show_in_bookmarks_bar, NULL);
g_signal_handlers_block_by_func
- (G_OBJECT (EGG_TOGGLE_ACTION (action)),
+ (G_OBJECT (GTK_TOGGLE_ACTION (action)),
G_CALLBACK (cmd_show_in_bookmarks_bar),
editor);
- egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action), show_in_bookmarks_bar);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), show_in_bookmarks_bar);
g_signal_handlers_unblock_by_func
- (G_OBJECT (EGG_TOGGLE_ACTION (action)),
+ (G_OBJECT (GTK_TOGGLE_ACTION (action)),
G_CALLBACK (cmd_show_in_bookmarks_bar),
editor);
}
@@ -946,7 +945,7 @@ ephy_bookmarks_editor_show_popup_cb (GtkWidget *view,
{
GtkWidget *widget;
- widget = egg_menu_merge_get_widget (editor->priv->ui_merge,
+ widget = gtk_ui_manager_get_widget (editor->priv->ui_merge,
"/popups/EphyBookmarkEditorPopup");
gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2,
gtk_get_current_event_time ());
@@ -1037,7 +1036,7 @@ keyword_node_show_popup_cb (GtkWidget *view, EphyBookmarksEditor *editor)
{
GtkWidget *widget;
- widget = egg_menu_merge_get_widget (editor->priv->ui_merge,
+ widget = gtk_ui_manager_get_widget (editor->priv->ui_merge,
"/popups/EphyBookmarkKeywordPopup");
gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2,
gtk_get_current_event_time ());
@@ -1118,7 +1117,7 @@ build_search_box (EphyBookmarksEditor *editor)
}
static void
-add_widget (EggMenuMerge *merge, GtkWidget *widget, EphyBookmarksEditor *editor)
+add_widget (GtkUIManager *merge, GtkWidget *widget, EphyBookmarksEditor *editor)
{
gtk_box_pack_start (GTK_BOX (editor->priv->menu_dock),
widget, FALSE, FALSE, 0);
@@ -1206,11 +1205,11 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
GtkWidget *bm_view, *key_view;
GtkWidget *scrolled_window;
EphyNode *node;
- EggMenuMerge *ui_merge;
- EggActionGroup *action_group;
- EggAction *action;
+ GtkUIManager *ui_merge;
+ GtkActionGroup *action_group;
+ GtkAction *action;
GdkPixbuf *icon;
- int i, col_id;
+ int col_id;
gtk_window_set_title (GTK_WINDOW (editor), _("Bookmarks"));
@@ -1223,33 +1222,29 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
g_signal_connect (editor, "delete_event",
G_CALLBACK (delete_event_cb), NULL);
- for (i = 0; i < ephy_bookmark_popup_n_entries; i++)
- {
- ephy_bookmark_popup_entries[i].user_data = editor;
- }
-
editor->priv->menu_dock = gtk_vbox_new (FALSE, 0);
gtk_widget_show (editor->priv->menu_dock);
gtk_container_add (GTK_CONTAINER (editor), editor->priv->menu_dock);
- ui_merge = egg_menu_merge_new ();
+ ui_merge = gtk_ui_manager_new ();
g_signal_connect (ui_merge, "add_widget", G_CALLBACK (add_widget), editor);
- action_group = egg_action_group_new ("PopupActions");
- egg_action_group_add_actions (action_group, ephy_bookmark_popup_entries,
- ephy_bookmark_popup_n_entries);
- egg_menu_merge_insert_action_group (ui_merge,
+ action_group = gtk_action_group_new ("PopupActions");
+ gtk_action_group_add_actions (action_group, ephy_bookmark_popup_entries,
+ ephy_bookmark_popup_n_entries, editor);
+ gtk_ui_manager_insert_action_group (ui_merge,
action_group, 0);
- egg_menu_merge_add_ui_from_file (ui_merge,
+ gtk_ui_manager_add_ui_from_file (ui_merge,
ephy_file ("epiphany-bookmark-editor-ui.xml"),
NULL);
- gtk_window_add_accel_group (GTK_WINDOW (editor), ui_merge->accel_group);
- egg_menu_merge_ensure_update (ui_merge);
+ gtk_window_add_accel_group (GTK_WINDOW (editor),
+ gtk_ui_manager_get_accel_group (ui_merge));
+ /* FIXME gtk_ui_manager_ensure_update (ui_merge); */
editor->priv->ui_merge = ui_merge;
editor->priv->action_group = action_group;
/* Fixme: We should implement gconf prefs for monitoring this setting */
- action = egg_action_group_get_action (action_group, "ViewTitle");
- egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action), TRUE);
+ action = gtk_action_group_get_action (action_group, "ViewTitle");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
hpaned = gtk_hpaned_new ();
gtk_container_set_border_width (GTK_CONTAINER (hpaned), 0);
diff --git a/src/bookmarks/ephy-bookmarks-menu.c b/src/bookmarks/ephy-bookmarks-menu.c
index 9231d7a4c..b34056ac6 100644
--- a/src/bookmarks/ephy-bookmarks-menu.c
+++ b/src/bookmarks/ephy-bookmarks-menu.c
@@ -22,7 +22,6 @@
#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"
@@ -31,6 +30,7 @@
#include <stdlib.h>
#include <libxml/entities.h>
#include <bonobo/bonobo-i18n.h>
+#include <gtk/gtkuimanager.h>
#define EMPTY_ACTION_NAME "GoBookmarkEmpty"
@@ -41,7 +41,7 @@ struct _EphyBookmarksMenuPrivate
{
EphyWindow *window;
EphyBookmarks *bookmarks;
- EggActionGroup *action_group;
+ GtkActionGroup *action_group;
guint ui_id;
guint update_tag;
};
@@ -92,24 +92,24 @@ static void
ephy_bookmarks_menu_clean (EphyBookmarksMenu *menu)
{
EphyBookmarksMenuPrivate *p = menu->priv;
- EggMenuMerge *merge = EGG_MENU_MERGE (p->window->ui_merge);
+ GtkUIManager *merge = GTK_UI_MANAGER (p->window->ui_merge);
if (p->ui_id > 0)
{
- egg_menu_merge_remove_ui (merge, p->ui_id);
- egg_menu_merge_ensure_update (merge);
+ gtk_ui_manager_remove_ui (merge, p->ui_id);
+ /* FIXME gtk_ui_manager_ensure_update (merge); */
p->ui_id = 0;
}
if (p->action_group != NULL)
{
- egg_menu_merge_remove_action_group (merge, p->action_group);
+ gtk_ui_manager_remove_action_group (merge, p->action_group);
g_object_unref (p->action_group);
}
}
static void
-go_location_cb (EggAction *action, char *location, EphyWindow *window)
+go_location_cb (GtkAction *action, char *location, EphyWindow *window)
{
ephy_window_load_url (window, location);
}
@@ -212,7 +212,7 @@ add_bookmarks_menu (EphyBookmarksMenu *menu, EphyNode *node, GString *xml)
for (l = node_list; l != NULL; l = l->next)
{
- EggAction *action;
+ GtkAction *action;
EphyNode *child;
long id;
char *verb;
@@ -222,7 +222,7 @@ add_bookmarks_menu (EphyBookmarksMenu *menu, EphyNode *node, GString *xml)
verb = g_strdup_printf ("OpenBookmark%ld", id);
action = ephy_bookmark_action_new (verb, id);
- egg_action_group_add_action (p->action_group, action);
+ gtk_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);
@@ -252,9 +252,9 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu)
EphyNode *topics;
EphyNode *not_categorized;
GPtrArray *children;
- EggMenuMerge *merge = EGG_MENU_MERGE (p->window->ui_merge);
+ GtkUIManager *merge = GTK_UI_MANAGER (p->window->ui_merge);
GList *node_list = NULL, *l;
- EggAction *empty;
+ GtkAction *empty;
LOG ("Rebuilding bookmarks menu")
@@ -271,16 +271,16 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu)
"<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);
+ p->action_group = gtk_action_group_new ("BookmarksActions");
+ gtk_ui_manager_insert_action_group (merge, p->action_group, 0);
- empty = g_object_new (EGG_TYPE_ACTION,
+ empty = g_object_new (GTK_TYPE_ACTION,
"name", EMPTY_ACTION_NAME,
/* This is the adjective, not the verb */
"label", _("Empty"),
"sensitive", FALSE,
NULL);
- egg_action_group_add_action (p->action_group, empty);
+ gtk_action_group_add_action (p->action_group, empty);
g_object_unref (empty);
for (i = 0; i < children->len; ++i)
@@ -307,17 +307,17 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu)
char *verb;
const char *title;
EphyNode *child;
- EggAction *action;
+ GtkAction *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,
+ action = g_object_new (GTK_TYPE_ACTION,
"name", verb,
"label", title,
NULL);
- egg_action_group_add_action (p->action_group, action);
+ gtk_action_group_add_action (p->action_group, action);
g_object_unref (action);
g_string_append (xml, "<submenu name=\"");
@@ -345,7 +345,7 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu)
{
GError *error = NULL;
LOG ("Merging ui\n%s",xml->str);
- p->ui_id = egg_menu_merge_add_ui_from_string
+ p->ui_id = gtk_ui_manager_add_ui_from_string
(merge, xml->str, -1, &error);
}
@@ -459,8 +459,8 @@ ephy_bookmarks_menu_finalize (GObject *o)
if (p->action_group != NULL)
{
- egg_menu_merge_remove_action_group
- (EGG_MENU_MERGE (p->window->ui_merge),
+ gtk_ui_manager_remove_action_group
+ (GTK_UI_MANAGER (p->window->ui_merge),
p->action_group);
g_object_unref (p->action_group);
}
diff --git a/src/bookmarks/ephy-topic-action.c b/src/bookmarks/ephy-topic-action.c
index 7fa6ab705..ed69d4e1c 100644
--- a/src/bookmarks/ephy-topic-action.c
+++ b/src/bookmarks/ephy-topic-action.c
@@ -22,12 +22,13 @@
#include <config.h>
#endif
-#include "ephy-node-common.h"
+#include <gtk/gtktoolitem.h>
+
#include "ephy-topic-action.h"
+#include "ephy-node-common.h"
#include "ephy-bookmarks.h"
#include "ephy-favicon-cache.h"
#include "ephy-shell.h"
-#include "eggtoolitem.h"
#include "ephy-debug.h"
#include "ephy-gui.h"
#include "ephy-string.h"
@@ -76,7 +77,7 @@ ephy_topic_action_get_type (void)
(GInstanceInitFunc) ephy_topic_action_init,
};
- type = g_type_register_static (EGG_TYPE_ACTION,
+ type = g_type_register_static (GTK_TYPE_ACTION,
"EphyTopicAction",
&type_info, 0);
}
@@ -84,7 +85,7 @@ ephy_topic_action_get_type (void)
}
static GtkWidget *
-create_tool_item (EggAction *action)
+create_tool_item (GtkAction *action)
{
GtkWidget *item;
GtkWidget *button;
@@ -92,7 +93,7 @@ create_tool_item (EggAction *action)
GtkWidget *hbox;
GtkWidget *label;
- item = (* EGG_ACTION_CLASS (parent_class)->create_tool_item) (action);
+ item = (* GTK_ACTION_CLASS (parent_class)->create_tool_item) (action);
hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox);
@@ -128,7 +129,7 @@ menu_deactivate_cb (GtkMenuShell *ms, GtkWidget *button)
}
static void
-menu_activate_cb (GtkWidget *item, EggAction *action)
+menu_activate_cb (GtkWidget *item, GtkAction *action)
{
EphyNode *node;
const char *location;
@@ -141,13 +142,20 @@ menu_activate_cb (GtkWidget *item, EggAction *action)
}
static void
-ephy_topic_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
+ephy_topic_action_sync_label (GtkAction *action, GParamSpec *pspec, GtkWidget *proxy)
{
GtkWidget *label = NULL;
+ GValue value = { 0, };
+ const char *label_text;
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (G_OBJECT (action), "label", &value);
+
+ label_text = g_value_get_string (&value);
LOG ("Set bookmark action proxy label to %s", action->label)
- if (EGG_IS_TOOL_ITEM (proxy))
+ if (GTK_IS_TOOL_ITEM (proxy))
{
label = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "label"));
}
@@ -163,10 +171,12 @@ ephy_topic_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget *p
g_return_if_fail (label != NULL);
- if (action->label)
+ if (label_text)
{
- gtk_label_set_label (GTK_LABEL (label), action->label);
+ gtk_label_set_label (GTK_LABEL (label), label_text);
}
+
+ g_value_unset (&value);
}
static int
@@ -445,13 +455,22 @@ button_pressed_cb (GtkWidget *button,
}
static GtkWidget *
-create_menu_item (EggAction *action)
+create_menu_item (GtkAction *action)
{
GtkWidget *menu, *menu_item;
+ GValue value = { 0, };
+ const char *label_text;
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (G_OBJECT (action), "label", &value);
+
+ label_text = g_value_get_string (&value);
LOG ("create_menu_item action %p", action)
- menu_item = gtk_menu_item_new_with_label (action->label);
+ menu_item = gtk_menu_item_new_with_label (label_text);
+
+ g_value_unset (&value);
menu = build_menu (EPHY_TOPIC_ACTION (action));
gtk_widget_show (menu);
@@ -462,7 +481,7 @@ create_menu_item (EggAction *action)
}
static gboolean
-create_menu_proxy (EggToolItem *item, EggAction *action)
+create_menu_proxy (GtkToolItem *item, GtkAction *action)
{
GtkWidget *menu_item;
char *menu_id;
@@ -474,7 +493,7 @@ create_menu_proxy (EggToolItem *item, EggAction *action)
menu_id = g_strdup_printf ("ephy-topic-action-%d-menu-id",
EPHY_TOPIC_ACTION (action)->priv->topic_id);
- egg_tool_item_set_proxy_menu_item (item, menu_id, menu_item);
+ gtk_tool_item_set_proxy_menu_item (item, menu_id, menu_item);
g_free (menu_id);
@@ -482,19 +501,19 @@ create_menu_proxy (EggToolItem *item, EggAction *action)
}
static void
-connect_proxy (EggAction *action, GtkWidget *proxy)
+connect_proxy (GtkAction *action, GtkWidget *proxy)
{
GtkWidget *button;
LOG ("connect_proxy action %p, proxy %p", action, proxy)
- (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+ (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
ephy_topic_action_sync_label (action, NULL, proxy);
g_signal_connect_object (action, "notify::label",
G_CALLBACK (ephy_topic_action_sync_label), proxy, 0);
- if (EGG_IS_TOOL_ITEM (proxy))
+ if (GTK_IS_TOOL_ITEM (proxy))
{
g_signal_connect_object (proxy, "create_menu_proxy",
G_CALLBACK (create_menu_proxy),
@@ -567,13 +586,13 @@ ephy_topic_action_finalize (GObject *object)
static void
ephy_topic_action_class_init (EphyTopicActionClass *class)
{
- EggActionClass *action_class;
+ GtkActionClass *action_class;
GObjectClass *object_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_peek_parent (class);
- action_class = EGG_ACTION_CLASS (class);
+ action_class = GTK_ACTION_CLASS (class);
- action_class->toolbar_item_type = EGG_TYPE_TOOL_ITEM;
+ action_class->toolbar_item_type = GTK_TYPE_TOOL_ITEM;
action_class->create_tool_item = create_tool_item;
action_class->create_menu_item = create_menu_item;
action_class->connect_proxy = connect_proxy;
@@ -605,7 +624,7 @@ ephy_topic_action_class_init (EphyTopicActionClass *class)
}
static void
-sync_topic_properties (EggAction *action, EphyNode *bmk)
+sync_topic_properties (GtkAction *action, EphyNode *bmk)
{
const char *title;
@@ -616,7 +635,7 @@ sync_topic_properties (EggAction *action, EphyNode *bmk)
}
static void
-topic_child_changed_cb (EphyNode *node, EphyNode *child, EggAction *action)
+topic_child_changed_cb (EphyNode *node, EphyNode *child, GtkAction *action)
{
gulong id;
@@ -643,19 +662,19 @@ ephy_topic_action_init (EphyTopicAction *action)
G_OBJECT (action));
}
-EggAction *
+GtkAction *
ephy_topic_action_new (const char *name, guint id)
{
EphyNode *bmk;
EphyBookmarks *bookmarks;
- EggAction *action;
+ GtkAction *action;
bookmarks = ephy_shell_get_bookmarks (ephy_shell);
bmk = ephy_bookmarks_get_from_id (bookmarks, id);
g_return_val_if_fail (bmk != NULL, NULL);
- action = EGG_ACTION (g_object_new (EPHY_TYPE_TOPIC_ACTION,
+ action = GTK_ACTION (g_object_new (EPHY_TYPE_TOPIC_ACTION,
"topic_id", id,
"name", name,
NULL));