diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-03-08 23:49:35 +0000 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-03-08 23:49:35 +0000 |
commit | cf20c417c843be351ba5ec8f6c41f0a4d4323c8c (patch) | |
tree | 1fecd23432d9e35601aeeaf23ab301dbf5e10ffa | |
parent | 538c7348021ab80f82f20bfd56468994a228dfb6 (diff) | |
download | epiphany-cf20c417c843be351ba5ec8f6c41f0a4d4323c8c.tar.gz |
Check if the dragged item is a separator. Fixes a crash if it _is_ one.
2004-03-09 Christian Persch <chpe@cvs.gnome.org>
* lib/egg/egg-toolbar-editor.c: (editor_drag_data_received_cb):
Check if the dragged item is a separator. Fixes a crash if it _is_ one.
* src/ephy-location-action.c: (create_menu_proxy_cb),
(connect_proxy), (ephy_location_action_activate):
Don't make the location entry have a proxy menu item. Fixes a crash when
trying to activate the proxy menu item.
-rw-r--r-- | ChangeLog | 12 | ||||
-rwxr-xr-x | lib/egg/egg-toolbar-editor.c | 9 | ||||
-rw-r--r-- | src/ephy-location-action.c | 21 |
3 files changed, 40 insertions, 2 deletions
@@ -1,3 +1,15 @@ +2004-03-09 Christian Persch <chpe@cvs.gnome.org> + + * lib/egg/egg-toolbar-editor.c: (editor_drag_data_received_cb): + + Check if the dragged item is a separator. Fixes a crash if it _is_ one. + + * src/ephy-location-action.c: (create_menu_proxy_cb), + (connect_proxy), (ephy_location_action_activate): + + Don't make the location entry have a proxy menu item. Fixes a crash when + trying to activate the proxy menu item. + 2004-03-08 Christian Persch <chpe@cvs.gnome.org> * lib/egg/egg-toolbars-model.c: diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c index e77c801f0..991f4843b 100755 --- a/lib/egg/egg-toolbar-editor.c +++ b/lib/egg/egg-toolbar-editor.c @@ -306,11 +306,18 @@ editor_drag_data_received_cb (GtkWidget *widget, EggToolbarEditor *editor) { GtkAction *action; + const char *data; g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (editor)); g_return_if_fail (selection_data != NULL); - action = find_action (editor, (const char *)selection_data->data); + if (selection_data->length <= 0 || selection_data->data == NULL) return; + + data = (const char *) selection_data->data; + + if (strcmp (data, "separator") == 0) return; + + action = find_action (editor, data); g_return_if_fail (action != NULL); if (g_list_find (editor->priv->default_actions_list, action)) diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c index 493a6846a..92d5af64a 100644 --- a/src/ephy-location-action.c +++ b/src/ephy-location-action.c @@ -227,6 +227,16 @@ add_completion_actions (GtkAction *action, GtkWidget *proxy) G_CALLBACK (action_activated_cb), la); } +static gboolean +create_menu_proxy_cb (GtkToolItem *tool_item, + GtkAction *action) +{ + gtk_tool_item_set_proxy_menu_item + (tool_item, "ephy-location-action-menu-item", NULL); + + return TRUE; +} + static void connect_proxy (GtkAction *action, GtkWidget *proxy) { @@ -262,6 +272,15 @@ connect_proxy (GtkAction *action, GtkWidget *proxy) G_CALLBACK (user_changed_cb), action, 0); } + /* we need to connect to this before chaining up, since gtkaction's + * connect_proxy connects a routine there which uses create_menu_item + * method to generate a menu proxy (and create_menu_item CANNOT return + * NULL. See bug #133446.) + */ + g_signal_connect_object (proxy, "create_menu_proxy", + G_CALLBACK (create_menu_proxy_cb), + action, 0); + (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy); } @@ -331,7 +350,7 @@ ephy_location_action_activate (GtkAction *action) /* Note: this makes sense only for a single proxy */ proxies = gtk_action_get_proxies (action); - if (proxies) + if (proxies && EPHY_IS_LOCATION_ENTRY (proxies->data)) { ephy_location_entry_activate (EPHY_LOCATION_ENTRY (proxies->data)); } |