[gtk/wip/ebassi/shortcut: 172/203] gtk: Remove GtkAccelMap



commit 035da7e3ef9b2cf0fd700a18519d0293da7d67f8
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Feb 6 16:02:44 2020 +0000

    gtk: Remove GtkAccelMap
    
    Now that accel paths are gone, the object managing them isn't needed
    anymore either.

 docs/reference/gtk/gtk4-sections.txt |   32 -
 gtk/gtk.h                            |    1 -
 gtk/gtkaccelgroup.c                  |  101 +---
 gtk/gtkaccelgroup.h                  |    4 -
 gtk/gtkaccelgroupprivate.h           |    2 -
 gtk/gtkaccellabel.c                  |    2 -
 gtk/gtkaccelmap.c                    | 1085 ----------------------------------
 gtk/gtkaccelmap.h                    |  109 ----
 gtk/gtkaccelmapprivate.h             |   39 --
 gtk/gtkapplication.c                 |    1 -
 gtk/gtkmain.c                        |    3 -
 gtk/gtkwidget.c                      |    1 -
 gtk/meson.build                      |    2 -
 13 files changed, 2 insertions(+), 1380 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 17a8a405d5..baa28313b7 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -58,7 +58,6 @@ GtkAccelGroupClass
 gtk_accel_group_new
 GtkAccelFlags
 gtk_accel_group_connect
-gtk_accel_group_connect_by_path
 GtkAccelGroupActivate
 GtkAccelGroupFindFunc
 gtk_accel_group_disconnect
@@ -99,37 +98,6 @@ gtk_accel_group_query
 gtk_accel_group_get_type
 </SECTION>
 
-<SECTION>
-<FILE>gtkaccelmap</FILE>
-<TITLE>Accelerator Maps</TITLE>
-GtkAccelMap
-GtkAccelMapForeach
-gtk_accel_map_add_entry
-gtk_accel_map_lookup_entry
-gtk_accel_map_change_entry
-gtk_accel_map_load
-gtk_accel_map_save
-gtk_accel_map_foreach
-gtk_accel_map_load_fd
-gtk_accel_map_save_fd
-gtk_accel_map_load_scanner
-gtk_accel_map_add_filter
-gtk_accel_map_foreach_unfiltered
-gtk_accel_map_get
-gtk_accel_map_lock_path
-gtk_accel_map_unlock_path
-<SUBSECTION Standard>
-GTK_ACCEL_MAP
-GTK_TYPE_ACCEL_MAP
-GTK_IS_ACCEL_MAP
-GTK_ACCEL_MAP_CLASS
-GTK_IS_ACCEL_MAP_CLASS
-GTK_ACCEL_MAP_GET_CLASS
-GtkAccelMapClass
-<SUBSECTION Private>
-gtk_accel_map_get_type
-</SECTION>
-
 <SECTION>
 <FILE>gtkaccellabel</FILE>
 <TITLE>GtkAccelLabel</TITLE>
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 1baf7dda76..6b58fb36ac 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -34,7 +34,6 @@
 #include <gtk/gtkaboutdialog.h>
 #include <gtk/gtkaccelgroup.h>
 #include <gtk/gtkaccellabel.h>
-#include <gtk/gtkaccelmap.h>
 #include <gtk/gtkaccessible.h>
 #include <gtk/gtkactionable.h>
 #include <gtk/gtkactionbar.h>
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 59f9af2590..e929228976 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -29,7 +29,6 @@
 #include "gtkaccelgroup.h"
 #include "gtkaccelgroupprivate.h"
 #include "gtkaccellabelprivate.h"
-#include "gtkaccelmapprivate.h"
 #include "gtkintl.h"
 #include "gtkmarshalers.h"
 #include "gtkprivate.h"
@@ -176,12 +175,6 @@ gtk_accel_group_finalize (GObject *object)
     {
       GtkAccelGroupEntry *entry = &accel_group->priv->priv_accels[i];
 
-      if (entry->accel_path_quark)
-        {
-          const gchar *accel_path = g_quark_to_string (entry->accel_path_quark);
-
-          _gtk_accel_map_remove_group (accel_path, accel_group);
-        }
       g_closure_remove_invalidate_notifier (entry->closure, accel_group, accel_closure_invalidate);
 
       /* remove quick_accel_add() refcount */
@@ -473,8 +466,7 @@ quick_accel_add (GtkAccelGroup   *accel_group,
                  guint            accel_key,
                  GdkModifierType  accel_mods,
                  GtkAccelFlags    accel_flags,
-                 GClosure        *closure,
-                 GQuark           path_quark)
+                 GClosure        *closure)
 {
   guint pos, i = accel_group->priv->n_accels++;
   GtkAccelGroupEntry key;
@@ -494,16 +486,11 @@ quick_accel_add (GtkAccelGroup   *accel_group,
   accel_group->priv->priv_accels[pos].key.accel_mods = accel_mods;
   accel_group->priv->priv_accels[pos].key.accel_flags = accel_flags;
   accel_group->priv->priv_accels[pos].closure = g_closure_ref (closure);
-  accel_group->priv->priv_accels[pos].accel_path_quark = path_quark;
   g_closure_sink (closure);
 
   /* handle closure invalidation and reverse lookups */
   g_closure_add_invalidate_notifier (closure, accel_group, accel_closure_invalidate);
 
-  /* get accel path notification */
-  if (path_quark)
-    _gtk_accel_map_add_group (g_quark_to_string (path_quark), accel_group);
-
   /* connect and notify changed */
   if (accel_key)
     {
@@ -546,9 +533,6 @@ quick_accel_remove (GtkAccelGroup *accel_group,
                                           G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_CLOSURE,
                                           signal_accel_activate, accel_quark,
                                           closure, NULL, NULL);
-  /* clean up accel path notification */
-  if (entry->accel_path_quark)
-    _gtk_accel_map_remove_group (g_quark_to_string (entry->accel_path_quark), accel_group);
 
   /* physically remove */
   accel_group->priv->n_accels -= 1;
@@ -632,56 +616,7 @@ gtk_accel_group_connect (GtkAccelGroup   *accel_group,
   if (!closure->is_invalid)
     quick_accel_add (accel_group,
                      gdk_keyval_to_lower (accel_key),
-                     accel_mods, accel_flags, closure, 0);
-  g_object_unref (accel_group);
-}
-
-/**
- * gtk_accel_group_connect_by_path:
- * @accel_group: the accelerator group to install an accelerator in
- * @accel_path: path used for determining key and modifiers
- * @closure: closure to be executed upon accelerator activation
- *
- * Installs an accelerator in this group, using an accelerator path
- * to look up the appropriate key and modifiers (see
- * gtk_accel_map_add_entry()). When @accel_group is being activated
- * in response to a call to gtk_accel_groups_activate(), @closure will
- * be invoked if the @accel_key and @accel_mods from
- * gtk_accel_groups_activate() match the key and modifiers for the path.
- *
- * The signature used for the @closure is that of #GtkAccelGroupActivate.
- *
- * Note that @accel_path string will be stored in a #GQuark. Therefore,
- * if you pass a static string, you can save some memory by interning it
- * first with g_intern_static_string().
- */
-void
-gtk_accel_group_connect_by_path (GtkAccelGroup *accel_group,
-                                 const gchar   *accel_path,
-                                 GClosure      *closure)
-{
-  guint accel_key = 0;
-  GdkModifierType accel_mods = 0;
-  GtkAccelKey key;
-
-  g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
-  g_return_if_fail (closure != NULL);
-  g_return_if_fail (_gtk_accel_path_is_valid (accel_path));
-
-  if (closure->is_invalid)
-    return;
-
-  g_object_ref (accel_group);
-
-  if (gtk_accel_map_lookup_entry (accel_path, &key))
-    {
-      accel_key = gdk_keyval_to_lower (key.accel_key);
-      accel_mods = key.accel_mods;
-    }
-
-  quick_accel_add (accel_group, accel_key, accel_mods, GTK_ACCEL_VISIBLE, closure,
-                   g_quark_from_string (accel_path));
-
+                     accel_mods, accel_flags, closure);
   g_object_unref (accel_group);
 }
 
@@ -764,38 +699,6 @@ gtk_accel_group_disconnect_key (GtkAccelGroup   *accel_group,
   return removed_one;
 }
 
-void
-_gtk_accel_group_reconnect (GtkAccelGroup *accel_group,
-                            GQuark         accel_path_quark)
-{
-  GSList *slist, *clist = NULL;
-  guint i;
-
-  g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
-
-  g_object_ref (accel_group);
-
-  for (i = 0; i < accel_group->priv->n_accels; i++)
-    if (accel_group->priv->priv_accels[i].accel_path_quark == accel_path_quark)
-      {
-        GClosure *closure = g_closure_ref (accel_group->priv->priv_accels[i].closure);
-
-        clist = g_slist_prepend (clist, closure);
-      }
-
-  for (slist = clist; slist; slist = slist->next)
-    {
-      GClosure *closure = slist->data;
-
-      gtk_accel_group_disconnect (accel_group, closure);
-      gtk_accel_group_connect_by_path (accel_group, g_quark_to_string (accel_path_quark), closure);
-      g_closure_unref (closure);
-    }
-  g_slist_free (clist);
-
-  g_object_unref (accel_group);
-}
-
 GSList*
 _gtk_accel_group_get_accelerables (GtkAccelGroup *accel_group)
 {
diff --git a/gtk/gtkaccelgroup.h b/gtk/gtkaccelgroup.h
index bdb4d29888..592ec35aa2 100644
--- a/gtk/gtkaccelgroup.h
+++ b/gtk/gtkaccelgroup.h
@@ -155,10 +155,6 @@ void              gtk_accel_group_connect            (GtkAccelGroup  *accel_group,
                                                   GtkAccelFlags   accel_flags,
                                                   GClosure       *closure);
 GDK_AVAILABLE_IN_ALL
-void           gtk_accel_group_connect_by_path    (GtkAccelGroup  *accel_group,
-                                                  const gchar    *accel_path,
-                                                  GClosure       *closure);
-GDK_AVAILABLE_IN_ALL
 gboolean       gtk_accel_group_disconnect        (GtkAccelGroup  *accel_group,
                                                   GClosure       *closure);
 GDK_AVAILABLE_IN_ALL
diff --git a/gtk/gtkaccelgroupprivate.h b/gtk/gtkaccelgroupprivate.h
index e2b166378d..141b2bfc3d 100644
--- a/gtk/gtkaccelgroupprivate.h
+++ b/gtk/gtkaccelgroupprivate.h
@@ -34,8 +34,6 @@ struct _GtkAccelGroupPrivate
   GtkAccelGroupEntry *priv_accels;
 };
 
-void   _gtk_accel_group_reconnect              (GtkAccelGroup          *accel_group,
-                                                 GQuark                  accel_path_quark);
 GSList* _gtk_accel_group_get_accelerables       (GtkAccelGroup          *accel_group);
 
 void    gtk_accelerator_print_label             (GString                *gstring,
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index 3e87ccfa7e..a10668291e 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -29,9 +29,7 @@
 #include <string.h>
 
 #include "gtklabel.h"
-#include "gtkaccellabel.h"
 #include "gtkaccellabelprivate.h"
-#include "gtkaccelmap.h"
 #include "gtkintl.h"
 #include "gtkmain.h"
 #include "gtkprivate.h"
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index a60feee9e5..eab275b5fe 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -37,7 +37,6 @@
 #include "gtkmarshalers.h"
 #include "gtkmain.h"
 #include "gtkrecentmanager.h"
-#include "gtkaccelmapprivate.h"
 #include "gtkicontheme.h"
 #include "gtkbuilder.h"
 #include "gtkshortcutswindow.h"
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 36ec67891d..2ee30ff2f2 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -113,7 +113,6 @@
 
 #include "gtkintl.h"
 
-#include "gtkaccelmapprivate.h"
 #include "gtkbox.h"
 #include "gtkdebug.h"
 #include "gtkdragdestprivate.h"
@@ -667,8 +666,6 @@ do_post_parse_initialization (void)
   gsk_ensure_resources ();
   _gtk_ensure_resources ();
 
-  _gtk_accel_map_init ();
-
   gtk_initialized = TRUE;
 
 #ifdef G_OS_UNIX
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index ad3037dd15..e2e0fe399e 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -26,7 +26,6 @@
 
 #include "gtkwidgetprivate.h"
 
-#include "gtkaccelmapprivate.h"
 #include "gtkaccelgroupprivate.h"
 #include "gtkaccessible.h"
 #include "gtkapplicationprivate.h"
diff --git a/gtk/meson.build b/gtk/meson.build
index 7be7dbff56..fbc2bc80f9 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -149,7 +149,6 @@ gtk_public_sources = files([
   'gtkaboutdialog.c',
   'gtkaccelgroup.c',
   'gtkaccellabel.c',
-  'gtkaccelmap.c',
   'gtkaccessible.c',
   'gtkactionable.c',
   'gtkactionbar.c',
@@ -401,7 +400,6 @@ gtk_public_headers = files([
   'gtkaboutdialog.h',
   'gtkaccelgroup.h',
   'gtkaccellabel.h',
-  'gtkaccelmap.h',
   'gtkaccessible.h',
   'gtkactionable.h',
   'gtkactionbar.h',


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