[gnome-games/wip/exalm/gtk4: 10/48] fixme: Remove libhandy



commit 81f211c32c08119ae3ffa5f628a6b86325d0ccec
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Tue Sep 18 00:25:40 2018 +0500

    fixme: Remove libhandy
    
    Libhandy isn't available for GTK4 yet, so remove it for now and replace
    with stubs.

 data/ui/application-window.ui     |  5 ----
 data/ui/collection-box.ui         |  8 -----
 data/ui/collection-header-bar.ui  | 10 +++----
 data/ui/platforms-view.ui         |  5 +---
 data/ui/preferences-page.ui       |  7 +++--
 data/ui/preferences-window.ui     | 19 +++---------
 data/ui/search-bar.ui             |  8 ++---
 flatpak/org.gnome.Games.json      | 15 ----------
 meson.build                       |  3 --
 src/main.vala                     |  1 -
 src/meson.build                   |  1 -
 src/ui/collection-box.vala        | 13 --------
 src/ui/collection-header-bar.vala | 13 +++++---
 src/ui/platforms-view.vala        | 35 ----------------------
 src/ui/preferences-window.vala    | 62 ++-------------------------------------
 src/ui/search-bar.vala            |  2 +-
 16 files changed, 29 insertions(+), 178 deletions(-)
---
diff --git a/data/ui/application-window.ui b/data/ui/application-window.ui
index c5d87266..802b67a0 100644
--- a/data/ui/application-window.ui
+++ b/data/ui/application-window.ui
@@ -16,14 +16,9 @@
       </object>
     </child>
     <child type="titlebar">
-      <object class="HdyTitleBar">
-        <property name="visible">True</property>
-        <child>
           <object class="GtkStack" id="header_bar">
             <property name="visible">True</property>
           </object>
-        </child>
-      </object>
     </child>
   </template>
 </interface>
diff --git a/data/ui/collection-box.ui b/data/ui/collection-box.ui
index 65560069..93ee8d10 100644
--- a/data/ui/collection-box.ui
+++ b/data/ui/collection-box.ui
@@ -55,8 +55,6 @@
               </object>
               <packing>
                 <property name="name">platform</property>
-                <!-- FIXME: the icon is meant to be used for text formatting -->
-                <property name="icon-name">view-list-bullet-symbolic</property>
                 <property name="title" translatable="yes">Platforms</property>
               </packing>
             </child>
@@ -105,12 +103,6 @@
         </child>
       </object>
     </child>
-    <child>
-      <object class="HdyViewSwitcherBar" id="view_switcher_bar">
-        <property name="visible">True</property>
-        <property name="stack">viewstack</property>
-      </object>
-    </child>
   </template>
   <object class="GtkImage" id="close_icon">
     <property name="visible">True</property>
diff --git a/data/ui/collection-header-bar.ui b/data/ui/collection-header-bar.ui
index f8577d76..699d78c6 100644
--- a/data/ui/collection-header-bar.ui
+++ b/data/ui/collection-header-bar.ui
@@ -8,10 +8,9 @@
         <property name="visible">True</property>
         <property name="transition-type">slide-left-right</property>
         <child>
-          <object class="HdyHeaderBar" id="header_bar">
+          <object class="GtkHeaderBar" id="header_bar">
             <property name="visible">True</property>
             <property name="show-close-button">True</property>
-            <property name="centering-policy">strict</property>
             <child>
               <object class="GtkButton" id="add_game">
                 <property name="visible">True</property>
@@ -60,18 +59,17 @@
               </packing>
             </child>
             <child type="title">
-              <object class="HdySqueezer" id="title_squeezer">
+              <object class="GtkStack" id="title_squeezer">
                 <property name="visible">True</property>
                 <property name="transition-type">crossfade</property>
                 <signal name="notify::visible-child" handler="on_squeezer_visible_child_changed"/>
                 <child>
-                  <object class="HdyViewSwitcher" id="view_switcher">
+                  <object class="GtkStackSwitcher" id="view_switcher">
                     <property name="visible">True</property>
-                    <property name="policy">wide</property>
                   </object>
                 </child>
                 <child>
-                  <object class="GtkLabel">
+                  <object class="GtkLabel" id="empty_label">
                     <property name="visible">True</property>
                     <property name="label" translatable="yes">Games</property>
                     <style>
diff --git a/data/ui/platforms-view.ui b/data/ui/platforms-view.ui
index 5f978337..31c680dd 100644
--- a/data/ui/platforms-view.ui
+++ b/data/ui/platforms-view.ui
@@ -7,11 +7,8 @@
     <signal name="map" after="yes" handler="on_map"/>
     <signal name="unmap" after="no" handler="on_unmap"/>
     <child>
-      <object class="HdyLeaflet" id="leaflet">
+      <object class="GtkBox" id="leaflet">
         <property name="visible">True</property>
-        <property name="mode-transition-type">slide</property>
-        <property name="child-transition-type">slide</property>
-        <signal name="notify::folded" handler="on_leaflet_folded_changed"/>
         <child>
           <object class="GtkScrolledWindow" id="scrolled_window">
             <property name="visible">True</property>
diff --git a/data/ui/preferences-page.ui b/data/ui/preferences-page.ui
index b420b53d..66256e76 100644
--- a/data/ui/preferences-page.ui
+++ b/data/ui/preferences-page.ui
@@ -15,15 +15,16 @@
                 <property name="visible">True</property>
                 <property name="vexpand">True</property>
                 <child>
-                  <object class="HdyColumn">
+                  <object class="GtkBox">
                     <property name="visible">True</property>
                     <property name="expand">True</property>
-                    <property name="maximum-width">600</property>
-                    <property name="linear-growth-width">300</property>
+                    <property name="width-request">600</property>
+                    <property name="halign">center</property>
                     <child>
                       <object class="GtkBox" id="box">
                         <property name="visible">True</property>
                         <property name="orientation">vertical</property>
+                        <property name="hexpand">True</property>
                         <property name="margin">12</property>
                         <property name="spacing">12</property>
                       </object>
diff --git a/data/ui/preferences-window.ui b/data/ui/preferences-window.ui
index 67bce5a8..63f46cc3 100644
--- a/data/ui/preferences-window.ui
+++ b/data/ui/preferences-window.ui
@@ -7,7 +7,7 @@
     <property name="default-height">500</property>
     <property name="window-position">center-on-parent</property>
     <child type="titlebar">
-      <object class="HdyTitleBar" id="titlebar">
+      <object class="GtkBox" id="titlebar">
         <property name="visible">True</property>
         <child>
           <object class="GtkStack" id="titlebar_stack">
@@ -15,16 +15,14 @@
             <property name="transition-type">slide-left-right</property>
             <property name="transition-duration">250</property>
             <child>
-              <object class="HdyLeaflet" id="titlebar_box">
+              <object class="GtkBox" id="titlebar_box">
                 <property name="visible">True</property>
-                <property name="mode-transition-type">slide</property>
-                <property name="child-transition-type">slide</property>
                 <child>
                   <object class="GtkHeaderBar" id="left_header_bar">
                     <property name="name">left_header_bar</property>
                     <property name="visible">True</property>
                     <property name="title" translatable="yes">Preferences</property>
-                    <property name="show-close-button">True</property>
+                    <property name="show-close-button">False</property>
                     <child>
                       <object class="GtkButton" id="window_back_button">
                         <property name="visible">False</property>
@@ -105,11 +103,8 @@
         <property name="transition-duration">250</property>
         <signal name="notify::transition-running" handler="subpage_transition_finished"/>
         <child>
-          <object class="HdyLeaflet" id="content_box">
+          <object class="GtkBox" id="content_box">
             <property name="visible">True</property>
-            <property name="mode-transition-type">slide</property>
-            <property name="child-transition-type">slide</property>
-            <signal name="notify::folded" handler="on_folded_changed" after="yes"/>
             <child>
               <object class="GamesPreferencesSidebar" id="sidebar">
                 <property name="stack">stack</property>
@@ -176,10 +171,4 @@
       <widget name="stack"/>
     </widgets>
   </object>
-  <object class="HdyHeaderGroup" id="header_group">
-    <headerbars>
-      <headerbar name="left_header_bar"/>
-      <headerbar name="right_header_bar"/>
-    </headerbars>
-  </object>
 </interface>
diff --git a/data/ui/search-bar.ui b/data/ui/search-bar.ui
index 2eed478f..be7bfe20 100644
--- a/data/ui/search-bar.ui
+++ b/data/ui/search-bar.ui
@@ -4,17 +4,17 @@
   <template class="GamesSearchBar" parent="GtkBin">
     <property name="visible">True</property>
     <child>
-      <object class="HdySearchBar" id="search_bar">
+      <object class="GtkSearchBar" id="search_bar">
         <property name="visible">True</property>
         <property name="search-mode-enabled" bind-source="GamesSearchBar" 
bind-property="search-mode-enabled" bind-flags="sync-create|bidirectional"/>
         <child>
-          <object class="HdyColumn">
+          <object class="GtkBox">
             <property name="visible">True</property>
-            <property name="maximum-width">400</property>
-            <property name="linear-growth-width">300</property>
+            <property name="width-request">400</property>
             <child>
               <object class="GtkSearchEntry" id="entry">
                 <property name="visible">True</property>
+                <property name="hexpand">True</property>
                 <signal name="search-changed" handler="on_search_changed"/>
                 <signal name="activate" handler="on_search_activated"/>
               </object>
diff --git a/flatpak/org.gnome.Games.json b/flatpak/org.gnome.Games.json
index 388b77b6..e38c629f 100644
--- a/flatpak/org.gnome.Games.json
+++ b/flatpak/org.gnome.Games.json
@@ -176,21 +176,6 @@
                 }
             ]
         },
-        {
-            "name" : "libhandy",
-            "buildsystem" : "meson",
-            "config-opts" : [
-                "-Dtests=false",
-                "-Dexamples=false",
-                "-Dglade_catalog=disabled"
-            ],
-            "sources" : [
-                {
-                    "type" : "git",
-                    "url" : "https://source.puri.sm/Librem5/libhandy.git";
-                }
-            ]
-        },
         {
             "name" : "manette",
             "buildsystem" : "meson",
diff --git a/meson.build b/meson.build
index 16616bf3..acbbae63 100644
--- a/meson.build
+++ b/meson.build
@@ -31,14 +31,12 @@ valac = meson.get_compiler ('vala')
 glib_min_version = '2.38'
 manette_min_version = '0.2.0'
 retro_gtk_min_version = '0.15.3'
-handy_min_version = '0.0.10'
 
 archive_dep = dependency ('libarchive')
 gio_dep = dependency ('gio-2.0', version: '>=' + glib_min_version)
 glib_dep = dependency ('glib-2.0', version: '>=' + glib_min_version)
 grilo_dep = dependency ('grilo-0.3')
 gtk_dep = dependency ('gtk+-3.0')
-handy_dep = dependency ('libhandy-0.0', version: '>=' + handy_min_version)
 m_dep = cc.find_library('m', required : false)
 manette_dep = dependency ('manette-0.2', version: '>=' + manette_min_version)
 retro_gtk_dep = dependency ('retro-gtk-0.14', version: '>=' + retro_gtk_min_version)
@@ -78,7 +76,6 @@ srcinc = include_directories('src')
 add_project_arguments (
   '-DGETTEXT_PACKAGE="' + meson.project_name () + '"',
   '-DRETRO_GTK_USE_UNSTABLE_API',
-  '-DHANDY_USE_UNSTABLE_API',
   language: 'c'
 )
 
diff --git a/src/main.vala b/src/main.vala
index 07bec5a3..0006fc40 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -6,7 +6,6 @@ int main (string[] args) {
        Intl.textdomain (Config.GETTEXT_PACKAGE);
 
        Grl.init (ref args);
-       Hdy.init (ref args);
 
        // Needed for shortcuts window
        typeof (GLib.ThemedIcon).ensure ();
diff --git a/src/meson.build b/src/meson.build
index 3bbe504f..e3a3579d 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -222,7 +222,6 @@ dependencies = [
   glib_dep,
   grilo_dep,
   gtk_dep,
-  handy_dep,
   m_dep,
   manette_dep,
   retro_gtk_dep,
diff --git a/src/ui/collection-box.vala b/src/ui/collection-box.vala
index e1f96981..43288f26 100644
--- a/src/ui/collection-box.vala
+++ b/src/ui/collection-box.vala
@@ -20,8 +20,6 @@ private class Games.CollectionBox : Gtk.Box {
        private PlatformsView platform_view;
        [GtkChild (name = "viewstack")]
        private Gtk.Stack _viewstack;
-       [GtkChild]
-       private Hdy.ViewSwitcherBar view_switcher_bar;
 
        public Gtk.Stack viewstack {
                get { return _viewstack; }
@@ -42,15 +40,9 @@ private class Games.CollectionBox : Gtk.Box {
        public AdaptiveState adaptive_state { get; construct; }
 
        construct {
-               var icon_name = Config.APPLICATION_ID + "-symbolic";
-               viewstack.child_set (collection_view, "icon-name", icon_name);
-
                collection_view.model = collection;
                platform_view.model = collection;
                platform_view.adaptive_state = adaptive_state;
-
-               adaptive_state.notify["is-showing-bottom-bar"].connect (update_bottom_bar);
-               adaptive_state.notify["is-subview-open"].connect (update_bottom_bar);
        }
 
        public CollectionBox (ListModel collection, AdaptiveState adaptive_state) {
@@ -160,9 +152,4 @@ private class Games.CollectionBox : Gtk.Box {
        public bool search_bar_handle_event (Gdk.Event event) {
                return search_bar.handle_event (event);
        }
-
-       private void update_bottom_bar () {
-               view_switcher_bar.reveal = adaptive_state.is_showing_bottom_bar &&
-                       (!adaptive_state.is_folded || !adaptive_state.is_subview_open);
-       }
 }
diff --git a/src/ui/collection-header-bar.vala b/src/ui/collection-header-bar.vala
index 2e11430c..61415826 100644
--- a/src/ui/collection-header-bar.vala
+++ b/src/ui/collection-header-bar.vala
@@ -22,7 +22,10 @@ private class Games.CollectionHeaderBar : Gtk.Bin {
                get { return _is_collection_empty; }
                set {
                        _is_collection_empty = value;
-                       title_squeezer.set_child_enabled (view_switcher, !value);
+                       if (value)
+                               title_squeezer.visible_child = empty_label;
+                       else
+                               title_squeezer.visible_child = view_switcher;
                        update_adaptive_state ();
                }
        }
@@ -32,13 +35,15 @@ private class Games.CollectionHeaderBar : Gtk.Bin {
        [GtkChild]
        private Gtk.Stack stack;
        [GtkChild]
-       private Hdy.HeaderBar header_bar;
+       private Gtk.HeaderBar header_bar;
        [GtkChild]
        private Gtk.HeaderBar subview_header_bar;
        [GtkChild]
-       private Hdy.Squeezer title_squeezer;
+       private Gtk.Stack title_squeezer;
        [GtkChild]
-       private Hdy.ViewSwitcher view_switcher;
+       private Gtk.StackSwitcher view_switcher;
+       [GtkChild]
+       private Gtk.Label empty_label;
 
        private ulong viewstack_child_changed_id;
 
diff --git a/src/ui/platforms-view.vala b/src/ui/platforms-view.vala
index 29e5ece2..2404d0d3 100644
--- a/src/ui/platforms-view.vala
+++ b/src/ui/platforms-view.vala
@@ -4,10 +4,6 @@
 private class Games.PlatformsView : Gtk.Bin {
        public signal void game_activated (Game game);
 
-       [GtkChild]
-       private Hdy.Leaflet leaflet;
-       [GtkChild]
-       private Gtk.ScrolledWindow scrolled_window;
        [GtkChild]
        private Gtk.ListBox list_box;
        [GtkChild]
@@ -16,8 +12,6 @@ private class Games.PlatformsView : Gtk.Bin {
        private GamepadBrowse gamepad_browse;
 
        private ulong model_items_changed_id;
-       private ulong adaptive_state_folded_id;
-       private ulong adaptive_state_subview_id;
 
        private GenericSet<Platform> platforms;
        private Platform selected_platform;
@@ -71,24 +65,7 @@ private class Games.PlatformsView : Gtk.Bin {
        public AdaptiveState adaptive_state {
                get { return _adaptive_state; }
                set {
-                       if (adaptive_state_subview_id != 0) {
-                               adaptive_state.disconnect (adaptive_state_subview_id);
-                               adaptive_state_subview_id = 0;
-                       }
-
-                       if (adaptive_state_folded_id != 0) {
-                               adaptive_state.disconnect (adaptive_state_folded_id);
-                               adaptive_state_folded_id = 0;
-                       }
-
                        _adaptive_state = value;
-
-                       if (adaptive_state != null) {
-                               adaptive_state_subview_id = adaptive_state.notify["is-subview-open"].connect 
(update_subview);
-                               adaptive_state_folded_id = adaptive_state.notify["is-folded"].connect 
(update_selection_mode);
-
-                               on_leaflet_folded_changed ();
-                       }
                }
        }
 
@@ -321,20 +298,8 @@ private class Games.PlatformsView : Gtk.Bin {
                select_current_row ();
        }
 
-       [GtkCallback]
-       private void on_leaflet_folded_changed () {
-               adaptive_state.is_folded = leaflet.folded;
-       }
-
        [GtkCallback]
        public void on_game_activated (Game game) {
                game_activated (game);
        }
-
-       private void update_subview () {
-               if (adaptive_state.is_subview_open)
-                       leaflet.visible_child = collection_view;
-               else
-                       leaflet.visible_child = scrolled_window;
-       }
 }
diff --git a/src/ui/preferences-window.vala b/src/ui/preferences-window.vala
index c51a3bd2..3a716c6b 100644
--- a/src/ui/preferences-window.vala
+++ b/src/ui/preferences-window.vala
@@ -2,30 +2,18 @@
 
 [GtkTemplate (ui = "/org/gnome/Games/ui/preferences-window.ui")]
 private class Games.PreferencesWindow : Gtk.Window {
-       [GtkChild]
-       private Hdy.TitleBar titlebar;
        [GtkChild]
        private Gtk.Stack titlebar_stack;
        [GtkChild]
-       private Hdy.Leaflet titlebar_box;
-       [GtkChild]
-       private Gtk.HeaderBar left_header_bar;
+       private Gtk.Box titlebar_box;
        [GtkChild]
        private Gtk.HeaderBar right_header_bar;
        [GtkChild]
        private Gtk.Stack main_stack;
        [GtkChild]
-       private Hdy.Leaflet content_box;
-       [GtkChild]
-       private PreferencesSidebar sidebar;
+       private Gtk.Box content_box;
        [GtkChild]
        private Gtk.Stack stack;
-       [GtkChild]
-       private Hdy.HeaderGroup header_group;
-       [GtkChild]
-       private Gtk.Button page_back_button;
-       [GtkChild]
-       private Gtk.Button window_back_button;
 
        private PreferencesSubpage _subpage;
        public PreferencesSubpage subpage {
@@ -38,7 +26,6 @@ private class Games.PreferencesWindow : Gtk.Window {
                                previous_subpage = subpage;
                                main_stack.visible_child = content_box;
                                titlebar_stack.visible_child = titlebar_box;
-                               selection_mode_binding.unbind ();
                        }
 
                        if (value != null) {
@@ -47,15 +34,8 @@ private class Games.PreferencesWindow : Gtk.Window {
                                main_stack.add (value);
                                main_stack.visible_child = value;
 
-                               selection_mode_binding = value.bind_property ("request-selection-mode",
-                                                                             titlebar, "selection-mode",
-                                                                             BindingFlags.SYNC_CREATE);
-
                                titlebar_stack.add (header_bar);
                                titlebar_stack.visible_child = header_bar;
-
-                               content_box.visible_child = stack;
-                               titlebar_box.visible_child = right_header_bar;
                        }
 
                        _subpage = value;
@@ -66,7 +46,6 @@ private class Games.PreferencesWindow : Gtk.Window {
        private PreferencesSubpage previous_subpage;
 
        private Binding subpage_binding;
-       private Binding selection_mode_binding;
 
        construct {
                update_ui ();
@@ -74,10 +53,6 @@ private class Games.PreferencesWindow : Gtk.Window {
 
        [GtkCallback]
        private void sidebar_row_selected () {
-               content_box.visible_child = stack;
-               titlebar_box.visible_child = right_header_bar;
-               update_header_group ();
-
                update_ui ();
        }
 
@@ -108,38 +83,5 @@ private class Games.PreferencesWindow : Gtk.Window {
 
        [GtkCallback]
        private void on_back_clicked () {
-               if (content_box.visible_child == sidebar) {
-                       close ();
-                       return;
-               }
-
-               content_box.visible_child = sidebar;
-               titlebar_box.visible_child = left_header_bar;
-               update_header_group ();
-       }
-
-       [GtkCallback]
-       private void on_folded_changed (Object object, ParamSpec paramSpec) {
-               var folded = content_box.folded;
-
-               update_header_group ();
-               page_back_button.visible = folded;
-               window_back_button.visible = folded;
-               sidebar.show_selection = !folded;
-
-               if (folded)
-                       stack.transition_type = Gtk.StackTransitionType.NONE;
-               else
-                       stack.transition_type = Gtk.StackTransitionType.CROSSFADE;
-       }
-
-       private void update_header_group () {
-               var folded = content_box.folded;
-               var visible_header_bar = titlebar_box.visible_child as Gtk.HeaderBar;
-
-               if (folded)
-                       header_group.focus = visible_header_bar;
-               else
-                       header_group.focus = null;
        }
 }
diff --git a/src/ui/search-bar.vala b/src/ui/search-bar.vala
index 6b1f0b12..205987af 100644
--- a/src/ui/search-bar.vala
+++ b/src/ui/search-bar.vala
@@ -6,7 +6,7 @@ private class Games.SearchBar : Gtk.Bin {
        public bool search_mode_enabled { get; set; }
 
        [GtkChild]
-       private Hdy.SearchBar search_bar;
+       private Gtk.SearchBar search_bar;
        [GtkChild]
        private Gtk.SearchEntry entry;
 


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