[gtk/wip/ebassi/shortcut: 59/85] gtk: Remove accel paths



commit c131839ee57b83f2433ecd26275ec2379ac20644
Author: Benjamin Otte <otte redhat com>
Date:   Fri Aug 17 05:07:32 2018 +0200

    gtk: Remove accel paths
    
    It's an outdated technology now that everybody is using GActionGroups.
    
    If somebody wanted to support changeable shortcuts, they'd need to
    reintroduce it in another way.

 docs/reference/gtk/gtk4-sections.txt |  37 -------------
 gtk/gtkaccelmap.c                    |   2 +-
 gtk/gtkshortcut.h                    |   5 ++
 gtk/gtkwidget.c                      | 100 +----------------------------------
 gtk/gtkwidget.h                      |   4 --
 gtk/gtkwidgetprivate.h               |   8 ++-
 6 files changed, 13 insertions(+), 143 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index c752cbc0b0..bcd87cb75d 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -1801,42 +1801,6 @@ GTK_MAP_LIST_MODEL_GET_CLASS
 gtk_map_list_model_get_type
 </SECTION>
 
-<SECTION>
-<FILE>gtkmenubutton</FILE>
-<TITLE>GtkMenuButton</TITLE>
-GtkMenuButton
-gtk_menu_button_new
-gtk_menu_button_set_popover
-gtk_menu_button_get_popover
-gtk_menu_button_set_menu_model
-gtk_menu_button_get_menu_model
-GtkArrowType
-gtk_menu_button_set_direction
-gtk_menu_button_get_direction
-gtk_menu_button_set_align_widget
-gtk_menu_button_get_align_widget
-gtk_menu_button_set_icon_name
-gtk_menu_button_get_icon_name
-gtk_menu_button_set_label
-gtk_menu_button_get_label
-gtk_menu_button_set_relief
-gtk_menu_button_get_relief
-gtk_menu_button_popup
-gtk_menu_button_popdown
-GtkMenuButtonCreatePopupFunc
-gtk_menu_button_set_create_popup_func
-<SUBSECTION Standard>
-GTK_TYPE_MENU_BUTTON
-GTK_MENU_BUTTON
-GTK_MENU_BUTTON_CLASS
-GTK_IS_MENU_BUTTON
-GTK_IS_MENU_BUTTON_CLASS
-GTK_MENU_BUTTON_GET_CLASS
-<SUBSECTION Private>
-GtkMenuButtonPrivate
-gtk_menu_button_get_type
-</SECTION>
-
 <SECTION>
 <FILE>gtkmessagedialog</FILE>
 <TITLE>GtkMessageDialog</TITLE>
@@ -4295,7 +4259,6 @@ gtk_widget_class_add_binding
 gtk_widget_class_add_binding_signal
 gtk_widget_add_accelerator
 gtk_widget_remove_accelerator
-gtk_widget_set_accel_path
 gtk_widget_list_accel_closures
 gtk_widget_can_activate_accel
 gtk_widget_event
diff --git a/gtk/gtkaccelmap.c b/gtk/gtkaccelmap.c
index 0dda57104f..1da951cccc 100644
--- a/gtk/gtkaccelmap.c
+++ b/gtk/gtkaccelmap.c
@@ -41,7 +41,7 @@
  * SECTION:gtkaccelmap
  * @Short_description: Loadable keyboard accelerator specifications
  * @Title: Accelerator Maps
- * @See_also: #GtkAccelGroup, #GtkAccelKey, gtk_widget_set_accel_path(), gtk_menu_item_set_accel_path()
+ * @See_also: #GtkAccelGroup, #GtkAccelKey
  *
  * Accelerator maps are used to define runtime configurable accelerators.
  * Functions for manipulating them are are usually used by higher level
diff --git a/gtk/gtkshortcut.h b/gtk/gtkshortcut.h
index 09e8a82cef..8a5e42e69f 100644
--- a/gtk/gtkshortcut.h
+++ b/gtk/gtkshortcut.h
@@ -69,6 +69,11 @@ gboolean        gtk_shortcut_get_mnemonic_activate              (GtkShortcut
 GDK_AVAILABLE_IN_ALL
 void            gtk_shortcut_set_mnemonic_activate              (GtkShortcut            *self,
                                                                  gboolean                mnemonic_activate);
+GDK_AVAILABLE_IN_ALL
+gboolean        gtk_shortcut_get_activate                       (GtkShortcut            *self);
+GDK_AVAILABLE_IN_ALL
+void            gtk_shortcut_set_activate                       (GtkShortcut            *self,
+                                                                 gboolean                activate);
 
 G_END_DECLS
 
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index b91c7b34a7..94f05795be 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -713,7 +713,6 @@ static gpointer         gtk_widget_parent_class = NULL;
 static guint            widget_signals[LAST_SIGNAL] = { 0 };
 GtkTextDirection gtk_default_direction = GTK_TEXT_DIR_LTR;
 
-static GQuark          quark_accel_path = 0;
 static GQuark          quark_accel_closures = 0;
 static GQuark          quark_input_shape_info = 0;
 static GQuark          quark_pango_context = 0;
@@ -887,7 +886,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
   g_type_class_adjust_private_offset (klass, &GtkWidget_private_offset);
   gtk_widget_parent_class = g_type_class_peek_parent (klass);
 
-  quark_accel_path = g_quark_from_static_string ("gtk-accel-path");
   quark_accel_closures = g_quark_from_static_string ("gtk-accel-closures");
   quark_input_shape_info = g_quark_from_static_string ("gtk-input-shape-info");
   quark_pango_context = g_quark_from_static_string ("gtk-pango-context");
@@ -4662,9 +4660,7 @@ widget_new_accel_closure (GtkWidget *widget,
  * The @accel_group needs to be added to the widget’s toplevel via
  * gtk_window_add_accel_group(), and the signal must be of type %G_SIGNAL_ACTION.
  * Accelerators added through this function are not user changeable during
- * runtime. If you want to support accelerators that can be changed by the
- * user, use gtk_accel_map_add_entry() and gtk_widget_set_accel_path() or
- * gtk_menu_item_set_accel_path() instead.
+ * runtime.
  */
 void
 gtk_widget_add_accelerator (GtkWidget      *widget,
@@ -4791,99 +4787,6 @@ gtk_widget_list_accel_closures (GtkWidget *widget)
   return clist;
 }
 
-typedef struct {
-  GQuark         path_quark;
-  GtkAccelGroup *accel_group;
-  GClosure      *closure;
-} AccelPath;
-
-static void
-destroy_accel_path (gpointer data)
-{
-  AccelPath *apath = data;
-
-  gtk_accel_group_disconnect (apath->accel_group, apath->closure);
-
-  /* closures_destroy takes care of unrefing the closure */
-  g_object_unref (apath->accel_group);
-
-  g_slice_free (AccelPath, apath);
-}
-
-
-/**
- * gtk_widget_set_accel_path:
- * @widget: a #GtkWidget
- * @accel_path: (allow-none): path used to look up the accelerator
- * @accel_group: (allow-none): a #GtkAccelGroup.
- *
- * Given an accelerator group, @accel_group, and an accelerator path,
- * @accel_path, sets up an accelerator in @accel_group so whenever the
- * key binding that is defined for @accel_path is pressed, @widget
- * will be activated.  This removes any accelerators (for any
- * accelerator group) installed by previous calls to
- * gtk_widget_set_accel_path(). Associating accelerators with
- * paths allows them to be modified by the user and the modifications
- * to be saved for future use. (See gtk_accel_map_save().)
- *
- * This function is a low level function that would most likely
- * be used by a menu creation system.
- *
- * If you only want to
- * set up accelerators on menu items gtk_menu_item_set_accel_path()
- * provides a somewhat more convenient interface.
- *
- * 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_widget_set_accel_path (GtkWidget     *widget,
-                          const gchar   *accel_path,
-                          GtkAccelGroup *accel_group)
-{
-  AccelPath *apath;
-
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-  g_return_if_fail (GTK_WIDGET_GET_CLASS (widget)->activate_signal != 0);
-
-  if (accel_path)
-    {
-      g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
-      g_return_if_fail (_gtk_accel_path_is_valid (accel_path));
-
-      gtk_accel_map_add_entry (accel_path, 0, 0);
-      apath = g_slice_new (AccelPath);
-      apath->accel_group = g_object_ref (accel_group);
-      apath->path_quark = g_quark_from_string (accel_path);
-      apath->closure = widget_new_accel_closure (widget, GTK_WIDGET_GET_CLASS (widget)->activate_signal);
-    }
-  else
-    apath = NULL;
-
-  /* also removes possible old settings */
-  g_object_set_qdata_full (G_OBJECT (widget), quark_accel_path, apath, destroy_accel_path);
-
-  if (apath)
-    gtk_accel_group_connect_by_path (apath->accel_group, g_quark_to_string (apath->path_quark), 
apath->closure);
-
-  g_signal_emit (widget, widget_signals[ACCEL_CLOSURES_CHANGED], 0);
-}
-
-const gchar*
-_gtk_widget_get_accel_path (GtkWidget *widget,
-                           gboolean  *locked)
-{
-  AccelPath *apath;
-
-  g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
-  apath = g_object_get_qdata (G_OBJECT (widget), quark_accel_path);
-  if (locked)
-    *locked = apath ? gtk_accel_group_get_is_locked (apath->accel_group) : TRUE;
-  return apath ? g_quark_to_string (apath->path_quark) : NULL;
-}
-
 /**
  * gtk_widget_mnemonic_activate:
  * @widget: a #GtkWidget
@@ -7819,7 +7722,6 @@ gtk_widget_real_destroy (GtkWidget *object)
     }
 
   /* wipe accelerator closures (keep order) */
-  g_object_set_qdata (G_OBJECT (widget), quark_accel_path, NULL);
   g_object_set_qdata (G_OBJECT (widget), quark_accel_closures, NULL);
 
   /* Callers of add_mnemonic_label() should disconnect on ::destroy */
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 9ddb5fe22e..88d0e15cc6 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -403,10 +403,6 @@ gboolean   gtk_widget_remove_accelerator  (GtkWidget           *widget,
                                            guint                accel_key,
                                            GdkModifierType      accel_mods);
 GDK_AVAILABLE_IN_ALL
-void       gtk_widget_set_accel_path      (GtkWidget           *widget,
-                                           const gchar         *accel_path,
-                                           GtkAccelGroup       *accel_group);
-GDK_AVAILABLE_IN_ALL
 GList*     gtk_widget_list_accel_closures (GtkWidget           *widget);
 GDK_AVAILABLE_IN_ALL
 gboolean   gtk_widget_can_activate_accel  (GtkWidget           *widget,
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index e3c40873fa..812b4e8748 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -236,8 +236,12 @@ void         _gtk_widget_add_attached_window    (GtkWidget    *widget,
 void         _gtk_widget_remove_attached_window (GtkWidget    *widget,
                                                  GtkWindow    *window);
 
-const gchar*      _gtk_widget_get_accel_path               (GtkWidget *widget,
-                                                            gboolean  *locked);
+void _gtk_widget_get_preferred_size_and_baseline(GtkWidget        *widget,
+                                                GtkRequisition    *minimum_size,
+                                                GtkRequisition    *natural_size,
+                                                gint              *minimum_baseline,
+                                                gint              *natural_baseline);
+
 const GSList *    gtk_widget_class_get_shortcuts           (GtkWidgetClass *widget_class);
 
 AtkObject *       _gtk_widget_peek_accessible              (GtkWidget *widget);


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