[gedit] PreferencesDialog: use TeplStyleSchemeChooserWidget to fix several bugs



commit 49db2a666076968cea0c8b66fe96c6b5a9c49648
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Apr 23 13:03:55 2020 +0200

    PreferencesDialog: use TeplStyleSchemeChooserWidget to fix several bugs
    
    This changes the UI for choosing the color/style scheme.
    
    TeplStyleSchemeChooserWidget has a simpler implementation, it's a list
    with just normal GtkLabels containing the name and description of the
    style schemes.
    
    TeplStyleSchemeChooserWidget fixes several bugs:
    - Before, with GtkSourceStyleSchemeChooserWidget, the selected color
    scheme was not scrolled into view. So if e.g. the tango scheme was
    initially selected, when opening the preferences dialog the selected row
    was not visible, we needed to scroll down the list to see that tango was
    selected.
    - The colorful GtkSourceStyleSchemeChooserWidget is actually buggy when
    semi-transparent colors are defined in the style scheme. This happens
    for the gutter (line numbers) background color, when selecting that
    style scheme in the list.

 gedit/gedit-preferences-dialog.c               |  6 ++----
 gedit/resources/ui/gedit-preferences-dialog.ui | 13 +------------
 2 files changed, 3 insertions(+), 16 deletions(-)
---
diff --git a/gedit/gedit-preferences-dialog.c b/gedit/gedit-preferences-dialog.c
index e21fc5ff4..dd626f869 100644
--- a/gedit/gedit-preferences-dialog.c
+++ b/gedit/gedit-preferences-dialog.c
@@ -91,7 +91,6 @@ struct _GeditPreferencesDialog
        GtkWidget       *schemes_list;
        GtkWidget       *install_scheme_button;
        GtkWidget       *uninstall_scheme_button;
-       GtkWidget       *schemes_scrolled_window;
        GtkWidget       *schemes_toolbar;
 
        GeditFileChooserDialog *
@@ -197,7 +196,6 @@ gedit_preferences_dialog_class_init (GeditPreferencesDialogClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GeditPreferencesDialog, font_button);
        gtk_widget_class_bind_template_child (widget_class, GeditPreferencesDialog, font_grid);
        gtk_widget_class_bind_template_child (widget_class, GeditPreferencesDialog, schemes_list);
-       gtk_widget_class_bind_template_child (widget_class, GeditPreferencesDialog, schemes_scrolled_window);
        gtk_widget_class_bind_template_child (widget_class, GeditPreferencesDialog, install_scheme_button);
        gtk_widget_class_bind_template_child (widget_class, GeditPreferencesDialog, uninstall_scheme_button);
        gtk_widget_class_bind_template_child (widget_class, GeditPreferencesDialog, schemes_toolbar);
@@ -862,8 +860,8 @@ setup_font_colors_page_style_scheme_section (GeditPreferencesDialog *dlg)
 
        scheme = get_default_color_scheme (dlg);
 
-       /* junction between the scrolled window and the toolbar */
-       context = gtk_widget_get_style_context (dlg->schemes_scrolled_window);
+       /* junction between the schemes list and the toolbar */
+       context = gtk_widget_get_style_context (dlg->schemes_list);
        gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
        context = gtk_widget_get_style_context (dlg->schemes_toolbar);
        gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
diff --git a/gedit/resources/ui/gedit-preferences-dialog.ui b/gedit/resources/ui/gedit-preferences-dialog.ui
index a4b1566f7..f1eeed45c 100644
--- a/gedit/resources/ui/gedit-preferences-dialog.ui
+++ b/gedit/resources/ui/gedit-preferences-dialog.ui
@@ -630,19 +630,8 @@
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
                     <child>
-                      <object class="GtkScrolledWindow" id="schemes_scrolled_window">
+                      <object class="TeplStyleSchemeChooserWidget" id="schemes_list">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="hexpand">True</property>
-                        <property name="vexpand">True</property>
-                        <property name="shadow_type">etched-in</property>
-                        <property name="min_content_height">200</property>
-                        <child>
-                          <object class="GtkSourceStyleSchemeChooserWidget" id="schemes_list">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                          </object>
-                        </child>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>


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