[gtk/key-themes: 7/8] Drop key themes



commit 96fa1fb5c1e92b969d2d2861a40ef0757d77af93
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Feb 21 00:58:30 2019 -0500

    Drop key themes
    
    These were an abuse of css, and not very successful
    as a concept. We are going to replace bindings with
    a new way of doing customizable shortcuts.

 gtk/gtk-keys.css.default |   3 -
 gtk/gtk-keys.css.emacs   | 122 ----------------------------
 gtk/gtk-keys.css.mac     | 205 -----------------------------------------------
 gtk/gtkcssprovider.c     | 110 -------------------------
 gtk/gtksettings.c        |  35 --------
 gtk/meson.build          |   9 ---
 6 files changed, 484 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 94b13dd053..42d792ca50 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -898,114 +898,6 @@ parse_color_definition (GtkCssScanner *scanner)
   return TRUE;
 }
 
-static gboolean
-parse_binding_set (GtkCssScanner *scanner)
-{
-  GtkBindingSet *binding_set;
-  char *name;
-
-  gtk_css_scanner_push_section (scanner, GTK_CSS_SECTION_BINDING_SET);
-
-  if (!_gtk_css_parser_try (scanner->parser, "@binding-set", TRUE))
-    {
-      gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_BINDING_SET);
-      return FALSE;
-    }
-
-  name = _gtk_css_parser_try_ident (scanner->parser, TRUE);
-  if (name == NULL)
-    {
-      gtk_css_provider_error_literal (scanner->provider,
-                                      scanner,
-                                      GTK_CSS_PROVIDER_ERROR,
-                                      GTK_CSS_PROVIDER_ERROR_SYNTAX,
-                                      "Expected name for binding set");
-      _gtk_css_parser_resync (scanner->parser, TRUE, 0);
-      goto skip_semicolon;
-    }
-
-  binding_set = gtk_binding_set_find (name);
-  if (!binding_set)
-    {
-      binding_set = gtk_binding_set_new (name);
-      binding_set->parsed = TRUE;
-    }
-  g_free (name);
-
-  if (!_gtk_css_parser_try (scanner->parser, "{", TRUE))
-    {
-      gtk_css_provider_error_literal (scanner->provider,
-                                      scanner,
-                                      GTK_CSS_PROVIDER_ERROR,
-                                      GTK_CSS_PROVIDER_ERROR_SYNTAX,
-                                      "Expected '{' for binding set");
-      _gtk_css_parser_resync (scanner->parser, TRUE, 0);
-      goto skip_semicolon;
-    }
-
-  while (!_gtk_css_parser_is_eof (scanner->parser) &&
-         !_gtk_css_parser_begins_with (scanner->parser, '}'))
-    {
-      name = _gtk_css_parser_read_value (scanner->parser);
-      if (name == NULL)
-        {
-          _gtk_css_parser_resync (scanner->parser, TRUE, '}');
-          continue;
-        }
-
-      if (gtk_binding_entry_add_signal_from_string (binding_set, name) != G_TOKEN_NONE)
-        {
-          gtk_css_provider_error_literal (scanner->provider,
-                                          scanner,
-                                          GTK_CSS_PROVIDER_ERROR,
-                                          GTK_CSS_PROVIDER_ERROR_SYNTAX,
-                                          "Failed to parse binding set.");
-        }
-
-      g_free (name);
-
-      if (!_gtk_css_parser_try (scanner->parser, ";", TRUE))
-        {
-          if (!_gtk_css_parser_begins_with (scanner->parser, '}') &&
-              !_gtk_css_parser_is_eof (scanner->parser))
-            {
-              gtk_css_provider_error_literal (scanner->provider,
-                                              scanner,
-                                              GTK_CSS_PROVIDER_ERROR,
-                                              GTK_CSS_PROVIDER_ERROR_SYNTAX,
-                                              "Expected semicolon");
-              _gtk_css_parser_resync (scanner->parser, TRUE, '}');
-            }
-        }
-    }
-
-  if (!_gtk_css_parser_try (scanner->parser, "}", TRUE))
-    {
-      gtk_css_provider_error_literal (scanner->provider,
-                                      scanner,
-                                      GTK_CSS_PROVIDER_ERROR,
-                                      GTK_CSS_PROVIDER_ERROR_SYNTAX,
-                                      "expected '}' after declarations");
-      if (!_gtk_css_parser_is_eof (scanner->parser))
-        _gtk_css_parser_resync (scanner->parser, FALSE, 0);
-    }
-
-skip_semicolon:
-  if (_gtk_css_parser_begins_with (scanner->parser, ';'))
-    {
-      gtk_css_provider_error_literal (scanner->provider,
-                                      scanner,
-                                      GTK_CSS_PROVIDER_ERROR,
-                                      GTK_CSS_PROVIDER_ERROR_DEPRECATED,
-                                      "Nonstandard semicolon at end of binding set");
-      _gtk_css_parser_try (scanner->parser, ";", TRUE);
-    }
-
-  gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_BINDING_SET);
-
-  return TRUE;
-}
-
 static gboolean
 parse_keyframes (GtkCssScanner *scanner)
 {
@@ -1079,8 +971,6 @@ parse_at_keyword (GtkCssScanner *scanner)
     return;
   if (parse_color_definition (scanner))
     return;
-  if (parse_binding_set (scanner))
-    return;
   if (parse_keyframes (scanner))
     return;
 
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 9c9988e22d..0b70835bbf 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -120,7 +120,6 @@ struct _GtkSettingsPrivate
   GdkDisplay *display;
   GSList *style_cascades;
   GtkCssProvider *theme_provider;
-  GtkCssProvider *key_theme_provider;
   gint font_size;
   gboolean font_size_absolute;
   gchar *font_family;
@@ -149,7 +148,6 @@ enum {
   PROP_SPLIT_CURSOR,
   PROP_THEME_NAME,
   PROP_ICON_THEME_NAME,
-  PROP_KEY_THEME_NAME,
   PROP_DND_DRAG_THRESHOLD,
   PROP_FONT_NAME,
   PROP_XFT_ANTIALIAS,
@@ -215,7 +213,6 @@ static void    settings_update_font_options      (GtkSettings           *setting
 static void    settings_update_font_values       (GtkSettings           *settings);
 static gboolean settings_update_fontconfig       (GtkSettings           *settings);
 static void    settings_update_theme             (GtkSettings           *settings);
-static void    settings_update_key_theme         (GtkSettings           *settings);
 static gboolean settings_update_xsetting         (GtkSettings           *settings,
                                                   GParamSpec            *pspec,
                                                   gboolean               force);
@@ -419,15 +416,6 @@ gtk_settings_class_init (GtkSettingsClass *class)
                                              NULL);
   g_assert (result == PROP_ICON_THEME_NAME);
 
-  result = settings_install_property_parser (class,
-                                             g_param_spec_string ("gtk-key-theme-name",
-                                                                  P_("Key Theme Name"),
-                                                                  P_("Name of key theme to load"),
-                                                                  NULL,
-                                                                  GTK_PARAM_READWRITE),
-                                             NULL);
-  g_assert (result == PROP_KEY_THEME_NAME);
-
   result = settings_install_property_parser (class,
                                              g_param_spec_int ("gtk-dnd-drag-threshold",
                                                                P_("Drag threshold"),
@@ -1040,7 +1028,6 @@ gtk_settings_finalize (GObject *object)
   g_datalist_clear (&priv->queued_settings);
 
   settings_update_provider (priv->display, &priv->theme_provider, NULL);
-  settings_update_provider (priv->display, &priv->key_theme_provider, NULL);
   g_slist_free_full (priv->style_cascades, g_object_unref);
 
   if (priv->font_options)
@@ -1119,7 +1106,6 @@ settings_init_style (GtkSettings *settings)
                                    GTK_STYLE_PROVIDER_PRIORITY_SETTINGS);
 
   settings_update_theme (settings);
-  settings_update_key_theme (settings);
 }
 
 static void
@@ -1300,9 +1286,6 @@ gtk_settings_notify (GObject    *object,
       settings_invalidate_style (settings);
       gtk_style_context_reset_widgets (priv->display);
       break;
-    case PROP_KEY_THEME_NAME:
-      settings_update_key_theme (settings);
-      break;
     case PROP_THEME_NAME:
     case PROP_APPLICATION_PREFER_DARK_THEME:
       settings_update_theme (settings);
@@ -2248,24 +2231,6 @@ settings_update_theme (GtkSettings *settings)
   g_free (theme_variant);
 }
 
-static void
-settings_update_key_theme (GtkSettings *settings)
-{
-  GtkSettingsPrivate *priv = settings->priv;
-  GtkCssProvider *provider = NULL;
-  gchar *key_theme_name;
-
-  g_object_get (settings,
-                "gtk-key-theme-name", &key_theme_name,
-                NULL);
-
-  if (key_theme_name && *key_theme_name)
-    provider = gtk_css_provider_get_named (key_theme_name, "keys");
-
-  settings_update_provider (priv->display, &priv->key_theme_provider, provider);
-  g_free (key_theme_name);
-}
-
 const cairo_font_options_t *
 gtk_settings_get_font_options (GtkSettings *settings)
 {
diff --git a/gtk/meson.build b/gtk/meson.build
index 2e6c813b4a..1d9a38d923 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -1099,13 +1099,4 @@ libgtk_dep = declare_dependency(sources: gtk_dep_sources,
                                 link_with: libgtk,
                                 link_args: common_ldflags)
 
-if quartz_enabled
-  # HACK: install_data() doesn't allow installing under a different name (#1487)
-  # FIXME: or maybe just rename it to gtk-keys.css in the src tree?
-  configure_file(input: 'gtk-keys.css.mac',
-                 output: 'gtk-keys.css',
-                 configuration: configuration_data(),
-                 install_dir: join_paths(get_option('datadir'), 'themes/Mac/gtk-4.0'))
-endif
-
 subdir('tools')


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