[epiphany/wip/exalm/sep: 1/6] pages-popover: Remove adaptive mode



commit 7cd9f03b43a12f3db69f5c7f54193d2de7688337
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sat Jun 6 13:35:00 2020 +0500

    pages-popover: Remove adaptive mode
    
    The popover is no longer used on mobile, so there's no need to keep that
    code.

 src/ephy-pages-popover.c           | 39 --------------------------------------
 src/ephy-pages-popover.h           |  3 ---
 src/resources/gtk/pages-popover.ui |  1 +
 3 files changed, 1 insertion(+), 42 deletions(-)
---
diff --git a/src/ephy-pages-popover.c b/src/ephy-pages-popover.c
index a39538f50..9b5b13e11 100644
--- a/src/ephy-pages-popover.c
+++ b/src/ephy-pages-popover.c
@@ -40,7 +40,6 @@ struct _EphyPagesPopover {
 
   GListStore *list_store;
   EphyNotebook *notebook;
-  EphyAdaptiveMode adaptive_mode;
 };
 
 G_DEFINE_TYPE (EphyPagesPopover, ephy_pages_popover, GTK_TYPE_POPOVER)
@@ -137,8 +136,6 @@ items_changed_cb (EphyPagesPopover *self,
 
   for (int i = 0; i < added; i++) {
     items[i] = ephy_page_row_new (self->notebook, position + i);
-    ephy_page_row_set_adaptive_mode (EPHY_PAGE_ROW (items[i]),
-                                     self->adaptive_mode);
     g_signal_connect_swapped (items[i], "closed", G_CALLBACK (row_closed_cb), self);
   }
 
@@ -237,7 +234,6 @@ ephy_pages_popover_init (EphyPagesPopover *self)
 
   self->list_store = g_list_store_new (EPHY_TYPE_PAGE_ROW);
 
-  ephy_pages_popover_set_adaptive_mode (self, EPHY_ADAPTIVE_MODE_NORMAL);
   gtk_list_box_bind_model (self->list_box,
                            G_LIST_MODEL (self->list_store),
                            create_row,
@@ -295,38 +291,3 @@ ephy_pages_popover_set_notebook (EphyPagesPopover *self,
                             G_CALLBACK (current_page_changed_cb),
                             self);
 }
-
-void
-ephy_pages_popover_set_adaptive_mode (EphyPagesPopover *self,
-                                      EphyAdaptiveMode  adaptive_mode)
-{
-  GListModel *list_model;
-
-  g_assert (EPHY_IS_PAGES_POPOVER (self));
-
-  self->adaptive_mode = adaptive_mode;
-
-  list_model = G_LIST_MODEL (self->list_store);
-  for (guint i = 0; i < g_list_model_get_n_items (list_model); i++) {
-    EphyPageRow *row = EPHY_PAGE_ROW (g_list_model_get_item (list_model, i));
-
-    ephy_page_row_set_adaptive_mode (row, self->adaptive_mode);
-  }
-
-  switch (adaptive_mode) {
-    case EPHY_ADAPTIVE_MODE_NORMAL:
-      gtk_widget_set_vexpand (GTK_WIDGET (self), FALSE);
-      /* This should be enough height in normal mode to fit in 900px hight screen. */
-      gtk_scrolled_window_set_max_content_height (self->scrolled_window, 700);
-      gtk_list_box_set_header_func (self->list_box, NULL, NULL, NULL);
-
-      break;
-    case EPHY_ADAPTIVE_MODE_NARROW:
-      gtk_widget_set_vexpand (GTK_WIDGET (self), TRUE);
-      /* Sets the max content to 0 and not -1 to ensure the popover doesn't pop out. */
-      gtk_scrolled_window_set_max_content_height (self->scrolled_window, 0);
-      gtk_list_box_set_header_func (self->list_box, hdy_list_box_separator_header, NULL, NULL);
-
-      break;
-  }
-}
diff --git a/src/ephy-pages-popover.h b/src/ephy-pages-popover.h
index 37e322504..1fd757b7f 100644
--- a/src/ephy-pages-popover.h
+++ b/src/ephy-pages-popover.h
@@ -38,7 +38,4 @@ EphyNotebook *ephy_pages_popover_get_notebook (EphyPagesPopover *popover);
 void          ephy_pages_popover_set_notebook (EphyPagesPopover *popover,
                                                EphyNotebook     *notebook);
 
-void ephy_pages_popover_set_adaptive_mode (EphyPagesPopover *self,
-                                           EphyAdaptiveMode  adaptive_mode);
-
 G_END_DECLS
diff --git a/src/resources/gtk/pages-popover.ui b/src/resources/gtk/pages-popover.ui
index a5f1ba588..92a64e164 100644
--- a/src/resources/gtk/pages-popover.ui
+++ b/src/resources/gtk/pages-popover.ui
@@ -6,6 +6,7 @@
       <object class="GtkScrolledWindow" id="scrolled_window">
         <property name="hscrollbar_policy">never</property>
         <property name="propagate_natural_height">True</property>
+        <property name="max-content-height">700</property>
         <property name="visible">True</property>
         <child>
           <object class="GtkListBox" id="list_box">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]