[gtk/wip/otte/shortcut] accelgroup: Remove unneeded APIs



commit 6016bc6098595273cf61d32ff30fbdbc346f2655
Author: Benjamin Otte <otte redhat com>
Date:   Fri Aug 17 06:43:27 2018 +0200

    accelgroup: Remove unneeded APIs
    
    After the removal of GtkAccelMap, these things are no longer necessary.

 docs/reference/gtk/gtk4-sections.txt |   4 -
 gtk/gtkaccelgroup.c                  | 139 -----------------------------------
 gtk/gtkaccelgroup.h                  |   9 ---
 gtk/gtkaccelgroupprivate.h           |   2 -
 4 files changed, 154 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 0de3609217..5b6ad65a6e 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -66,11 +66,7 @@ GtkAccelGroupFindFunc
 gtk_accel_group_disconnect
 gtk_accel_group_disconnect_key
 gtk_accel_group_activate
-gtk_accel_group_lock
-gtk_accel_group_unlock
-gtk_accel_group_get_is_locked
 gtk_accel_group_from_accel_closure
-gtk_accel_group_get_modifier_mask
 gtk_accel_groups_activate
 gtk_accel_groups_from_object
 gtk_accel_group_find
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 0fab562d1e..8bbaa4d778 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -57,10 +57,6 @@
 
 /* --- prototypes --- */
 static void gtk_accel_group_finalize     (GObject    *object);
-static void gtk_accel_group_get_property (GObject    *object,
-                                          guint       param_id,
-                                          GValue     *value,
-                                          GParamSpec *pspec);
 static void accel_closure_invalidate     (gpointer    data,
                                           GClosure   *closure);
 
@@ -71,15 +67,6 @@ static guint  signal_accel_changed       = 0;
 static guint  quark_acceleratable_groups = 0;
 static guint  default_accel_mod_mask     = 0;
 
-enum {
-  PROP_0,
-  PROP_IS_LOCKED,
-  PROP_MODIFIER_MASK,
-  N_PROPERTIES
-};
-
-static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };
-
 G_DEFINE_TYPE_WITH_PRIVATE (GtkAccelGroup, gtk_accel_group, G_TYPE_OBJECT)
 
 
@@ -92,29 +79,9 @@ gtk_accel_group_class_init (GtkAccelGroupClass *class)
   quark_acceleratable_groups = g_quark_from_static_string ("gtk-acceleratable-accel-groups");
 
   object_class->finalize = gtk_accel_group_finalize;
-  object_class->get_property = gtk_accel_group_get_property;
 
   class->accel_changed = NULL;
 
-  obj_properties [PROP_IS_LOCKED] =
-    g_param_spec_boolean ("is-locked",
-                          "Is locked",
-                          "Is the accel group locked",
-                          FALSE,
-                          G_PARAM_READABLE);
-
-  obj_properties [PROP_MODIFIER_MASK] =
-    g_param_spec_flags ("modifier-mask",
-                        "Modifier Mask",
-                        "Modifier Mask",
-                        GDK_TYPE_MODIFIER_TYPE,
-                        gtk_accelerator_get_default_mod_mask (),
-                        G_PARAM_READABLE);
-
-   g_object_class_install_properties (object_class,
-                                      N_PROPERTIES,
-                                      obj_properties);
-
   /**
    * GtkAccelGroup::accel-activate:
    * @accel_group: the #GtkAccelGroup which received the signal
@@ -186,28 +153,6 @@ gtk_accel_group_finalize (GObject *object)
   G_OBJECT_CLASS (gtk_accel_group_parent_class)->finalize (object);
 }
 
-static void
-gtk_accel_group_get_property (GObject    *object,
-                              guint       param_id,
-                              GValue     *value,
-                              GParamSpec *pspec)
-{
-  GtkAccelGroup *accel_group = GTK_ACCEL_GROUP (object);
-
-  switch (param_id)
-    {
-    case PROP_IS_LOCKED:
-      g_value_set_boolean (value, accel_group->priv->lock_count > 0);
-      break;
-    case PROP_MODIFIER_MASK:
-      g_value_set_flags (value, accel_group->priv->modifier_mask);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
-      break;
-    }
-}
-
 static void
 gtk_accel_group_init (GtkAccelGroup *accel_group)
 {
@@ -216,8 +161,6 @@ gtk_accel_group_init (GtkAccelGroup *accel_group)
   accel_group->priv = gtk_accel_group_get_instance_private (accel_group);
   priv = accel_group->priv;
 
-  priv->lock_count = 0;
-  priv->modifier_mask = gtk_accelerator_get_default_mod_mask ();
   priv->acceleratables = NULL;
   priv->n_accels = 0;
   priv->priv_accels = NULL;
@@ -236,41 +179,6 @@ gtk_accel_group_new (void)
   return g_object_new (GTK_TYPE_ACCEL_GROUP, NULL);
 }
 
-/**
- * gtk_accel_group_get_is_locked:
- * @accel_group: a #GtkAccelGroup
- *
- * Locks are added and removed using gtk_accel_group_lock() and
- * gtk_accel_group_unlock().
- *
- * Returns: %TRUE if there are 1 or more locks on the @accel_group,
- *     %FALSE otherwise.
- */
-gboolean
-gtk_accel_group_get_is_locked (GtkAccelGroup *accel_group)
-{
-  g_return_val_if_fail (GTK_IS_ACCEL_GROUP (accel_group), FALSE);
-
-  return accel_group->priv->lock_count > 0;
-}
-
-/**
- * gtk_accel_group_get_modifier_mask:
- * @accel_group: a #GtkAccelGroup
- *
- * Gets a #GdkModifierType representing the mask for this
- * @accel_group. For example, #GDK_CONTROL_MASK, #GDK_SHIFT_MASK, etc.
- *
- * Returns: the modifier mask for this accel group.
- */
-GdkModifierType
-gtk_accel_group_get_modifier_mask (GtkAccelGroup *accel_group)
-{
-  g_return_val_if_fail (GTK_IS_ACCEL_GROUP (accel_group), 0);
-
-  return accel_group->priv->modifier_mask;
-}
-
 static void
 accel_group_weak_ref_detach (GSList  *free_list,
                              GObject *stale_object)
@@ -392,53 +300,6 @@ gtk_accel_group_find (GtkAccelGroup         *accel_group,
   return key;
 }
 
-/**
- * gtk_accel_group_lock:
- * @accel_group: a #GtkAccelGroup
- *
- * Locks the given accelerator group.
- *
- * Locking an acelerator group prevents the accelerators contained
- * within it to be changed during runtime. Refer to
- * gtk_accel_map_change_entry() about runtime accelerator changes.
- *
- * If called more than once, @accel_group remains locked until
- * gtk_accel_group_unlock() has been called an equivalent number
- * of times.
- */
-void
-gtk_accel_group_lock (GtkAccelGroup *accel_group)
-{
-  g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
-
-  accel_group->priv->lock_count += 1;
-
-  if (accel_group->priv->lock_count == 1) {
-    /* State change from unlocked to locked */
-    g_object_notify_by_pspec (G_OBJECT (accel_group), obj_properties[PROP_IS_LOCKED]);
-  }
-}
-
-/**
- * gtk_accel_group_unlock:
- * @accel_group: a #GtkAccelGroup
- *
- * Undoes the last call to gtk_accel_group_lock() on this @accel_group.
- */
-void
-gtk_accel_group_unlock (GtkAccelGroup *accel_group)
-{
-  g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
-  g_return_if_fail (accel_group->priv->lock_count > 0);
-
-  accel_group->priv->lock_count -= 1;
-
-  if (accel_group->priv->lock_count < 1) {
-    /* State change from locked to unlocked */
-    g_object_notify_by_pspec (G_OBJECT (accel_group), obj_properties[PROP_IS_LOCKED]);
-  }
-}
-
 static void
 accel_closure_invalidate (gpointer  data,
                           GClosure *closure)
diff --git a/gtk/gtkaccelgroup.h b/gtk/gtkaccelgroup.h
index 592ec35aa2..73c4fc1d40 100644
--- a/gtk/gtkaccelgroup.h
+++ b/gtk/gtkaccelgroup.h
@@ -140,15 +140,6 @@ GType          gtk_accel_group_get_type           (void) G_GNUC_CONST;
 GDK_AVAILABLE_IN_ALL
 GtkAccelGroup* gtk_accel_group_new               (void);
 GDK_AVAILABLE_IN_ALL
-gboolean       gtk_accel_group_get_is_locked      (GtkAccelGroup  *accel_group);
-GDK_AVAILABLE_IN_ALL
-GdkModifierType 
-               gtk_accel_group_get_modifier_mask  (GtkAccelGroup  *accel_group);
-GDK_AVAILABLE_IN_ALL
-void          gtk_accel_group_lock               (GtkAccelGroup  *accel_group);
-GDK_AVAILABLE_IN_ALL
-void          gtk_accel_group_unlock             (GtkAccelGroup  *accel_group);
-GDK_AVAILABLE_IN_ALL
 void          gtk_accel_group_connect            (GtkAccelGroup  *accel_group,
                                                   guint           accel_key,
                                                   GdkModifierType accel_mods,
diff --git a/gtk/gtkaccelgroupprivate.h b/gtk/gtkaccelgroupprivate.h
index 141b2bfc3d..d3f6004e05 100644
--- a/gtk/gtkaccelgroupprivate.h
+++ b/gtk/gtkaccelgroupprivate.h
@@ -27,8 +27,6 @@ G_BEGIN_DECLS
 
 struct _GtkAccelGroupPrivate
 {
-  guint               lock_count;
-  GdkModifierType     modifier_mask;
   GSList             *acceleratables;
   guint               n_accels;
   GtkAccelGroupEntry *priv_accels;


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