aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-03-24 05:17:12 +0800
committerChristian Persch <chpe@src.gnome.org>2004-03-24 05:17:12 +0800
commit2c299d6190d08c97d1cf76b3545b30bde89d904f (patch)
tree3be94b9b4ed84ee4bd825ae1ece12faa5b31fbe4 /src
parent9128390b9cef9877497962a409cd17393ddd0588 (diff)
downloadgsoc2013-epiphany-2c299d6190d08c97d1cf76b3545b30bde89d904f.tar
gsoc2013-epiphany-2c299d6190d08c97d1cf76b3545b30bde89d904f.tar.gz
gsoc2013-epiphany-2c299d6190d08c97d1cf76b3545b30bde89d904f.tar.bz2
gsoc2013-epiphany-2c299d6190d08c97d1cf76b3545b30bde89d904f.tar.lz
gsoc2013-epiphany-2c299d6190d08c97d1cf76b3545b30bde89d904f.tar.xz
gsoc2013-epiphany-2c299d6190d08c97d1cf76b3545b30bde89d904f.tar.zst
gsoc2013-epiphany-2c299d6190d08c97d1cf76b3545b30bde89d904f.zip
Get rid of ephy_tab_[get|set]_window().
2004-03-23 Christian Persch <chpe@cvs.gnome.org> * src/ephy-tab.c: (ephy_tab_set_property), (ephy_tab_get_property), (ephy_tab_get_window), (ephy_tab_action_activate_cb), (ephy_tab_class_init), (ephy_tab_destroy_brsr_cb), (ephy_tab_size_to_cb), (ephy_tab_dom_mouse_click_cb), (ephy_tab_init): * src/ephy-tab.h: * src/ephy-window.c: (tab_context_menu_cb), (ephy_window_set_active_tab): * src/ephy-window.h: Get rid of ephy_tab_[get|set]_window().
Diffstat (limited to 'src')
-rw-r--r--src/ephy-tab.c101
-rw-r--r--src/ephy-tab.h5
-rw-r--r--src/ephy-window.c5
-rw-r--r--src/ephy-window.h2
4 files changed, 25 insertions, 88 deletions
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 9c5b9f6ee..a304432a3 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -64,7 +64,6 @@
struct EphyTabPrivate
{
- EphyWindow *window;
char *status_message;
char *link_message;
char *icon_address;
@@ -101,7 +100,6 @@ enum
PROP_SECURITY,
PROP_TITLE,
PROP_VISIBLE,
- PROP_WINDOW,
PROP_ZOOM
};
@@ -173,9 +171,6 @@ ephy_tab_set_property (GObject *object,
ephy_tab_set_location (tab, g_value_get_string (value),
TAB_ADDRESS_EXPIRE_NOW);
break;
- case PROP_WINDOW:
- ephy_tab_set_window (tab, g_value_get_object (value));
- break;
case PROP_ICON:
case PROP_LOAD_PROGRESS:
case PROP_LOAD_STATUS:
@@ -227,9 +222,6 @@ ephy_tab_get_property (GObject *object,
case PROP_VISIBLE:
g_value_set_boolean (value, tab->priv->visibility);
break;
- case PROP_WINDOW:
- g_value_set_object (value, tab->priv->window);
- break;
case PROP_ZOOM:
g_value_set_float (value, tab->priv->zoom);
break;
@@ -252,33 +244,31 @@ ephy_tab_size_allocate (GtkWidget *widget,
}
}
-static void
-ephy_tab_parent_set (GtkWidget *widget,
- GtkWidget *previous_parent)
+static EphyWindow *
+ephy_tab_get_window (EphyTab *tab)
{
- if (widget->parent)
- {
- GtkWidget *toplevel;
- toplevel = gtk_widget_get_toplevel (widget);
+ GtkWidget *toplevel;
- ephy_tab_set_window (EPHY_TAB (widget), EPHY_WINDOW (toplevel));
- }
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (tab));
+ g_return_val_if_fail (toplevel != NULL, NULL);
- if (GTK_WIDGET_CLASS (parent_class)->parent_set)
- {
- GTK_WIDGET_CLASS (parent_class)->parent_set (widget, previous_parent);
- }
+ return EPHY_WINDOW (toplevel);
}
static void
ephy_tab_action_activate_cb (GtkAction *action, EphyTab *tab)
{
+ EphyWindow *window;
+
g_return_if_fail (EPHY_IS_TAB (tab));
+ window = ephy_tab_get_window (tab);
+ g_return_if_fail (window != NULL);
+
if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) &&
- ephy_window_get_active_tab (tab->priv->window) != tab)
+ ephy_window_get_active_tab (window) != tab)
{
- ephy_window_jump_to_tab (tab->priv->window, tab);
+ ephy_window_jump_to_tab (window, tab);
}
}
@@ -295,7 +285,6 @@ ephy_tab_class_init (EphyTabClass *class)
object_class->set_property = ephy_tab_set_property;
widget_class->size_allocate = ephy_tab_size_allocate;
- widget_class->parent_set = ephy_tab_parent_set;
g_object_class_install_property (object_class,
PROP_ADDRESS,
@@ -378,14 +367,6 @@ ephy_tab_class_init (EphyTabClass *class)
G_PARAM_READABLE));
g_object_class_install_property (object_class,
- PROP_WINDOW,
- g_param_spec_object ("window",
- "Window",
- "The tab's parent window",
- EPHY_TYPE_WINDOW,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
PROP_ZOOM,
g_param_spec_float ("zoom",
"Zoom",
@@ -504,7 +485,8 @@ ephy_tab_set_link_message (EphyTab *tab, char *message)
* The message returned has a limited lifetime, and so should be copied with
* g_strdup() if it must be stored.
*
- * Listen to "notify::message" to be notified when the message property changes.
+ * Listen to the "link_message" signal on the @tab's #EphyEmbed to be notified
+ * when the link message changes.
*
* Return value: The current link statusbar message
**/
@@ -554,43 +536,6 @@ ephy_tab_for_embed (EphyEmbed *embed)
}
/**
- * ephy_tab_set_window:
- * @tab: an #EphyTab
- * @window: @tab's #EphyWindow
- *
- * FIXME: DO NOT USE
- **/
-void
-ephy_tab_set_window (EphyTab *tab, EphyWindow *window)
-{
- g_return_if_fail (EPHY_IS_TAB (tab));
- if (window) g_return_if_fail (EPHY_IS_WINDOW (window));
-
- if (window != tab->priv->window)
- {
- tab->priv->window = window;
-
- g_object_notify (G_OBJECT (tab), "window");
- }
-}
-
-/**
- * ephy_tab_get_window:
- * @tab: an #EphyTab\
- *
- * Returns the #EphyWindow which holds @tab in its #GtkNotebook.
- *
- * Return value: @tab's #EphyWindow
- **/
-EphyWindow *
-ephy_tab_get_window (EphyTab *tab)
-{
- g_return_val_if_fail (EPHY_IS_TAB (tab), NULL);
-
- return tab->priv->window;
-}
-
-/**
* ephy_tab_get_size:
* @tab: an #EphyTab
* @width: return location for width, or %NULL
@@ -1037,14 +982,17 @@ ephy_tab_visibility_cb (EphyEmbed *embed, gboolean visibility,
static void
ephy_tab_destroy_brsr_cb (EphyEmbed *embed, EphyTab *tab)
{
+ EphyWindow *window;
GtkWidget *notebook;
g_return_if_fail (EPHY_IS_TAB (tab));
- g_return_if_fail (tab->priv->window != NULL);
+
+ window = ephy_tab_get_window (tab);
+ g_return_if_fail (window != NULL);
/* Do not use ephy_window_remove_tab because it will
check for unsubmitted forms */
- notebook = ephy_window_get_notebook (tab->priv->window);
+ notebook = ephy_window_get_notebook (window);
ephy_notebook_remove_tab (EPHY_NOTEBOOK (notebook), tab);
}
@@ -1055,10 +1003,12 @@ ephy_tab_size_to_cb (EphyEmbed *embed, gint width, gint height,
GtkWidget *notebook;
EphyWindow *window;
+ LOG ("ephy_tab_size_to_cb tab %p width %d height %d", tab, width, height)
+
tab->priv->width = width;
tab->priv->height = height;
- window = tab->priv->window;
+ window = ephy_tab_get_window (tab);
notebook = ephy_window_get_notebook (window);
/* Do not resize window with multiple tabs.
@@ -1157,7 +1107,6 @@ ephy_tab_dom_mouse_click_cb (EphyEmbed *embed,
{
EphyEmbedEventType type;
EmbedEventContext context;
- EphyWindow *window;
guint modifier;
gboolean handled = TRUE;
gboolean with_control, with_shift, is_left_click, is_middle_click;
@@ -1167,9 +1116,6 @@ ephy_tab_dom_mouse_click_cb (EphyEmbed *embed,
g_return_val_if_fail (EPHY_IS_EMBED_EVENT(event), FALSE);
- window = ephy_tab_get_window (tab);
- g_return_val_if_fail (window != NULL, FALSE);
-
type = ephy_embed_event_get_event_type (event);
context = ephy_embed_event_get_context (event);
modifier = ephy_embed_event_get_modifier (event);
@@ -1262,7 +1208,6 @@ ephy_tab_init (EphyTab *tab)
tab->priv = EPHY_TAB_GET_PRIVATE (tab);
- tab->priv->window = 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 18007e040..b56105510 100644
--- a/src/ephy-tab.h
+++ b/src/ephy-tab.h
@@ -79,11 +79,6 @@ EphyEmbed *ephy_tab_get_embed (EphyTab *tab);
EphyTab *ephy_tab_for_embed (EphyEmbed *embed);
-void ephy_tab_set_window (EphyTab *tab,
- EphyWindow *window);
-
-EphyWindow *ephy_tab_get_window (EphyTab *tab);
-
const char *ephy_tab_get_icon_address (EphyTab *tab);
gboolean ephy_tab_get_load_status (EphyTab *tab);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 7408c3cb7..9f5c3001b 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1466,9 +1466,6 @@ tab_context_menu_cb (EphyEmbed *embed,
g_return_val_if_fail (EPHY_IS_TAB (tab), FALSE);
g_return_val_if_fail (window->priv->active_tab == tab, FALSE);
- window = ephy_tab_get_window (tab);
- g_return_val_if_fail (window != NULL, FALSE);
-
show_embed_popup (window, tab, event);
return FALSE;
@@ -1482,7 +1479,7 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab)
GtkToggleAction *action;
g_return_if_fail (EPHY_IS_WINDOW (window));
- if (ephy_tab_get_window (new_tab) != window) return;
+ g_return_if_fail (gtk_widget_get_toplevel (GTK_WIDGET (new_tab)) == GTK_WIDGET (window));
old_tab = window->priv->active_tab;
diff --git a/src/ephy-window.h b/src/ephy-window.h
index 985029d21..4370c8081 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -22,6 +22,7 @@
#define EPHY_WINDOW_H
#include "ephy-embed.h"
+#include "ephy-tab.h"
#include "ephy-dialog.h"
#include <glib-object.h>
@@ -57,7 +58,6 @@ struct EphyWindowClass
};
/* Include the header down here to resolve circular dependency */
-#include "ephy-tab.h"
#include "ephy-notebook.h"
GType ephy_window_get_type (void);