From 38f4f77d16ff6ee02751eb91b9870108f639e21a Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 19 Jun 2003 23:58:02 +0000 Subject: Get rid of get/set _event, reformat the header. 2003-06-20 Marco Pesenti Gritti * src/ephy-tab.c: (ephy_tab_finalize), (ephy_tab_init): * src/ephy-tab.h: Get rid of get/set _event, reformat the header. * src/pdm-dialog.c: Fix compilation warning. * src/ephy-window.c: (popup_destroy_cb), (show_embed_popup): * src/popup-commands.c: (get_event_info): Less invasive way to access the event info from the callbacks. --- src/ephy-tab.c | 24 ------------------------ src/ephy-tab.h | 53 ++++++++++++++++++++++++---------------------------- src/ephy-window.c | 16 +++++++++++++++- src/pdm-dialog.c | 2 ++ src/popup-commands.c | 6 +----- 5 files changed, 42 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/ephy-tab.c b/src/ephy-tab.c index 5aab758b2..35226b583 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -51,7 +51,6 @@ struct EphyTabPrivate { EphyEmbed *embed; EphyWindow *window; - EphyEmbedEvent *event; char *status_message; char *link_message; char *icon_address; @@ -367,11 +366,6 @@ ephy_tab_finalize (GObject *object) g_idle_remove_by_data (tab->priv->embed); - if (tab->priv->event) - { - g_object_unref (tab->priv->event); - } - if (tab->priv->action) { g_object_unref (tab->priv->action); @@ -469,14 +463,6 @@ ephy_tab_get_window (EphyTab *tab) return tab->priv->window; } -EphyEmbedEvent * -ephy_tab_get_event (EphyTab *tab) -{ - g_return_val_if_fail (IS_EPHY_TAB (tab), NULL); - - return tab->priv->event; -} - void ephy_tab_get_size (EphyTab *tab, int *width, int *height) { @@ -876,15 +862,6 @@ ephy_tab_size_to_cb (EphyEmbed *embed, gint width, gint height, g_list_free (tabs); } -void -ephy_tab_set_event (EphyTab *tab, - EphyEmbedEvent *event) -{ - if (tab->priv->event) g_object_unref (tab->priv->event); - g_object_ref (event); - tab->priv->event = event; -} - static gint ephy_tab_dom_mouse_click_cb (EphyEmbed *embed, EphyEmbedEvent *event, @@ -951,7 +928,6 @@ ephy_tab_init (EphyTab *tab) tab->priv = g_new0 (EphyTabPrivate, 1); tab->priv->window = NULL; - tab->priv->event = NULL; tab->priv->status_message = NULL; tab->priv->link_message = NULL; tab->priv->total_requests = 0; diff --git a/src/ephy-tab.h b/src/ephy-tab.h index cad8754eb..38d07feca 100644 --- a/src/ephy-tab.h +++ b/src/ephy-tab.h @@ -60,56 +60,51 @@ struct EphyTabClass /* Include the header down here to resolve circular dependency */ #include "ephy-window.h" -GType ephy_tab_get_type (void); +GType ephy_tab_get_type (void); -EphyTab * ephy_tab_new (void); +EphyTab * ephy_tab_new (void); -EggAction * ephy_tab_get_action (EphyTab *tab); +EggAction * ephy_tab_get_action (EphyTab *tab); -EphyEmbed * ephy_tab_get_embed (EphyTab *tab); +EphyEmbed * ephy_tab_get_embed (EphyTab *tab); -void ephy_tab_set_event (EphyTab *tab, - EphyEmbedEvent *event); +void ephy_tab_set_window (EphyTab *tab, + EphyWindow *window); -EphyEmbedEvent *ephy_tab_get_event (EphyTab *tab); +EphyWindow * ephy_tab_get_window (EphyTab *tab); -void ephy_tab_set_window (EphyTab *tab, - EphyWindow *window); +const char * ephy_tab_get_icon_address (EphyTab *tab); -EphyWindow * ephy_tab_get_window (EphyTab *tab); +gboolean ephy_tab_get_load_status (EphyTab *tab); -const char * ephy_tab_get_icon_address (EphyTab *tab); +const char * ephy_tab_get_link_message (EphyTab *tab); -gboolean ephy_tab_get_load_status (EphyTab *tab); -const char * ephy_tab_get_link_message (EphyTab *tab); +int ephy_tab_get_load_percent (EphyTab *tab); +void ephy_tab_set_location (EphyTab *tab, + const char *location); -int ephy_tab_get_load_percent (EphyTab *tab); - -void ephy_tab_set_location (EphyTab *tab, - const char *location); - -const char * ephy_tab_get_location (EphyTab *tab); +const char * ephy_tab_get_location (EphyTab *tab); TabNavigationFlags ephy_tab_get_navigation_flags (EphyTab *tab); - + EmbedSecurityLevel ephy_tab_get_security_level (EphyTab *tab); -void ephy_tab_get_size (EphyTab *tab, - int *width, - int *height); +void ephy_tab_get_size (EphyTab *tab, + int *width, + int *height); -const char * ephy_tab_get_status_message (EphyTab *tab); +const char * ephy_tab_get_status_message (EphyTab *tab); -const char * ephy_tab_get_title (EphyTab *tab); +const char * ephy_tab_get_title (EphyTab *tab); -void ephy_tab_set_visibility (EphyTab *tab, - gboolean visible); +void ephy_tab_set_visibility (EphyTab *tab, + gboolean visible); -gboolean ephy_tab_get_visibility (EphyTab *tab); +gboolean ephy_tab_get_visibility (EphyTab *tab); -float ephy_tab_get_zoom (EphyTab *tab); +float ephy_tab_get_zoom (EphyTab *tab); G_END_DECLS diff --git a/src/ephy-window.c b/src/ephy-window.c index a4ff3bada..dc2b39983 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1034,6 +1034,17 @@ popup_menu_at_coords (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, *push_in = FALSE; } +static void +popup_destroy_cb (GtkWidget *widget, EphyWindow *window) +{ + EphyEmbedEvent *event; + + event = EPHY_EMBED_EVENT (g_object_get_data (G_OBJECT (window), "context_event")); + g_object_set_data (G_OBJECT (window), "context_event", NULL); + + g_object_unref (event); +} + static void show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event) { @@ -1088,7 +1099,10 @@ show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event) g_return_if_fail (widget != NULL); - ephy_tab_set_event (tab, event); + g_object_ref (event); + g_object_set_data (G_OBJECT (window), "context_event", event); + g_signal_connect (widget, "destroy", + G_CALLBACK (popup_destroy_cb), window); gtk_menu_popup (GTK_MENU (widget), NULL, NULL, popup_menu_at_coords, event, 2, gtk_get_current_event_time ()); } diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c index f6370f419..20c3b5a6e 100755 --- a/src/pdm-dialog.c +++ b/src/pdm-dialog.c @@ -55,6 +55,8 @@ pdm_dialog_cookies_treeview_selection_changed_cb (GtkTreeSelection *selection, void pdm_dialog_passwords_treeview_selection_changed_cb (GtkTreeSelection *selection, PdmDialog *dialog); +void +pdm_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data); static GObjectClass *parent_class = NULL; diff --git a/src/popup-commands.c b/src/popup-commands.c index 354713783..490982351 100644 --- a/src/popup-commands.c +++ b/src/popup-commands.c @@ -31,12 +31,8 @@ static EphyEmbedEvent * get_event_info (EphyWindow *window) { EphyEmbedEvent *info; - EphyTab *tab; - - tab = ephy_window_get_active_tab (window); - g_return_val_if_fail (tab != NULL, NULL); - info = ephy_tab_get_event (tab); + info = EPHY_EMBED_EVENT (g_object_get_data (window, "context_event")); g_return_val_if_fail (info != NULL, NULL); return info; -- cgit v1.2.3