forked from AuroraMiddleware/gtk
gtk: Remove GtkAccelMap
Now that accel paths are gone, the object managing them isn't needed anymore either.
This commit is contained in:
parent
9b99b89807
commit
bca1f6b64f
@ -361,7 +361,6 @@
|
||||
<xi:include href="xml/gtkmain.xml" />
|
||||
<xi:include href="xml/gtkfeatures.xml" />
|
||||
<xi:include href="xml/gtkaccelgroup.xml" />
|
||||
<xi:include href="xml/gtkaccelmap.xml" />
|
||||
<xi:include href="xml/gtksettings.xml" />
|
||||
<xi:include href="xml/gtkenums.xml" />
|
||||
<xi:include href="xml/gtktesting.xml" />
|
||||
|
@ -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>
|
||||
|
@ -4,7 +4,6 @@
|
||||
gtk_about_dialog_get_type
|
||||
gtk_accel_group_get_type
|
||||
gtk_accel_label_get_type
|
||||
gtk_accel_map_get_type
|
||||
gtk_accessible_get_type
|
||||
gtk_actionable_get_type
|
||||
gtk_action_bar_get_type
|
||||
|
@ -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>
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
|
1086
gtk/gtkaccelmap.c
1086
gtk/gtkaccelmap.c
File diff suppressed because it is too large
Load Diff
@ -1,109 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1998, 2001 Tim Janik
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_ACCEL_MAP_H__
|
||||
#define __GTK_ACCEL_MAP_H__
|
||||
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtkaccelgroup.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* --- global GtkAccelMap object --- */
|
||||
#define GTK_TYPE_ACCEL_MAP (gtk_accel_map_get_type ())
|
||||
#define GTK_ACCEL_MAP(accel_map) (G_TYPE_CHECK_INSTANCE_CAST ((accel_map), GTK_TYPE_ACCEL_MAP, GtkAccelMap))
|
||||
#define GTK_ACCEL_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ACCEL_MAP, GtkAccelMapClass))
|
||||
#define GTK_IS_ACCEL_MAP(accel_map) (G_TYPE_CHECK_INSTANCE_TYPE ((accel_map), GTK_TYPE_ACCEL_MAP))
|
||||
#define GTK_IS_ACCEL_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ACCEL_MAP))
|
||||
#define GTK_ACCEL_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ACCEL_MAP, GtkAccelMapClass))
|
||||
|
||||
typedef struct _GtkAccelMap GtkAccelMap;
|
||||
typedef struct _GtkAccelMapClass GtkAccelMapClass;
|
||||
|
||||
/* --- notifier --- */
|
||||
/**
|
||||
* GtkAccelMapForeach:
|
||||
* @data: User data passed to gtk_accel_map_foreach() or
|
||||
* gtk_accel_map_foreach_unfiltered()
|
||||
* @accel_path: Accel path of the current accelerator
|
||||
* @accel_key: Key of the current accelerator
|
||||
* @accel_mods: Modifiers of the current accelerator
|
||||
* @changed: Changed flag of the accelerator (if %TRUE, accelerator has changed
|
||||
* during runtime and would need to be saved during an accelerator dump)
|
||||
*/
|
||||
typedef void (*GtkAccelMapForeach) (gpointer data,
|
||||
const gchar *accel_path,
|
||||
guint accel_key,
|
||||
GdkModifierType accel_mods,
|
||||
gboolean changed);
|
||||
|
||||
|
||||
/* --- public API --- */
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_accel_map_add_entry (const gchar *accel_path,
|
||||
guint accel_key,
|
||||
GdkModifierType accel_mods);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_accel_map_lookup_entry (const gchar *accel_path,
|
||||
GtkAccelKey *key);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_accel_map_change_entry (const gchar *accel_path,
|
||||
guint accel_key,
|
||||
GdkModifierType accel_mods,
|
||||
gboolean replace);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_accel_map_load (const gchar *file_name);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_accel_map_save (const gchar *file_name);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_accel_map_foreach (gpointer data,
|
||||
GtkAccelMapForeach foreach_func);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_accel_map_load_fd (gint fd);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_accel_map_load_scanner (GScanner *scanner);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_accel_map_save_fd (gint fd);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_accel_map_lock_path (const gchar *accel_path);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_accel_map_unlock_path (const gchar *accel_path);
|
||||
|
||||
/* --- filter functions --- */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_accel_map_add_filter (const gchar *filter_pattern);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_accel_map_foreach_unfiltered (gpointer data,
|
||||
GtkAccelMapForeach foreach_func);
|
||||
|
||||
/* --- notification --- */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_accel_map_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkAccelMap *gtk_accel_map_get (void);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccelMap, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_ACCEL_MAP_H__ */
|
@ -1,39 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1998, 2001 Tim Janik
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_ACCEL_MAP_PRIVATE_H__
|
||||
#define __GTK_ACCEL_MAP_PRIVATE_H__
|
||||
|
||||
|
||||
#include <gtk/gtkaccelmap.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_accel_map_init (void);
|
||||
|
||||
void _gtk_accel_map_add_group (const gchar *accel_path,
|
||||
GtkAccelGroup *accel_group);
|
||||
void _gtk_accel_map_remove_group (const gchar *accel_path,
|
||||
GtkAccelGroup *accel_group);
|
||||
gboolean _gtk_accel_path_is_valid (const gchar *accel_path);
|
||||
|
||||
gchar * _gtk_accel_path_for_action (const gchar *action_name,
|
||||
GVariant *parameter);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_ACCEL_MAP_PRIVATE_H__ */
|
@ -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"
|
||||
|
@ -114,7 +114,6 @@
|
||||
|
||||
#include "gtkintl.h"
|
||||
|
||||
#include "gtkaccelmapprivate.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkdropprivate.h"
|
||||
@ -663,8 +662,6 @@ do_post_parse_initialization (void)
|
||||
gsk_ensure_resources ();
|
||||
_gtk_ensure_resources ();
|
||||
|
||||
_gtk_accel_map_init ();
|
||||
|
||||
gtk_initialized = TRUE;
|
||||
|
||||
#ifdef G_OS_UNIX
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
#include "gtkaccelmapprivate.h"
|
||||
#include "gtkaccelgroupprivate.h"
|
||||
#include "gtkaccessible.h"
|
||||
#include "gtkapplicationprivate.h"
|
||||
|
@ -150,7 +150,6 @@ gtk_public_sources = files([
|
||||
'gtkaboutdialog.c',
|
||||
'gtkaccelgroup.c',
|
||||
'gtkaccellabel.c',
|
||||
'gtkaccelmap.c',
|
||||
'gtkaccessible.c',
|
||||
'gtkactionable.c',
|
||||
'gtkactionbar.c',
|
||||
@ -404,7 +403,6 @@ gtk_public_headers = files([
|
||||
'gtkaboutdialog.h',
|
||||
'gtkaccelgroup.h',
|
||||
'gtkaccellabel.h',
|
||||
'gtkaccelmap.h',
|
||||
'gtkaccessible.h',
|
||||
'gtkactionable.h',
|
||||
'gtkactionbar.h',
|
||||
|
Loading…
Reference in New Issue
Block a user