[epiphany/wip/exalm/deck: 1/2] window: Stop exposing GtkStack
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/exalm/deck: 1/2] window: Stop exposing GtkStack
- Date: Mon, 25 May 2020 17:35:32 +0000 (UTC)
commit c724102f79cc88c58985363fe2aeea8e7567cdf1
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Mon May 25 22:32:25 2020 +0500
window: Stop exposing GtkStack
Remove ephy_window_get_stack() and replace it with more generic
ephy_window_open_pages_view() and ephy_window_close_pages_view().
This will allow to use a different widget in the next commits.
src/ephy-pages-view.c | 4 +---
src/ephy-window.c | 27 ++++++++++++++++++++-------
src/ephy-window.h | 4 +++-
src/window-commands.c | 16 +++-------------
4 files changed, 27 insertions(+), 24 deletions(-)
---
diff --git a/src/ephy-pages-view.c b/src/ephy-pages-view.c
index a565f3b7c..f74159685 100644
--- a/src/ephy-pages-view.c
+++ b/src/ephy-pages-view.c
@@ -71,7 +71,6 @@ row_activated_cb (EphyPagesView *self,
{
gint new_page;
EphyWindow *window;
- GtkWidget *stack;
GApplication *application;
g_assert (EPHY_IS_PAGES_VIEW (self));
@@ -79,7 +78,6 @@ row_activated_cb (EphyPagesView *self,
application = g_application_get_default ();
window = EPHY_WINDOW (gtk_application_get_active_window (GTK_APPLICATION (application)));
- stack = ephy_window_get_stack (window);
if (!row)
return;
@@ -87,7 +85,7 @@ row_activated_cb (EphyPagesView *self,
new_page = gtk_list_box_row_get_index (row);
gtk_notebook_set_current_page (GTK_NOTEBOOK (self->notebook), new_page);
- gtk_stack_set_visible_child_name (GTK_STACK (stack), "content");
+ ephy_window_close_pages_view (window);
}
static void
diff --git a/src/ephy-window.c b/src/ephy-window.c
index e046a0290..7ecdaaa5b 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -547,7 +547,7 @@ update_adaptive_mode (EphyWindow *window)
* to the main view.
*/
if (adaptive_mode == EPHY_ADAPTIVE_MODE_NORMAL)
- gtk_stack_set_visible_child_name (GTK_STACK (window->main_stack), "content");
+ ephy_window_close_pages_view (window);
}
static void
@@ -3953,20 +3953,33 @@ ephy_window_get_notebook (EphyWindow *window)
}
/**
- * ephy_window_get_stack:
+ * ephy_window_open_pages_view
* @window: an #EphyWindow
*
- * Returns the #GtkStack housing the content and tab views
+ * Opens the mobile pages view
+ **/
+void
+ephy_window_open_pages_view (EphyWindow *window)
+{
+ g_assert (EPHY_IS_WINDOW (window));
+
+ gtk_stack_set_visible_child_name (GTK_STACK (window->main_stack), "tabs");
+}
+
+/**
+ * ephy_window_close_pages_view
+ * @window: an #EphyWindow
*
- * Return value: (transfer none): the @window's #GtkStack
+ * Closes the mobile pages view
**/
-GtkWidget *
-ephy_window_get_stack (EphyWindow *window)
+void
+ephy_window_close_pages_view (EphyWindow *window)
{
g_assert (EPHY_IS_WINDOW (window));
- return GTK_WIDGET (window->main_stack);
+ gtk_stack_set_visible_child_name (GTK_STACK (window->main_stack), "content");
}
+
/**
* ephy_window_get_find_toolbar:
* @window: an #EphyWindow
diff --git a/src/ephy-window.h b/src/ephy-window.h
index 81d68df9a..01c272846 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -47,7 +47,9 @@ typedef enum
EphyWindow *ephy_window_new (void);
GtkWidget *ephy_window_get_notebook (EphyWindow *window);
-GtkWidget *ephy_window_get_stack (EphyWindow *window);
+
+void ephy_window_open_pages_view (EphyWindow *window);
+void ephy_window_close_pages_view (EphyWindow *window);
void ephy_window_load_url (EphyWindow *window,
const char *url);
diff --git a/src/window-commands.c b/src/window-commands.c
index 6ccb80e83..c9c77affc 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1246,11 +1246,9 @@ window_cmd_new_tab (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
- GtkWidget *stack;
EphyWindow *window = user_data;
char *url;
- stack = ephy_window_get_stack (window);
url = g_settings_get_string (EPHY_SETTINGS_MAIN, EPHY_PREFS_HOMEPAGE_URL);
if (g_strcmp0 (url, "about:blank") != 0) {
g_free (url);
@@ -1260,7 +1258,7 @@ window_cmd_new_tab (GSimpleAction *action,
ephy_link_open (EPHY_LINK (window),
url, NULL,
EPHY_LINK_NEW_TAB | EPHY_LINK_JUMP_TO);
- gtk_stack_set_visible_child_name (GTK_STACK (stack), "content");
+ ephy_window_close_pages_view (window);
g_free (url);
}
@@ -2507,11 +2505,7 @@ window_cmd_go_content (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
- GtkWidget *stack;
- EphyWindow *window = EPHY_WINDOW (user_data);
-
- stack = ephy_window_get_stack (window);
- gtk_stack_set_visible_child_name (GTK_STACK (stack), "content");
+ ephy_window_close_pages_view (EPHY_WINDOW (user_data));
}
void
@@ -2519,11 +2513,7 @@ window_cmd_go_tabs_view (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
- GtkWidget *stack;
- EphyWindow *window = EPHY_WINDOW (user_data);
-
- stack = ephy_window_get_stack (window);
- gtk_stack_set_visible_child_name (GTK_STACK (stack), "tabs");
+ ephy_window_open_pages_view (EPHY_WINDOW (user_data));
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]