aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/ephy-location-action.c2
-rw-r--r--src/ephy-shell.c15
-rw-r--r--src/ephy-shell.h3
-rw-r--r--src/ephy-window.c17
-rwxr-xr-xsrc/toolbar.c127
-rw-r--r--src/window-commands.c4
7 files changed, 51 insertions, 119 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 7e1ed32d5..e8eb8a840 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -68,6 +68,8 @@ epiphany_bin_SOURCES = \
ephy-spinner-action.h \
ephy-tab.c \
ephy-tab.h \
+ ephy-toolbars-model.c \
+ ephy-toolbars-model.h \
ephy-window.c \
ephy-window.h \
general-prefs.c \
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index 5e6a6f610..a87796d3d 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -73,7 +73,7 @@ create_tool_item (EggAction *action)
item = GTK_WIDGET (egg_tool_item_new ());//(* EGG_ACTION_CLASS (parent_class)->create_tool_item) (action);
location = ephy_location_entry_new ();
gtk_container_add (GTK_CONTAINER (item), location);
- egg_tool_item_set_expandable (EGG_TOOL_ITEM (item), TRUE);
+ egg_tool_item_set_expand (EGG_TOOL_ITEM (item), TRUE);
gtk_widget_show (location);
LOG ("Create location toolitem: Done.")
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 731bec1ea..9d71bfcef 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -58,6 +58,7 @@ struct EphyShellPrivate
Session *session;
EphyAutocompletion *autocompletion;
EphyBookmarks *bookmarks;
+ EphyToolbarsModel *toolbars_model;
GtkWidget *bme;
GtkWidget *history_window;
};
@@ -263,6 +264,7 @@ ephy_shell_init (EphyShell *gs)
gs->priv->bookmarks = NULL;
gs->priv->bme = NULL;
gs->priv->history_window = NULL;
+ gs->priv->toolbars_model = NULL;
ephy_shell = gs;
g_object_add_weak_pointer (G_OBJECT(ephy_shell),
@@ -640,6 +642,19 @@ ephy_shell_get_bookmarks (EphyShell *gs)
return gs->priv->bookmarks;
}
+EphyToolbarsModel *
+ephy_shell_get_toolbars_model (EphyShell *gs)
+{
+ if (gs->priv->toolbars_model == NULL)
+ {
+ gs->priv->toolbars_model = ephy_toolbars_model_new ();
+ egg_toolbars_model_load (EGG_TOOLBARS_MODEL (gs->priv->toolbars_model),
+ ephy_file ("epiphany-toolbar.xml"));
+ }
+
+ return gs->priv->toolbars_model;
+}
+
static void
bookmarks_hide_cb (GtkWidget *widget, gpointer data)
{
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index ab4f3aa0e..6df099efb 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -25,6 +25,7 @@
#include "ephy-embed-shell.h"
#include "session.h"
#include "ephy-bookmarks.h"
+#include "ephy-toolbars-model.h"
#include <glib-object.h>
#include <glib.h>
@@ -94,6 +95,8 @@ EphyAutocompletion *ephy_shell_get_autocompletion (EphyShell *gs);
EphyBookmarks *ephy_shell_get_bookmarks (EphyShell *gs);
+EphyToolbarsModel *ephy_shell_get_toolbars_model (EphyShell *gs);
+
void ephy_shell_show_bookmarks_editor (EphyShell *gs);
void ephy_shell_show_history_window (EphyShell *gs);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 84d930d88..357c4e84d 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -517,6 +517,10 @@ setup_window (EphyWindow *window)
g_signal_connect (menu, "activate", G_CALLBACK (menu_activate_cb), window);
window->priv->toolbar = toolbar_new (window);
+ gtk_widget_show (GTK_WIDGET (window->priv->toolbar));
+ gtk_box_pack_start (GTK_BOX (window->priv->menu_dock),
+ GTK_WIDGET (window->priv->toolbar),
+ FALSE, FALSE, 0);
g_signal_connect(window,
"key-press-event",
@@ -650,11 +654,6 @@ ephy_window_finalize (GObject *object)
g_object_unref (window->priv->fav_menu);
g_object_unref (window->priv->enc_menu);
- if (window->priv->toolbar)
- {
- g_object_unref (window->priv->toolbar);
- }
-
if (window->priv->ppview_toolbar)
{
g_object_unref (window->priv->ppview_toolbar);
@@ -831,13 +830,13 @@ ephy_window_set_chrome (EphyWindow *window,
if (flags & EMBED_CHROME_TOOLBARON)
{
- egg_editable_toolbar_show
- (EGG_EDITABLE_TOOLBAR (window->priv->toolbar));
+/* egg_editable_toolbar_show
+ (EGG_EDITABLE_TOOLBAR (window->priv->toolbar));*/
}
else
{
- egg_editable_toolbar_hide
- (EGG_EDITABLE_TOOLBAR (window->priv->toolbar));
+/* egg_editable_toolbar_hide
+ (EGG_EDITABLE_TOOLBAR (window->priv->toolbar));*/
}
if (flags & EMBED_CHROME_STATUSBARON)
diff --git a/src/toolbar.c b/src/toolbar.c
index 18fc59f61..40ba6c0cd 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -62,8 +62,6 @@ enum
PROP_EPHY_WINDOW
};
-static EggToolbarsGroup *toolbars_group = NULL;
-
static GObjectClass *parent_class = NULL;
struct ToolbarPrivate
@@ -117,7 +115,7 @@ go_location_cb (EggAction *action, char *location, EphyWindow *window)
ephy_embed_load_url (embed, location);
}
-
+/*
static EggAction *
get_bookmark_action (Toolbar *t, EphyBookmarks *bookmarks, gulong id, const char *action_name)
{
@@ -135,75 +133,6 @@ get_bookmark_action (Toolbar *t, EphyBookmarks *bookmarks, gulong id, const char
return action;
}
-static char *
-toolbar_get_action_name (EggEditableToolbar *etoolbar,
- const char *drag_type,
- const char *data)
-{
- Toolbar *t = TOOLBAR (etoolbar);
- EphyBookmarks *bookmarks;
- gulong id = 0;
- char *res = NULL;
-
- bookmarks = ephy_shell_get_bookmarks (ephy_shell);
-
- if (drag_type && (strcmp (drag_type, EPHY_DND_TOPIC_TYPE) == 0))
- {
- GList *nodes;
- int id;
-
- nodes = ephy_dnd_node_list_extract_nodes (data);
- id = ephy_node_get_id (EPHY_NODE (nodes->data));
- res = g_strdup_printf ("GoTopicId%d", id);
- g_list_free (nodes);
- }
- 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 ((char *)data);
- g_return_val_if_fail (uris != NULL, NULL);
- url = (const char *)uris->data;
- if (uris->next)
- {
- title = (const char *)uris->next->data;
- }
-
- LOG ("Action for bookmark -%s-. EphyBookmarks %p", url, bookmarks)
- id = ephy_bookmarks_get_bookmark_id (bookmarks, url);
-
- if (id == 0)
- {
- new_bookmark = ephy_new_bookmark_new
- (bookmarks, GTK_WINDOW (t->priv->window), url);
- ephy_new_bookmark_set_title (EPHY_NEW_BOOKMARK (new_bookmark),
- title);
- gtk_dialog_run (GTK_DIALOG (new_bookmark));
- id = ephy_new_bookmark_get_id (EPHY_NEW_BOOKMARK (new_bookmark));
- gtk_widget_destroy (new_bookmark);
- }
-
- 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;
- }
- }
-
- LOG ("Action name is %s", res)
-
- return res;
-}
-
static EggAction *
toolbar_get_action (EggEditableToolbar *etoolbar,
const char *name)
@@ -215,8 +144,6 @@ toolbar_get_action (EggEditableToolbar *etoolbar,
bookmarks = ephy_shell_get_bookmarks (ephy_shell);
- action = EGG_EDITABLE_TOOLBAR_CLASS
- (parent_class)->get_action (etoolbar, name);
if (action)
{
return action;
@@ -249,7 +176,7 @@ toolbar_get_action (EggEditableToolbar *etoolbar,
return action;
}
-
+*/
static void
toolbar_class_init (ToolbarClass *klass)
{
@@ -263,9 +190,6 @@ toolbar_class_init (ToolbarClass *klass)
object_class->set_property = toolbar_set_property;
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,
g_param_spec_object ("EphyWindow",
@@ -397,7 +321,8 @@ toolbar_set_window (Toolbar *t, EphyWindow *window)
toolbar_setup_actions (t);
egg_menu_merge_insert_action_group (t->priv->ui_merge,
t->priv->action_group, 1);
- g_object_set (t, "MenuMerge", t->priv->ui_merge, NULL);
+
+ g_object_set (G_OBJECT (t), "MenuMerge", t->priv->ui_merge, NULL);
}
static void
@@ -405,7 +330,7 @@ topic_remove_cb (EphyBookmarks *eb,
long id,
Toolbar *t)
{
- EggAction *action;
+/* EggAction *action;
char *name;
name = g_strdup_printf ("GoTopicId%ld", id);
@@ -416,7 +341,7 @@ topic_remove_cb (EphyBookmarks *eb,
egg_action_group_remove_action (t->priv->action_group, action);
}
- g_free (name);
+ g_free (name);*/
}
static void
@@ -424,7 +349,7 @@ bookmark_remove_cb (EphyBookmarks *eb,
long id,
Toolbar *t)
{
- EggAction *action;
+/* EggAction *action;
char *name;
name = g_strdup_printf ("GoBookmarkId%ld", id);
@@ -435,42 +360,25 @@ bookmark_remove_cb (EphyBookmarks *eb,
egg_action_group_remove_action (t->priv->action_group, action);
}
- g_free (name);
+ g_free (name);*/
}
static void
toolbar_init (Toolbar *t)
{
+ EphyBookmarks *bookmarks;
+
t->priv = g_new0 (ToolbarPrivate, 1);
t->priv->window = NULL;
t->priv->ui_merge = NULL;
t->priv->visibility = TRUE;
- egg_editable_toolbar_add_drag_type (EGG_EDITABLE_TOOLBAR (t),
- EPHY_DND_TOPIC_TYPE);
- egg_editable_toolbar_add_drag_type (EGG_EDITABLE_TOOLBAR (t),
- EPHY_DND_URL_TYPE);
-
- if (toolbars_group == NULL)
- {
- char *user;
- EphyBookmarks *bookmarks;
-
- user = g_build_filename (ephy_dot_dir (), "toolbar.xml", NULL);
- toolbars_group = egg_toolbars_group_new ();
- egg_toolbars_group_set_source
- (toolbars_group, ephy_file ("epiphany-toolbar.xml"), user);
- g_free (user);
-
- bookmarks = ephy_shell_get_bookmarks (ephy_shell);
- g_signal_connect (bookmarks, "bookmark_remove",
- G_CALLBACK (bookmark_remove_cb), t);
- g_signal_connect (bookmarks, "topic_remove",
- G_CALLBACK (topic_remove_cb), t);
- }
-
- g_object_set (t, "ToolbarsGroup", toolbars_group, NULL);
+ bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+ g_signal_connect (bookmarks, "bookmark_remove",
+ G_CALLBACK (bookmark_remove_cb), t);
+ g_signal_connect (bookmarks, "topic_remove",
+ G_CALLBACK (topic_remove_cb), t);
}
static void
@@ -503,8 +411,13 @@ Toolbar *
toolbar_new (EphyWindow *window)
{
Toolbar *t;
+ EphyToolbarsModel *model;
+
+ model = ephy_shell_get_toolbars_model (ephy_shell);
+ g_return_val_if_fail (model != NULL, NULL);
t = TOOLBAR (g_object_new (TOOLBAR_TYPE,
+ "ToolbarsModel", model,
"EphyWindow", window,
NULL));
diff --git a/src/window-commands.c b/src/window-commands.c
index 246d79337..28c2f725b 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -645,9 +645,9 @@ window_cmd_edit_toolbar (EggAction *action,
Toolbar *toolbar;
toolbar = ephy_window_get_toolbar (window);
-
+/*
egg_editable_toolbar_edit (EGG_EDITABLE_TOOLBAR (toolbar),
- GTK_WIDGET (window));
+ GTK_WIDGET (window));*/
}
void