aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-02-05 00:36:15 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-02-05 00:36:15 +0800
commit3618cd422cdc8ea4228daf2a7f6b854a2bce4edb (patch)
tree306602e82ef16e1751fc860d5ff07bb418298b29
parentc394fa6c682a336366e7645af1295b5ffad86835 (diff)
downloadgsoc2013-epiphany-3618cd422cdc8ea4228daf2a7f6b854a2bce4edb.tar
gsoc2013-epiphany-3618cd422cdc8ea4228daf2a7f6b854a2bce4edb.tar.gz
gsoc2013-epiphany-3618cd422cdc8ea4228daf2a7f6b854a2bce4edb.tar.bz2
gsoc2013-epiphany-3618cd422cdc8ea4228daf2a7f6b854a2bce4edb.tar.lz
gsoc2013-epiphany-3618cd422cdc8ea4228daf2a7f6b854a2bce4edb.tar.xz
gsoc2013-epiphany-3618cd422cdc8ea4228daf2a7f6b854a2bce4edb.tar.zst
gsoc2013-epiphany-3618cd422cdc8ea4228daf2a7f6b854a2bce4edb.zip
Fix several menu accels I borked when porting to egg. Connect drag source
2003-02-04 Marco Pesenti Gritti <marco@it.gnome.org> * lib/widgets/ephy-editable-toolbar.c: (item_node_new), (connect_drag_sources), (disconnect_drag_sources), (setup_toolbars), (do_merge), (ephy_editable_toolbar_init), (editor_close_cb), (ephy_editable_toolbar_edit): * src/ephy-favicon-action.c: (connect_proxy): * src/ephy-window.c: Fix several menu accels I borked when porting to egg. Connect drag source on toolbar buttons only when necessary, fix favicon drag.
-rw-r--r--ChangeLog13
-rwxr-xr-xlib/widgets/ephy-editable-toolbar.c84
-rw-r--r--src/ephy-favicon-action.c2
-rw-r--r--src/ephy-window.c16
4 files changed, 99 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index d852fc502..2b130d182 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2003-02-04 Marco Pesenti Gritti <marco@it.gnome.org>
+ * lib/widgets/ephy-editable-toolbar.c: (item_node_new),
+ (connect_drag_sources), (disconnect_drag_sources),
+ (setup_toolbars), (do_merge), (ephy_editable_toolbar_init),
+ (editor_close_cb), (ephy_editable_toolbar_edit):
+ * src/ephy-favicon-action.c: (connect_proxy):
+ * src/ephy-window.c:
+
+ Fix several menu accels I borked when porting to egg.
+ Connect drag source on toolbar buttons only when necessary,
+ fix favicon drag.
+
+2003-02-04 Marco Pesenti Gritti <marco@it.gnome.org>
+
* data/starthere/index.xml.in:
Change xml to have translations merged properly.
diff --git a/lib/widgets/ephy-editable-toolbar.c b/lib/widgets/ephy-editable-toolbar.c
index a5345bd9d..59f527476 100755
--- a/lib/widgets/ephy-editable-toolbar.c
+++ b/lib/widgets/ephy-editable-toolbar.c
@@ -82,6 +82,7 @@ struct EphyEditableToolbarPrivate
gboolean toolbars_dirty;
gboolean editor_pos_dirty;
gboolean editor_sheet_dirty;
+ gboolean edit_mode;
};
typedef struct
@@ -93,6 +94,7 @@ typedef struct
{
gboolean separator;
EggAction *action;
+ GtkWidget *widget;
} ItemNode;
GType
@@ -143,6 +145,7 @@ item_node_new (EggAction *action, gboolean separator)
item = g_new0 (ItemNode, 1);
item->action = action;
item->separator = separator;
+ item->widget = NULL;
return item;
}
@@ -544,6 +547,68 @@ drag_data_get_cb (GtkWidget *widget,
}
static void
+connect_drag_sources (EphyEditableToolbar *etoolbar, GNode *toolbars)
+{
+ GNode *l1, *l2;
+
+ for (l1 = toolbars->children; l1 != NULL; l1 = l1->next)
+ {
+ for (l2 = l1->children; l2 != NULL; l2 = l2->next)
+ {
+ ItemNode *node = (ItemNode *) (l2->data);
+ GtkWidget *toolitem;
+
+ toolitem = node->widget;
+
+ if (!g_object_get_data (G_OBJECT (toolitem), "drag_source_set"))
+ {
+ g_object_set_data (G_OBJECT (toolitem), "drag_source_set",
+ GINT_TO_POINTER (TRUE));
+
+ g_signal_connect (toolitem, "drag_data_get",
+ G_CALLBACK (drag_data_get_cb),
+ etoolbar);
+ g_signal_connect (toolitem, "drag_data_delete",
+ G_CALLBACK (drag_data_delete_cb),
+ etoolbar);
+ }
+ }
+ }
+}
+
+static void
+disconnect_drag_sources (EphyEditableToolbar *etoolbar, GNode *toolbars)
+{
+ GNode *l1, *l2;
+
+ for (l1 = toolbars->children; l1 != NULL; l1 = l1->next)
+ {
+ for (l2 = l1->children; l2 != NULL; l2 = l2->next)
+ {
+ ItemNode *node = (ItemNode *) (l2->data);
+ GtkWidget *toolitem;
+
+ toolitem = node->widget;
+
+ if (g_object_get_data (G_OBJECT (toolitem), "drag_source_set"))
+ {
+ g_object_set_data (G_OBJECT (toolitem), "drag_source_set",
+ GINT_TO_POINTER (FALSE));
+
+ g_signal_handlers_disconnect_by_func
+ (toolitem,
+ G_CALLBACK (drag_data_get_cb),
+ etoolbar);
+ g_signal_handlers_disconnect_by_func
+ (toolitem,
+ G_CALLBACK (drag_data_delete_cb),
+ etoolbar);
+ }
+ }
+ }
+}
+
+static void
setup_toolbars (EphyEditableToolbar *etoolbar, GNode *toolbars)
{
GNode *l1, *l2;
@@ -592,6 +657,7 @@ setup_toolbars (EphyEditableToolbar *etoolbar, GNode *toolbars)
sprintf (path, "/Toolbar%d/PlaceHolder%d/%s", k, i, type);
toolitem = egg_menu_merge_get_widget (etoolbar->priv->merge, path);
+ node->widget = toolitem;
g_object_set_data (G_OBJECT (toolitem), "item_node", l2);
@@ -607,13 +673,6 @@ setup_toolbars (EphyEditableToolbar *etoolbar, GNode *toolbars)
g_signal_connect (toolitem, "drag_data_received",
G_CALLBACK (drag_data_received_cb),
etoolbar);
-
- g_signal_connect (toolitem, "drag_data_get",
- G_CALLBACK (drag_data_get_cb),
- etoolbar);
- g_signal_connect (toolitem, "drag_data_delete",
- G_CALLBACK (drag_data_delete_cb),
- etoolbar);
}
i++;
@@ -687,6 +746,11 @@ do_merge (EphyEditableToolbar *t)
setup_toolbars (t, t->priv->toolbars);
+ if (t->priv->edit_mode)
+ {
+ connect_drag_sources (t, t->priv->toolbars);
+ }
+
ensure_toolbars_min_size (t);
ephy_editable_toolbar_save (t);
@@ -774,6 +838,7 @@ ephy_editable_toolbar_init (EphyEditableToolbar *t)
t->priv->toolbars_dirty = FALSE;
t->priv->editor_pos_dirty = FALSE;
t->priv->editor_sheet_dirty = FALSE;
+ t->priv->edit_mode = FALSE;
}
static void
@@ -915,6 +980,8 @@ hide_editor (EphyEditableToolbar *etoolbar)
static void
editor_close_cb (GtkWidget *button, EphyEditableToolbar *etoolbar)
{
+ etoolbar->priv->edit_mode = FALSE;
+ disconnect_drag_sources (etoolbar, etoolbar->priv->toolbars);
hide_editor (etoolbar);
}
@@ -1189,6 +1256,9 @@ set_all_actions_sensitive (EphyEditableToolbar *etoolbar)
void
ephy_editable_toolbar_edit (EphyEditableToolbar *etoolbar)
{
+ etoolbar->priv->edit_mode = TRUE;
+
+ connect_drag_sources (etoolbar, etoolbar->priv->toolbars);
set_all_actions_sensitive (etoolbar);
setup_editor (etoolbar);
show_editor (etoolbar);
diff --git a/src/ephy-favicon-action.c b/src/ephy-favicon-action.c
index 88103ac09..fd19516ea 100644
--- a/src/ephy-favicon-action.c
+++ b/src/ephy-favicon-action.c
@@ -157,7 +157,7 @@ static void
connect_proxy (EggAction *action, GtkWidget *proxy)
{
ephy_dnd_url_drag_source_set (proxy);
-
+ ephy_favicon_action_sync_icon (action, NULL, proxy);
g_signal_connect (proxy,
"drag_data_get",
G_CALLBACK (favicon_drag_data_get_cb),
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 97d3900ef..e902775dc 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -154,16 +154,16 @@ static EggActionGroupEntry ephy_menu_entries [] = {
G_CALLBACK (window_cmd_view_page_source), NULL },
/* Go menu */
- { "GoBack", N_("_Back"), GTK_STOCK_GO_BACK, "<alt>left",
+ { "GoBack", N_("_Back"), GTK_STOCK_GO_BACK, "<alt>leftarrow",
N_("Go to the previous visited page"),
G_CALLBACK (window_cmd_go_back), NULL },
- { "GoForward", N_("_Forward"), GTK_STOCK_GO_FORWARD, "<alt>right",
+ { "GoForward", N_("_Forward"), GTK_STOCK_GO_FORWARD, "<alt>rightarrow",
N_("Go to the next visited page"),
G_CALLBACK (window_cmd_go_forward), NULL },
- { "GoUp", N_("_Up"), GTK_STOCK_GO_UP, "<alt>up",
+ { "GoUp", N_("_Up"), GTK_STOCK_GO_UP, "<alt>uparrow",
N_("Go up one level"),
G_CALLBACK (window_cmd_go_up), NULL },
- { "GoHome", N_("_Home"), GTK_STOCK_HOME, "<alt>home",
+ { "GoHome", N_("_Home"), GTK_STOCK_HOME, "<alt>Home",
N_("Go to the home page"),
G_CALLBACK (window_cmd_go_home), NULL },
{ "GoLocation", N_("_Location..."), NULL, "<control>L",
@@ -177,16 +177,16 @@ static EggActionGroupEntry ephy_menu_entries [] = {
G_CALLBACK (window_cmd_go_bookmarks), NULL },
/* Tabs menu */
- { "TabsPrevious", N_("_Previous Tab"), NULL, "<control>page_up",
+ { "TabsPrevious", N_("_Previous Tab"), NULL, "<control>Page_Up",
N_("Activate previous tab"),
G_CALLBACK (window_cmd_tabs_previous), NULL },
- { "TabsNext", N_("_Next Tab"), NULL, "<control>page_down",
+ { "TabsNext", N_("_Next Tab"), NULL, "<control>Page_Down",
N_("Activate next tab"),
G_CALLBACK (window_cmd_tabs_next), NULL },
- { "TabsMoveLeft", N_("Move Tab _Left"), NULL, "<shift><control>page_up",
+ { "TabsMoveLeft", N_("Move Tab _Left"), NULL, "<shift><control>Page_Up",
N_("Move current tab to left"),
G_CALLBACK (window_cmd_tabs_move_left), NULL },
- { "TabsMoveRight", N_("Move Tab _Right"), NULL, "<shift><control>page_up",
+ { "TabsMoveRight", N_("Move Tab _Right"), NULL, "<shift><control>Page_Down",
N_("Move current tab to right"),
G_CALLBACK (window_cmd_tabs_move_right), NULL },
{ "TabsDetach", N_("_Detach Tab"), NULL, "<shift><control>M",