aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-01-02 06:57:16 +0800
committerChristian Persch <chpe@src.gnome.org>2004-01-02 06:57:16 +0800
commit05b3184b5d074180c6a730e55b57ced1d5d480db (patch)
tree655829b92f263adbdf8aa4a917a6734e70508cdf /src
parentab98ba5308fd8065876b480b799dc591893383e8 (diff)
downloadgsoc2013-epiphany-05b3184b5d074180c6a730e55b57ced1d5d480db.tar
gsoc2013-epiphany-05b3184b5d074180c6a730e55b57ced1d5d480db.tar.gz
gsoc2013-epiphany-05b3184b5d074180c6a730e55b57ced1d5d480db.tar.bz2
gsoc2013-epiphany-05b3184b5d074180c6a730e55b57ced1d5d480db.tar.lz
gsoc2013-epiphany-05b3184b5d074180c6a730e55b57ced1d5d480db.tar.xz
gsoc2013-epiphany-05b3184b5d074180c6a730e55b57ced1d5d480db.tar.zst
gsoc2013-epiphany-05b3184b5d074180c6a730e55b57ced1d5d480db.zip
New API to get the EphyTab from an EphyEmbed. Port all users.
2004-01-01 Christian Persch <chpe@cvs.gnome.org> * src/ephy-notebook.c: (notebook_drag_data_received_cb), (ephy_notebook_insert_page), (ephy_notebook_remove_page): * src/ephy-tab.c: (ephy_tab_for_embed), (ephy_tab_init): * src/ephy-tab.h: * src/ephy-tabs-menu.c: (tab_added_cb), (tab_removed_cb): * src/ephy-window.c: (tab_context_menu_cb), (tab_added_cb), (tab_removed_cb), (real_get_active_tab), (ephy_window_get_tabs): New API to get the EphyTab from an EphyEmbed. Port all users.
Diffstat (limited to 'src')
-rw-r--r--src/ephy-notebook.c8
-rw-r--r--src/ephy-tab.c14
-rw-r--r--src/ephy-tab.h8
-rw-r--r--src/ephy-tabs-menu.c14
-rw-r--r--src/ephy-window.c21
5 files changed, 40 insertions, 25 deletions
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 1308e71fc..87bb719a6 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -654,7 +654,7 @@ notebook_drag_data_received_cb (GtkWidget* widget, GdkDragContext *context,
if (child)
{
embed = EPHY_EMBED (child);
- tab = EPHY_TAB (g_object_get_data (G_OBJECT (embed), "EphyTab"));
+ tab = ephy_tab_for_embed (embed);
}
l = uris;
@@ -958,7 +958,7 @@ ephy_notebook_insert_page (EphyNotebook *nb,
GtkWidget *label;
g_return_if_fail (EPHY_IS_EMBED (child));
- tab = EPHY_TAB (g_object_get_data (G_OBJECT (child), "EphyTab"));
+ tab = ephy_tab_for_embed (EPHY_EMBED (child));
g_return_if_fail (EPHY_IS_TAB (tab));
label = build_tab_label (nb, child);
@@ -1051,7 +1051,7 @@ smart_tab_switching_on_closure (EphyNotebook *nb,
void
ephy_notebook_remove_page (EphyNotebook *nb,
- GtkWidget *child)
+ GtkWidget *child)
{
int num, position, curr;
EphyTab *tab;
@@ -1060,7 +1060,7 @@ ephy_notebook_remove_page (EphyNotebook *nb,
g_return_if_fail (EPHY_IS_NOTEBOOK (nb));
g_return_if_fail (EPHY_IS_EMBED (child));
- tab = EPHY_TAB (g_object_get_data (G_OBJECT (child), "EphyTab"));
+ tab = ephy_tab_for_embed (EPHY_EMBED (child));
g_return_if_fail (EPHY_IS_TAB (tab));
num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb));
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 25c7f0e4e..0ca50ef4a 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -476,6 +476,18 @@ ephy_tab_get_embed (EphyTab *tab)
return tab->priv->embed;
}
+EphyTab *
+ephy_tab_for_embed (EphyEmbed *embed)
+{
+ EphyTab *tab;
+
+ g_return_val_if_fail (EPHY_IS_EMBED (embed), NULL);
+
+ tab = EPHY_TAB (g_object_get_data (G_OBJECT (embed), "ephy-tab"));
+
+ return tab;
+}
+
void
ephy_tab_set_window (EphyTab *tab, EphyWindow *window)
{
@@ -1130,7 +1142,7 @@ ephy_tab_init (EphyTab *tab)
G_CALLBACK (ephy_tab_action_activate_cb), tab);
/* set a pointer in the embed's widget back to the tab */
- g_object_set_data (embed_widget, "EphyTab", tab);
+ g_object_set_data (embed_widget, "ephy-tab", tab);
g_signal_connect (embed_widget, "parent_set",
G_CALLBACK (ephy_tab_parent_set_cb),
diff --git a/src/ephy-tab.h b/src/ephy-tab.h
index 958a4dd95..cb685cd74 100644
--- a/src/ephy-tab.h
+++ b/src/ephy-tab.h
@@ -36,9 +36,9 @@ G_BEGIN_DECLS
#define EPHY_IS_TAB_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_TAB))
#define EPHY_TAB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_TAB, EphyTabClass))
-typedef struct EphyTabClass EphyTabClass;
-typedef struct EphyTab EphyTab;
-typedef struct EphyTabPrivate EphyTabPrivate;
+typedef struct EphyTabClass EphyTabClass;
+typedef struct EphyTab EphyTab;
+typedef struct EphyTabPrivate EphyTabPrivate;
typedef enum
{
@@ -78,6 +78,8 @@ GObject *ephy_tab_get_action (EphyTab *tab);
EphyEmbed *ephy_tab_get_embed (EphyTab *tab);
+EphyTab *ephy_tab_for_embed (EphyEmbed *embed);
+
void ephy_tab_set_window (EphyTab *tab,
EphyWindow *window);
diff --git a/src/ephy-tabs-menu.c b/src/ephy-tabs-menu.c
index fc1518d61..c8eb3b91b 100644
--- a/src/ephy-tabs-menu.c
+++ b/src/ephy-tabs-menu.c
@@ -96,13 +96,13 @@ ephy_tabs_menu_get_type (void)
}
static void
-tab_added_cb (EphyNotebook *notebook, GtkWidget *child, EphyTabsMenu *menu)
+tab_added_cb (EphyNotebook *notebook, EphyEmbed *embed, EphyTabsMenu *menu)
{
EphyTab *tab;
GtkAction *action;
-
- g_return_if_fail (EPHY_IS_EMBED (child));
- tab = EPHY_TAB (g_object_get_data (G_OBJECT (child), "EphyTab"));
+
+ g_return_if_fail (EPHY_IS_EMBED (embed));
+ tab = ephy_tab_for_embed (embed);
action = GTK_ACTION (ephy_tab_get_action (tab));
gtk_action_group_add_action (menu->priv->action_group, action);
@@ -111,13 +111,13 @@ tab_added_cb (EphyNotebook *notebook, GtkWidget *child, EphyTabsMenu *menu)
}
static void
-tab_removed_cb (EphyNotebook *notebook, GtkWidget *child, EphyTabsMenu *menu)
+tab_removed_cb (EphyNotebook *notebook, EphyEmbed *embed, EphyTabsMenu *menu)
{
EphyTab *tab;
GtkAction *action;
- g_return_if_fail (EPHY_IS_EMBED (child));
- tab = EPHY_TAB (g_object_get_data (G_OBJECT (child), "EphyTab"));
+ g_return_if_fail (EPHY_IS_EMBED (embed));
+ tab = ephy_tab_for_embed (embed);
action = GTK_ACTION (ephy_tab_get_action (tab));
gtk_action_group_remove_action (menu->priv->action_group, action);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 579e3e301..a7f1449c1 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1196,7 +1196,7 @@ tab_context_menu_cb (EphyEmbed *embed,
g_return_val_if_fail (EPHY_IS_EMBED (embed), FALSE);
g_return_val_if_fail (EPHY_IS_EMBED_EVENT(event), FALSE);
- tab = EPHY_TAB (g_object_get_data (G_OBJECT (embed), "EphyTab"));
+ tab = ephy_tab_for_embed (embed);
g_return_val_if_fail (EPHY_IS_TAB (tab), FALSE);
g_return_val_if_fail (window->priv->active_tab == tab, FALSE);
@@ -1356,12 +1356,12 @@ update_tabs_menu_sensitivity (EphyWindow *window)
}
static void
-tab_added_cb (EphyNotebook *notebook, GtkWidget *child, EphyWindow *window)
+tab_added_cb (EphyNotebook *notebook, EphyEmbed *embed, EphyWindow *window)
{
EphyTab *tab;
- g_return_if_fail (EPHY_IS_EMBED (child));
- tab = EPHY_TAB (g_object_get_data (G_OBJECT (child), "EphyTab"));
+ g_return_if_fail (EPHY_IS_EMBED (embed));
+ tab = ephy_tab_for_embed (embed);
window->priv->num_tabs++;
@@ -1372,12 +1372,12 @@ tab_added_cb (EphyNotebook *notebook, GtkWidget *child, EphyWindow *window)
}
static void
-tab_removed_cb (EphyNotebook *notebook, GtkWidget *child, EphyWindow *window)
+tab_removed_cb (EphyNotebook *notebook, EphyEmbed *embed, EphyWindow *window)
{
EphyTab *tab;
- g_return_if_fail (EPHY_IS_EMBED (child));
- tab = EPHY_TAB (g_object_get_data (G_OBJECT (child), "EphyTab"));
+ g_return_if_fail (EPHY_IS_EMBED (embed));
+ tab = ephy_tab_for_embed (embed);
g_signal_handlers_disconnect_by_func (G_OBJECT (tab),
G_CALLBACK (sync_tab_visibility),
@@ -1798,7 +1798,7 @@ real_get_active_tab (EphyWindow *window, int page_num)
page_num);
g_return_val_if_fail (GTK_IS_WIDGET (embed_widget), NULL);
- tab = g_object_get_data (G_OBJECT (embed_widget), "EphyTab");
+ tab = ephy_tab_for_embed (EPHY_EMBED (embed_widget));
g_return_val_if_fail (EPHY_IS_TAB (tab), NULL);
return tab;
@@ -1925,8 +1925,9 @@ ephy_window_get_tabs (EphyWindow *window)
{
EphyTab *tab;
- tab = g_object_get_data (G_OBJECT (w), "EphyTab");
- g_return_val_if_fail (EPHY_IS_TAB (G_OBJECT (tab)), NULL);
+ g_return_val_if_fail (EPHY_IS_EMBED (w), NULL);
+ tab = ephy_tab_for_embed (EPHY_EMBED (w));
+ g_return_val_if_fail (EPHY_IS_TAB (tab), NULL);
tabs = g_list_prepend (tabs, tab);
i++;