[nautilus/wip/cdavis/use-flap: 1/2] General: Always show sidebar




commit 79f3b9f45539f4a9adf458c400af94214277a1fe
Author: Christopher Davis <christopherdavis gnome org>
Date:   Sat Jul 9 17:22:46 2022 -0400

    General: Always show sidebar
    
    Always show the sidebar, and remove the setting to hide it.
    For windows narrower than 600px, we fold the sidebar.

 data/org.gnome.nautilus.gschema.xml  |  5 ---
 src/nautilus-application.c           | 60 ------------------------------------
 src/nautilus-global-preferences.h    |  1 -
 src/nautilus-window.c                | 32 -------------------
 src/nautilus-window.h                |  2 --
 src/resources/ui/nautilus-toolbar.ui |  4 ---
 src/resources/ui/nautilus-window.ui  |  1 -
 7 files changed, 105 deletions(-)
---
diff --git a/data/org.gnome.nautilus.gschema.xml b/data/org.gnome.nautilus.gschema.xml
index 39a8ed753..7dbacbee1 100644
--- a/data/org.gnome.nautilus.gschema.xml
+++ b/data/org.gnome.nautilus.gschema.xml
@@ -261,10 +261,5 @@
       <summary>Show location bar in new windows</summary>
       <description>If set to true, newly opened windows will have the location bar visible.</description>
     </key>
-    <key type="b" name="start-with-sidebar">
-      <default>true</default>
-      <summary>Show side pane in new windows</summary>
-      <description>If set to true, newly opened windows will have the side pane visible.</description>
-    </key>
   </schema>
 </schemalist>
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 77fd7d045..fc5479587 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -812,29 +812,6 @@ action_quit (GSimpleAction *action,
     g_list_free (windows);
 }
 
-static void
-action_show_hide_sidebar (GObject    *object,
-                          GParamSpec *pspec,
-                          gpointer   *user_data)
-{
-    GList *window, *windows;
-    GVariant *state = g_action_get_state (G_ACTION (object));
-
-    windows = gtk_application_get_windows (GTK_APPLICATION (user_data));
-
-    for (window = windows; window != NULL; window = window->next)
-    {
-        if (g_variant_get_boolean (state))
-        {
-            nautilus_window_show_sidebar (window->data);
-        }
-        else
-        {
-            nautilus_window_hide_sidebar (window->data);
-        }
-    }
-}
-
 static void
 action_show_help_overlay (GSimpleAction *action,
                           GVariant      *state,
@@ -846,29 +823,11 @@ action_show_help_overlay (GSimpleAction *action,
     g_action_group_activate_action (G_ACTION_GROUP (window), "show-help-overlay", NULL);
 }
 
-static gboolean
-variant_get_mapping (GValue   *value,
-                     GVariant *variant,
-                     gpointer  user_data)
-{
-    g_value_set_variant (value, variant);
-    return TRUE;
-}
-
-static GVariant *
-variant_set_mapping (const GValue       *value,
-                     const GVariantType *expected_type,
-                     gpointer            user_data)
-{
-    return g_value_get_variant (value);
-}
-
 const static GActionEntry app_entries[] =
 {
     { "new-window", action_new_window, NULL, NULL, NULL },
     { "clone-window", action_clone_window, NULL, NULL, NULL },
     { "preferences", action_preferences, NULL, NULL, NULL },
-    { "show-hide-sidebar", NULL, NULL, "true", NULL },
     { "about", action_about, NULL, NULL, NULL },
     { "help", action_help, NULL, NULL, NULL },
     { "quit", action_quit, NULL, NULL, NULL },
@@ -879,36 +838,17 @@ const static GActionEntry app_entries[] =
 static void
 nautilus_init_application_actions (NautilusApplication *app)
 {
-    GAction *sidebar_action;
-
     g_action_map_add_action_entries (G_ACTION_MAP (app),
                                      app_entries, G_N_ELEMENTS (app_entries),
                                      app);
 
 
-    sidebar_action = g_action_map_lookup_action (G_ACTION_MAP (app),
-                                                 "show-hide-sidebar");
-    g_signal_connect (sidebar_action,
-                      "notify::state",
-                      G_CALLBACK (action_show_hide_sidebar),
-                      app);
-    g_settings_bind_with_mapping (nautilus_window_state,
-                                  NAUTILUS_WINDOW_STATE_START_WITH_SIDEBAR,
-                                  sidebar_action,
-                                  "state",
-                                  G_SETTINGS_BIND_DEFAULT,
-                                  variant_get_mapping,
-                                  variant_set_mapping,
-                                  NULL, NULL);
-
     nautilus_application_set_accelerator (G_APPLICATION (app),
                                           "app.clone-window", "<Primary>n");
     nautilus_application_set_accelerator (G_APPLICATION (app),
                                           "app.help", "F1");
     nautilus_application_set_accelerator (G_APPLICATION (app),
                                           "app.quit", "<Primary>q");
-    nautilus_application_set_accelerator (G_APPLICATION (app),
-                                          "app.show-hide-sidebar", "F9");
 }
 
 static void
diff --git a/src/nautilus-global-preferences.h b/src/nautilus-global-preferences.h
index c5a7b6b5c..53374aaef 100644
--- a/src/nautilus-global-preferences.h
+++ b/src/nautilus-global-preferences.h
@@ -57,7 +57,6 @@ typedef enum
 #define NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY         "always-use-location-entry"
 
 /* Which views should be displayed for new windows */
-#define NAUTILUS_WINDOW_STATE_START_WITH_SIDEBAR               "start-with-sidebar"
 #define NAUTILUS_WINDOW_STATE_INITIAL_SIZE                     "initial-size"
 #define NAUTILUS_WINDOW_STATE_MAXIMIZED                                "maximized"
 #define NAUTILUS_WINDOW_STATE_SIDEBAR_WIDTH                    "sidebar-width"
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 675c32613..e3bb58c91 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1068,27 +1068,6 @@ nautilus_window_set_up_sidebar (NautilusWindow *window)
                       G_CALLBACK (places_sidebar_drag_perform_drop_cb), window);
 }
 
-void
-nautilus_window_hide_sidebar (NautilusWindow *window)
-{
-    DEBUG ("Called hide_sidebar()");
-
-    g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
-    gtk_widget_hide (window->places_sidebar);
-}
-
-void
-nautilus_window_show_sidebar (NautilusWindow *window)
-{
-    DEBUG ("Called show_sidebar()");
-
-    g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
-    gtk_widget_show (window->places_sidebar);
-    setup_side_pane_width (window);
-}
-
 void
 nautilus_window_slot_close (NautilusWindow     *window,
                             NautilusWindowSlot *slot)
@@ -1609,8 +1588,6 @@ static void
 nautilus_window_initialize_actions (NautilusWindow *window)
 {
     GApplication *app;
-    GAction *action;
-    GVariant *state;
     gchar detailed_action[80];
     gchar accel[80];
     gint i;
@@ -1658,15 +1635,6 @@ nautilus_window_initialize_actions (NautilusWindow *window)
     }
 
 #undef ACCELS
-
-    action = g_action_map_lookup_action (G_ACTION_MAP (app), "show-hide-sidebar");
-    state = g_action_get_state (action);
-    if (g_variant_get_boolean (state))
-    {
-        nautilus_window_show_sidebar (window);
-    }
-
-    g_variant_unref (state);
 }
 
 
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index ed8d6585e..8fba9aad9 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -76,8 +76,6 @@ void                 nautilus_window_slot_close            (NautilusWindow *wind
 
 void                 nautilus_window_sync_location_widgets (NautilusWindow *window);
 
-void     nautilus_window_hide_sidebar         (NautilusWindow *window);
-void     nautilus_window_show_sidebar         (NautilusWindow *window);
 void nautilus_window_reset_menus (NautilusWindow *window);
 
 GtkWidget *         nautilus_window_get_notebook (NautilusWindow *window);
diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui
index 7103e4423..e9ab53edd 100644
--- a/src/resources/ui/nautilus-toolbar.ui
+++ b/src/resources/ui/nautilus-toolbar.ui
@@ -62,10 +62,6 @@
         <attribute name="label" translatable="yes">Show _Hidden Files</attribute>
         <attribute name="action">view.show-hidden-files</attribute>
       </item>
-      <item>
-        <attribute name="label" translatable="yes">Show _Sidebar</attribute>
-        <attribute name="action">app.show-hide-sidebar</attribute>
-      </item>
     </section>
     <section>
       <item>
diff --git a/src/resources/ui/nautilus-window.ui b/src/resources/ui/nautilus-window.ui
index 2242e0ef6..a5c9a836e 100644
--- a/src/resources/ui/nautilus-window.ui
+++ b/src/resources/ui/nautilus-window.ui
@@ -48,7 +48,6 @@
                 <property name="hexpand">True</property>
                 <child>
                   <object class="NautilusGtkPlacesSidebar" id="places_sidebar">
-                    <property name="visible">False</property>
                     <property name="vexpand">True</property>
                     <property name="show-other-locations">True</property>
                     <property name="show-starred-location">True</property>


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