aboutsummaryrefslogtreecommitdiffstats
path: root/src/popup-commands.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-08-04 04:29:26 +0800
committerChristian Persch <chpe@src.gnome.org>2005-08-04 04:29:26 +0800
commit98c2f091a837f36c61ec7889072f7034687a69bf (patch)
tree9f4b9cbaf8beb0951a582765ec4971d3d90c6acf /src/popup-commands.c
parent5725b54c776891dfcb522a96a79a145191f470da (diff)
downloadgsoc2013-epiphany-98c2f091a837f36c61ec7889072f7034687a69bf.tar
gsoc2013-epiphany-98c2f091a837f36c61ec7889072f7034687a69bf.tar.gz
gsoc2013-epiphany-98c2f091a837f36c61ec7889072f7034687a69bf.tar.bz2
gsoc2013-epiphany-98c2f091a837f36c61ec7889072f7034687a69bf.tar.lz
gsoc2013-epiphany-98c2f091a837f36c61ec7889072f7034687a69bf.tar.xz
gsoc2013-epiphany-98c2f091a837f36c61ec7889072f7034687a69bf.tar.zst
gsoc2013-epiphany-98c2f091a837f36c61ec7889072f7034687a69bf.zip
Add public function ephy_window_get_context_event() to get the
2005-08-03 Christian Persch <chpe@cvs.gnome.org> * src/ephy-window.c: (popup_menu_at_coords), (idle_unref_context_event), (set_context_event), (embed_popup_deactivate_cb), (get_name_from_address_value), (show_embed_popup), (ephy_window_dispose), (ephy_window_get_is_print_preview), (ephy_window_get_context_event): * src/ephy-window.h: * src/epiphany.defs: * src/popup-commands.c: (popup_cmd_link_in_new_window), (popup_cmd_link_in_new_tab), (popup_cmd_bookmark_link), (popup_cmd_copy_link_address), (save_property_url), (popup_cmd_open_link), (popup_cmd_set_image_as_background), (popup_cmd_copy_image_location), (popup_cmd_open_image): Add public function ephy_window_get_context_event() to get the EphyEmbedEvent for the current popup menu, instead of using an undocument g_object_get_data() call. Also fixes bug #310910. Don't printf NULL; fixes bug #309796.
Diffstat (limited to 'src/popup-commands.c')
-rw-r--r--src/popup-commands.c81
1 files changed, 39 insertions, 42 deletions
diff --git a/src/popup-commands.c b/src/popup-commands.c
index 38b38351a..a637241cd 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -38,31 +38,20 @@
#include <libgnomevfs/gnome-vfs-ops.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-static EphyEmbedEvent *
-get_event_info (EphyWindow *window)
-{
- EphyEmbedEvent *info;
-
- info = EPHY_EMBED_EVENT (g_object_get_data
- (G_OBJECT (window), "context_event"));
- g_return_val_if_fail (info != NULL, NULL);
-
- return info;
-}
-
void
popup_cmd_link_in_new_window (GtkAction *action,
EphyWindow *window)
{
- EphyEmbedEvent *info;
+ EphyEmbedEvent *event;
EphyTab *tab;
const GValue *value;
tab = ephy_window_get_active_tab (window);
- info = get_event_info (window);
+ event = ephy_window_get_context_event (window);
+ g_return_if_fail (event != NULL);
- ephy_embed_event_get_property (info, "link", &value);
+ ephy_embed_event_get_property (event, "link", &value);
ephy_shell_new_tab (ephy_shell, NULL, tab,
g_value_get_string (value),
@@ -74,15 +63,16 @@ void
popup_cmd_link_in_new_tab (GtkAction *action,
EphyWindow *window)
{
- EphyEmbedEvent *info;
+ EphyEmbedEvent *event;
EphyTab *tab;
const GValue *value;
tab = ephy_window_get_active_tab (window);
- info = get_event_info (window);
+ event = ephy_window_get_context_event (window);
+ g_return_if_fail (event != NULL);
- ephy_embed_event_get_property (info, "link", &value);
+ ephy_embed_event_get_property (event, "link", &value);
ephy_shell_new_tab (ephy_shell, window, tab,
g_value_get_string (value),
@@ -96,7 +86,7 @@ popup_cmd_bookmark_link (GtkAction *action,
{
GtkWidget *new_bookmark;
EphyBookmarks *bookmarks;
- EphyEmbedEvent *info;
+ EphyEmbedEvent *event;
const GValue *link_title;
const GValue *link_rel;
const GValue *link;
@@ -107,13 +97,14 @@ popup_cmd_bookmark_link (GtkAction *action,
const char *rel;
gboolean is_smart;
- info = get_event_info (window);
+ event = ephy_window_get_context_event (window);
+ g_return_if_fail (event != NULL);
- ephy_embed_event_get_property (info, "link_is_smart", &link_is_smart);
- ephy_embed_event_get_property (info, "link", &link);
- ephy_embed_event_get_property (info, "link_title", &link_title);
- ephy_embed_event_get_property (info, "link_rel", &link_rel);
- ephy_embed_event_get_property (info, "linktext", &linktext);
+ ephy_embed_event_get_property (event, "link_is_smart", &link_is_smart);
+ ephy_embed_event_get_property (event, "link", &link);
+ ephy_embed_event_get_property (event, "link_title", &link_title);
+ ephy_embed_event_get_property (event, "link_rel", &link_rel);
+ ephy_embed_event_get_property (event, "linktext", &linktext);
location = g_value_get_string (link);
g_return_if_fail (location);
@@ -164,8 +155,8 @@ popup_cmd_copy_link_address (GtkAction *action,
const char *address;
const GValue *value;
- event = get_event_info (window);
- g_return_if_fail (EPHY_IS_EMBED_EVENT (event));
+ event = ephy_window_get_context_event (window);
+ g_return_if_fail (event != NULL);
context = ephy_embed_event_get_context (event);
@@ -190,17 +181,19 @@ save_property_url (GtkAction *action,
gboolean ask_dest,
const char *property)
{
- EphyEmbedEvent *info;
+ EphyEmbedEvent *event;
const char *location;
const GValue *value;
EphyEmbedPersist *persist;
EphyEmbed *embed;
+ event = ephy_window_get_context_event (window);
+ g_return_if_fail (event != NULL);
+
embed = ephy_window_get_active_embed (window);
g_return_if_fail (embed != NULL);
- info = get_event_info (window);
- ephy_embed_event_get_property (info, property, &value);
+ ephy_embed_event_get_property (event, property, &value);
location = g_value_get_string (value);
persist = EPHY_EMBED_PERSIST
@@ -224,7 +217,7 @@ void
popup_cmd_open_link (GtkAction *action,
EphyWindow *window)
{
- EphyEmbedEvent *info;
+ EphyEmbedEvent *event;
const char *location;
const GValue *value;
EphyEmbed *embed;
@@ -232,8 +225,8 @@ popup_cmd_open_link (GtkAction *action,
embed = ephy_window_get_active_embed (window);
g_return_if_fail (embed != NULL);
- info = get_event_info (window);
- ephy_embed_event_get_property (info, "link", &value);
+ event = ephy_window_get_context_event (window);
+ ephy_embed_event_get_property (event, "link", &value);
location = g_value_get_string (value);
ephy_embed_load_url (embed, location);
@@ -293,18 +286,20 @@ void
popup_cmd_set_image_as_background (GtkAction *action,
EphyWindow *window)
{
- EphyEmbedEvent *info;
+ EphyEmbedEvent *event;
const char *location;
char *dest, *base, *base_converted;
const GValue *value;
EphyEmbedPersist *persist;
EphyEmbed *embed;
+ event = ephy_window_get_context_event (window);
+ g_return_if_fail (event != NULL);
+
embed = ephy_window_get_active_embed (window);
g_return_if_fail (embed != NULL);
- info = get_event_info (window);
- ephy_embed_event_get_property (info, "image", &value);
+ ephy_embed_event_get_property (event, "image", &value);
location = g_value_get_string (value);
persist = EPHY_EMBED_PERSIST
@@ -334,12 +329,12 @@ void
popup_cmd_copy_image_location (GtkAction *action,
EphyWindow *window)
{
- EphyEmbedEvent *info;
+ EphyEmbedEvent *event;
const char *location;
const GValue *value;
- info = get_event_info (window);
- ephy_embed_event_get_property (info, "image", &value);
+ event = ephy_window_get_context_event (window);
+ ephy_embed_event_get_property (event, "image", &value);
location = g_value_get_string (value);
popup_cmd_copy_to_clipboard (window, location);
}
@@ -442,17 +437,19 @@ void
popup_cmd_open_image (GtkAction *action,
EphyWindow *window)
{
- EphyEmbedEvent *info;
+ EphyEmbedEvent *event;
const char *address;
char *scheme;
const GValue *value;
EphyEmbed *embed;
+ event = ephy_window_get_context_event (window);
+ g_return_if_fail (event != NULL);
+
embed = ephy_window_get_active_embed (window);
g_return_if_fail (embed != NULL);
- info = get_event_info (window);
- ephy_embed_event_get_property (info, "image", &value);
+ ephy_embed_event_get_property (event, "image", &value);
address = g_value_get_string (value);
scheme = gnome_vfs_get_uri_scheme (address);