[gedit] replace-open-button: remove OpenDocumentSelector



commit 27f54a9aed82109a512743b5e819b18004c19de7
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Nov 26 07:27:02 2019 +0100

    replace-open-button: remove OpenDocumentSelector
    
    This will be replaced by the previous UI: two buttons, "Open" to open
    the dialog, and an arrow to open the recent menu.
    
    It's a pragmatic decision to simplify the gedit code, because there are
    not enough developers, and too many bugs. Do you prefer a rock-solid
    text editor? Or a text editor with some shiny and non-essential features
    that complexifies the code, at the expense of more bugs? The gedit core
    should have a much smaller code size, with all the essential features
    implemented in libraries.
    
    The OpenDocumentSelector showed only 5 items, while the normal menu can
    show more (10 by default).
    
    The search inside the popover duplicated the search in the file chooser
    dialog. To open a file, one search entry is enough, it avoids a possible
    confusion.
    
    The OpenDocumentSelector showed all recent text files, not just those
    previously opened in gedit. Again, this duplicates the feature present
    in the file chooser dialog. The new simple menu will show only files
    previously opened in gedit, which is IMHO more logical.
    
    There is also the fact that the OpenDocumentSelector used GtkTreeView.
    It is planned at some point in the future that GtkTreeView will be
    removed from GTK. Porting to GtkListBox would be a lot of work.
    
    The full file paths will also be visible with the new simple menu, in
    the statusbar.
    
    GeditOpenDocumentSelector was never adopted by other GNOME apps. gedit
    was the only app with such an open file popover. It takes almost 3000
    lines of code to do so. While the simple menu takes less than 100's (in
    gedit). So the OpenDocumentSelector complicated a lot the code of gedit.

 docs/reference/meson.build                         |    3 -
 gedit/gedit-open-document-selector-helper.c        |  103 --
 gedit/gedit-open-document-selector-helper.h        |  103 --
 gedit/gedit-open-document-selector-store.c         |  820 ------------
 gedit/gedit-open-document-selector-store.h         |   68 -
 gedit/gedit-open-document-selector.c               | 1304 --------------------
 gedit/gedit-open-document-selector.h               |   44 -
 gedit/gedit-window-private.h                       |    3 -
 gedit/gedit-window.c                               |   71 --
 gedit/meson.build                                  |    6 -
 gedit/resources/css/gedit-style.css                |    4 -
 gedit/resources/css/gedit.adwaita.css              |   26 -
 gedit/resources/gedit.gresource.xml.in             |    1 -
 gedit/resources/ui/gedit-open-document-selector.ui |  115 --
 po/POTFILES.in                                     |    2 -
 15 files changed, 2673 deletions(-)
---
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index af40166f2..6fc7d3288 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -51,9 +51,6 @@ libgedit_reference_ignored_h = [
   'gedit-notebook-popup-menu.h',
   'gedit-notebook-stack-switcher.h',
   'gedit-notebook.h',
-  'gedit-open-document-selector-helper.h',
-  'gedit-open-document-selector-store.h',
-  'gedit-open-document-selector.h',
   'gedit-open-menu-button.h',
   'gedit-pango.h',
   'gedit-plugins-engine.h',
diff --git a/gedit/gedit-window-private.h b/gedit/gedit-window-private.h
index 9b8bd0e3e..90eb5a2b3 100644
--- a/gedit/gedit-window-private.h
+++ b/gedit/gedit-window-private.h
@@ -27,7 +27,6 @@
 #include "gedit-message-bus.h"
 #include "gedit-settings.h"
 #include "gedit-multi-notebook.h"
-#include "gedit-open-document-selector.h"
 
 G_BEGIN_DECLS
 
@@ -63,7 +62,6 @@ struct _GeditWindowPrivate
        GtkWidget       *fullscreen_new_button;
        GtkWidget       *fullscreen_open_button;
        GtkWidget       *fullscreen_open_document_popover;
-       GeditOpenDocumentSelector *fullscreen_open_document_selector;
 
        /* statusbar and context ids for statusbar messages */
        GtkWidget      *statusbar;
@@ -87,7 +85,6 @@ struct _GeditWindowPrivate
        GtkWidget       *open_document_popover;
        GtkWidget       *new_button;
        GtkWidget       *open_button;
-       GeditOpenDocumentSelector *open_document_selector;
 
        GtkMenuButton  *gear_button;
 
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index ba61f6936..249d64b29 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -56,7 +56,6 @@
 #include "gedit-settings.h"
 #include "gedit-menu-stack-switcher.h"
 #include "gedit-highlight-mode-selector.h"
-#include "gedit-open-document-selector.h"
 
 #define TAB_WIDTH_DATA "GeditWindowTabWidthData"
 #define FULLSCREEN_ANIMATION_SPEED 500
@@ -782,46 +781,6 @@ update_actions_sensitivity (GeditWindow *window)
                                    window);
 }
 
-static void
-on_recent_chooser_item_activated (GeditOpenDocumentSelector *open_document_selector,
-                                  gchar                     *uri,
-                                  GeditWindow               *window)
-{
-       GFile *location;
-       GeditView *active_view;
-
-       g_return_if_fail (GEDIT_WINDOW (window));
-       g_return_if_fail (GEDIT_OPEN_DOCUMENT_SELECTOR (open_document_selector));
-
-       /* TODO: get_current_file when exists */
-       location = g_file_new_for_uri (uri);
-
-       if (location)
-       {
-               GSList *locations = NULL;
-               GSList *loaded = NULL;
-
-               locations = g_slist_prepend (locations, (gpointer) location);
-               loaded = gedit_commands_load_locations (window, locations, NULL, 0, 0);
-
-               /* if it doesn't contain just 1 element */
-               if (!loaded || loaded->next)
-               {
-                       gedit_recent_remove_if_local (location);
-               }
-
-               g_slist_free (locations);
-               g_slist_free (loaded);
-
-               g_object_unref (location);
-       }
-
-       /* Needed to close the popover when activating the same
-        * document as the current one */
-       active_view = gedit_window_get_active_view (window);
-       gtk_widget_grab_focus (GTK_WIDGET (active_view));
-}
-
 static void
 on_language_selector_shown (GeditHighlightModeSelector *sel,
                             GeditWindow                *window)
@@ -1835,18 +1794,6 @@ fullscreen_controls_setup (GeditWindow *window)
        priv->fullscreen_open_document_popover = gtk_popover_new (priv->fullscreen_open_button);
        gtk_menu_button_set_popover (GTK_MENU_BUTTON (priv->fullscreen_open_button),
                                     priv->fullscreen_open_document_popover);
-
-       window->priv->fullscreen_open_document_selector = gedit_open_document_selector_new (window);
-
-       gtk_container_add (GTK_CONTAINER (priv->fullscreen_open_document_popover),
-                          GTK_WIDGET (priv->fullscreen_open_document_selector));
-
-       gtk_widget_show_all (GTK_WIDGET (priv->fullscreen_open_document_selector));
-
-       g_signal_connect (window->priv->fullscreen_open_document_selector,
-                         "file-activated",
-                         G_CALLBACK (on_recent_chooser_item_activated),
-                         window);
 }
 
 static void
@@ -2757,27 +2704,9 @@ gedit_window_init (GeditWindow *window)
        gtk_menu_button_set_popover (GTK_MENU_BUTTON (window->priv->open_button),
                                     window->priv->open_document_popover);
 
-       window->priv->open_document_selector = gedit_open_document_selector_new (window);
-
-       gtk_container_add (GTK_CONTAINER (window->priv->open_document_popover),
-                          GTK_WIDGET (window->priv->open_document_selector));
-
-       gtk_widget_show_all (GTK_WIDGET (window->priv->open_document_selector));
-
-       g_signal_connect (window->priv->open_document_selector,
-                         "file-activated",
-                         G_CALLBACK (on_recent_chooser_item_activated),
-                         window);
-
        fullscreen_controls_setup (window);
        sync_fullscreen_actions (window, FALSE);
 
-       g_object_bind_property (gedit_open_document_selector_get_search_entry 
(window->priv->open_document_selector),
-                               "text",
-                               gedit_open_document_selector_get_search_entry 
(window->priv->fullscreen_open_document_selector),
-                               "text",
-                               G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
-
        hamburger_menu = _gedit_app_get_hamburger_menu (GEDIT_APP (g_application_get_default ()));
        if (hamburger_menu)
        {
diff --git a/gedit/meson.build b/gedit/meson.build
index 29ddabde5..de9e818ec 100644
--- a/gedit/meson.build
+++ b/gedit/meson.build
@@ -38,9 +38,6 @@ libgedit_private_h = files(
   'gedit-notebook.h',
   'gedit-notebook-popup-menu.h',
   'gedit-notebook-stack-switcher.h',
-  'gedit-open-document-selector.h',
-  'gedit-open-document-selector-helper.h',
-  'gedit-open-document-selector-store.h',
   'gedit-pango.h',
   'gedit-plugins-engine.h',
   'gedit-preferences-dialog.h',
@@ -88,9 +85,6 @@ libgedit_sources = files(
   'gedit-notebook.c',
   'gedit-notebook-popup-menu.c',
   'gedit-notebook-stack-switcher.c',
-  'gedit-open-document-selector.c',
-  'gedit-open-document-selector-helper.c',
-  'gedit-open-document-selector-store.c',
   'gedit-pango.c',
   'gedit-plugins-engine.c',
   'gedit-preferences-dialog.c',
diff --git a/gedit/resources/css/gedit-style.css b/gedit/resources/css/gedit-style.css
index 8c9ef7daa..eb43a8233 100644
--- a/gedit/resources/css/gedit-style.css
+++ b/gedit/resources/css/gedit-style.css
@@ -14,10 +14,6 @@
     padding: 12px;
 }
 
-.open-document-selector-treeview {
-    padding: 3px 6px 3px 6px;
-}
-
 statusbar frame {
     border: none;
     padding-left: 6px;
diff --git a/gedit/resources/css/gedit.adwaita.css b/gedit/resources/css/gedit.adwaita.css
index 1350c3280..784e72aa2 100644
--- a/gedit/resources/css/gedit.adwaita.css
+++ b/gedit/resources/css/gedit.adwaita.css
@@ -1,28 +1,3 @@
-.open-document-selector-treeview:hover {
-    background-color: alpha(@theme_fg_color, 0.05);
-}
-
-.open-document-selector-treeview:selected:hover {
-    background-color: @theme_selected_bg_color;
-}
-
-/* Only normal state is handle */
-.open-document-selector-name-label {
-    color: @theme_fg_color;
-}
-
-/* Only normal state is handle */
-.open-document-selector-path-label {
-    color: @theme_unfocused_fg_color;
-    font-size: smaller;
-}
-
-/* Only normal state is handle */
-.open-document-selector-match {
-    color: shade (@theme_fg_color, 0.6);
-    background-color: alpha(@warning_color, 0.4);
-}
-
 .gedit-document-panel {
     background-color: @sidebar_bg;
 }
@@ -84,4 +59,3 @@ statusbar {
     margin: 2px;
     padding: 2px;
 }
-
diff --git a/gedit/resources/gedit.gresource.xml.in b/gedit/resources/gedit.gresource.xml.in
index 8d6735610..4b2a0a918 100644
--- a/gedit/resources/gedit.gresource.xml.in
+++ b/gedit/resources/gedit.gresource.xml.in
@@ -16,7 +16,6 @@
     <file preprocess="xml-stripblanks">ui/gedit-highlight-mode-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/gedit-highlight-mode-selector.ui</file>
     <file preprocess="xml-stripblanks">ui/gedit-window.ui</file>
-    <file preprocess="xml-stripblanks">ui/gedit-open-document-selector.ui</file>
     <file preprocess="xml-stripblanks">ui/gedit-shortcuts.ui</file>
     <file preprocess="xml-stripblanks">ui/gedit-statusbar.ui</file>
     <file>css/gedit-style.css</file>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 136a3ff4c..2a5c6d53c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -23,7 +23,6 @@ gedit/gedit-highlight-mode-selector.c
 gedit/gedit-io-error-info-bar.c
 gedit/gedit-notebook.c
 gedit/gedit-notebook-popup-menu.c
-gedit/gedit-open-document-selector.c
 gedit/gedit-plugins-engine.c
 gedit/gedit-preferences-dialog.c
 gedit/gedit-print-job.c
@@ -43,7 +42,6 @@ gedit/resources/gtk/menus-traditional.ui
 gedit/resources/ui/gedit-encodings-dialog.ui
 gedit/resources/ui/gedit-highlight-mode-dialog.ui
 gedit/resources/ui/gedit-highlight-mode-selector.ui
-gedit/resources/ui/gedit-open-document-selector.ui
 gedit/resources/ui/gedit-preferences-dialog.ui
 gedit/resources/ui/gedit-print-preferences.ui
 gedit/resources/ui/gedit-print-preview.ui


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