aboutsummaryrefslogtreecommitdiffstats
path: root/lib/widgets
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-01-30 21:53:39 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-01-30 21:53:39 +0800
commitbd2108eb559d0538b59c6907b89f7aba137431dd (patch)
tree5a35409492af0c228f90a2e524a6db804c579992 /lib/widgets
parentc1008f8781b7940bb7096bc6e5fe250ec6ebcaf2 (diff)
downloadgsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.tar
gsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.tar.gz
gsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.tar.bz2
gsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.tar.lz
gsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.tar.xz
gsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.tar.zst
gsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.zip
Allow to drag also normal urls in the toolbars. Commit some fixes I did to
2003-01-30 Marco Pesenti Gritti <marco@it.gnome.org> * data/ui/epiphany-toolbar.xml.in: * embed/mozilla/EphyWrapper.cpp: * embed/mozilla/Makefile.am: * lib/egg/egg-action.c: (disconnect_proxy): * lib/egg/egg-menu-merge.c: (update_node): * lib/ephy-dnd.c: (ephy_dnd_uri_list_extract_uris): * lib/ephy-dnd.h: * lib/ephy-string.c: (ephy_str_to_int): * lib/widgets/ephy-editable-toolbar.c: (item_node_new), (impl_get_action), (add_action), (parse_item_list), (toolbar_list_to_xml), (ephy_editable_toolbar_save), (do_merge), (free_node), (ephy_editable_toolbar_finalize): * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_get_bookmark_id): * src/bookmarks/ephy-new-bookmark.c: (ephy_new_bookmark_add), (ephy_new_bookmark_response_cb), (ephy_new_bookmark_init), (ephy_new_bookmark_set_icon), (ephy_new_bookmark_get_id): * src/bookmarks/ephy-new-bookmark.h: * src/popup-commands.c: (popup_cmd_add_link_bookmark): * src/toolbar.c: (get_bookmark_action), (toolbar_get_action): * src/window-commands.c: (window_cmd_file_add_bookmark): Allow to drag also normal urls in the toolbars. Commit some fixes I did to the eggmenu stuff, now toolbar editor should work well, please start reporting bugs :)
Diffstat (limited to 'lib/widgets')
-rwxr-xr-xlib/widgets/ephy-editable-toolbar.c51
1 files changed, 30 insertions, 21 deletions
diff --git a/lib/widgets/ephy-editable-toolbar.c b/lib/widgets/ephy-editable-toolbar.c
index b082d6c31..8ab1a1904 100755
--- a/lib/widgets/ephy-editable-toolbar.c
+++ b/lib/widgets/ephy-editable-toolbar.c
@@ -88,7 +88,6 @@ typedef struct
{
gboolean separator;
EggAction *action;
- char *type;
} ItemNode;
GType
@@ -132,14 +131,13 @@ toolbar_node_new (void)
}
static ItemNode *
-item_node_new (EggAction *action, const char *type, gboolean separator)
+item_node_new (EggAction *action, gboolean separator)
{
ItemNode *item;
item = g_new0 (ItemNode, 1);
item->action = action;
item->separator = separator;
- item->type = type ? g_strdup (type) : NULL;
return item;
}
@@ -188,8 +186,6 @@ impl_get_action (EphyEditableToolbar *etoolbar,
{
EggAction *action;
- LOG ("Getting an action");
-
if (type == NULL)
{
action = find_action (etoolbar, name);
@@ -218,9 +214,10 @@ add_action (EphyEditableToolbar *t,
if (!separator)
{
action = ephy_editable_toolbar_get_action (t, type, name);
+ g_return_if_fail (action != NULL);
}
- item = item_node_new (action, type, separator);
+ item = item_node_new (action, separator);
node = g_node_new (item);
g_node_insert_before (parent, sibling, node);
@@ -236,14 +233,11 @@ parse_item_list (EphyEditableToolbar *t,
if (xmlStrEqual (child->name, "toolitem"))
{
xmlChar *verb;
- xmlChar *type;
verb = xmlGetProp (child, "verb");
- type = xmlGetProp (child, "type");
- add_action (t, parent, NULL, type, verb);
+ add_action (t, parent, NULL, NULL, verb);
xmlFree (verb);
- xmlFree (type);
}
else if (xmlStrEqual (child->name, "separator"))
{
@@ -367,10 +361,6 @@ toolbar_list_to_xml (EphyEditableToolbar *t, GNode *tl)
{
node = xmlNewChild (tnode, NULL, "toolitem", NULL);
xmlSetProp (node, "verb", item->action->name);
- if (item->type)
- {
- xmlSetProp (node, "type", item->type);
- }
}
}
}
@@ -628,6 +618,17 @@ ensure_toolbars_min_size (EphyEditableToolbar *t)
}
static void
+ephy_editable_toolbar_save (EphyEditableToolbar *t)
+{
+ xmlDocPtr doc;
+
+ doc = toolbar_list_to_xml (t, t->priv->toolbars);
+ xmlSaveFormatFile (t->priv->filename, doc, 1);
+ xmlFreeDoc (doc);
+}
+
+
+static void
do_merge (EphyEditableToolbar *t)
{
char *str;
@@ -656,6 +657,8 @@ do_merge (EphyEditableToolbar *t)
ensure_toolbars_min_size (t);
+ ephy_editable_toolbar_save (t);
+
g_free (str);
}
@@ -740,13 +743,9 @@ ephy_editable_toolbar_init (EphyEditableToolbar *t)
}
static void
-ephy_editable_toolbar_save (EphyEditableToolbar *t)
+free_node (GNode *node)
{
- xmlDocPtr doc;
-
- doc = toolbar_list_to_xml (t, t->priv->toolbars);
- xmlSaveFormatFile (t->priv->filename, doc, 1);
- xmlFreeDoc (doc);
+ g_free (node->data);
}
static void
@@ -757,7 +756,17 @@ ephy_editable_toolbar_finalize (GObject *object)
g_return_if_fail (object != NULL);
g_return_if_fail (IS_EPHY_EDITABLE_TOOLBAR (object));
- ephy_editable_toolbar_save (t);
+ if (t->priv->editor)
+ {
+ gtk_widget_destroy (t->priv->editor);
+ }
+
+ g_node_children_foreach (t->priv->available_actions, G_IN_ORDER,
+ (GNodeForeachFunc)free_node, NULL);
+ g_node_children_foreach (t->priv->toolbars, G_IN_ORDER,
+ (GNodeForeachFunc)free_node, NULL);
+ g_node_destroy (t->priv->available_actions);
+ g_node_destroy (t->priv->toolbars);
g_free (t->priv->filename);