* 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, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
-#include "gtkaccelmap.h"
+#include "gtkaccelmapprivate.h"
#include "gtkmarshalers.h"
-#include "gtkwindow.h" /* in lack of GtkAcceleratable */
+#include "gtkwindowprivate.h"
#include "gtkintl.h"
#include <glib/gstdio.h>
void
_gtk_accel_map_init (void)
{
- g_assert (accel_entry_ht == NULL);
-
- accel_entry_ht = g_hash_table_new (accel_entry_hash, accel_entry_equal);
+ if (accel_entry_ht == NULL)
+ accel_entry_ht = g_hash_table_new (accel_entry_hash, accel_entry_equal);
}
gboolean
* To change the accelerator during runtime programatically, use
* gtk_accel_map_change_entry().
*
+ * Set @accel_key and @accel_mods to 0 to request a removal of
+ * the accelerator.
+ *
* 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().
* gtk_accel_map_lookup_entry:
* @accel_path: a valid accelerator path
* @key: (allow-none) (out): the accelerator key to be filled in (optional)
- * @returns: %TRUE if @accel_path is known, %FALSE otherwise
*
* Looks up the accelerator entry for @accel_path and fills in @key.
+ *
+ * Returns: %TRUE if @accel_path is known, %FALSE otherwise
*/
gboolean
gtk_accel_map_lookup_entry (const gchar *accel_path,
* @accel_key: the new accelerator key
* @accel_mods: the new accelerator modifiers
* @replace: %TRUE if other accelerators may be deleted upon conflicts
- * @returns: %TRUE if the accelerator could be changed, %FALSE otherwise
*
* Changes the @accel_key and @accel_mods currently associated with @accel_path.
* Due to conflicts with other accelerators, a change may not always be possible,
* conflicts. A change will only occur if all conflicts could be resolved (which
* might not be the case if conflicting accelerators are locked). Successful
* changes are indicated by a %TRUE return value.
- *
+ *
* 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
+ * pass a static string, you can save some memory by interning it first with
* g_intern_static_string().
+ *
+ * Returns: %TRUE if the accelerator could be changed, %FALSE otherwise
*/
gboolean
gtk_accel_map_change_entry (const gchar *accel_path,
/**
* gtk_accel_map_load:
- * @file_name: a file containing accelerator specifications,
+ * @file_name: (type filename): a file containing accelerator specifications,
* in the GLib file name encoding
*
* Parses a file previously saved with gtk_accel_map_save() for
/**
* gtk_accel_map_save:
- * @file_name: the name of the file to contain accelerator specifications,
- * in the GLib file name encoding
+ * @file_name: (type filename): the name of the file to contain
+ * accelerator specifications, in the GLib file name encoding
*
* Saves current accelerator specifications (accelerator path, key
* and modifiers) to @file_name.
/**
* gtk_accel_map_foreach:
- * @data: data to be passed into @foreach_func
- * @foreach_func: function to be executed for each accel map entry which
- * is not filtered out
+ * @data: (allow-none): data to be passed into @foreach_func
+ * @foreach_func: (scope call): function to be executed for each accel
+ * map entry which is not filtered out
*
* Loops over the entries in the accelerator map whose accel path
* doesn't match any of the filters added with gtk_accel_map_add_filter(),
/**
* gtk_accel_map_foreach_unfiltered:
* @data: data to be passed into @foreach_func
- * @foreach_func: function to be executed for each accel map entry
+ * @foreach_func: (scope call): function to be executed for each accel
+ * map entry
*
* Loops over all entries in the accelerator map, and execute
* @foreach_func on each. The signature of @foreach_func is that of
*
* Note that locking of individual accelerator paths is independent from
* locking the #GtkAccelGroup containing them. For runtime accelerator
- * changes to be possible both the accelerator path and its #GtkAccelGroup
+ * changes to be possible, both the accelerator path and its #GtkAccelGroup
* have to be unlocked.
*
* Since: 2.4
entry->accel_key,
entry->accel_mods);
}
+
+gchar *
+_gtk_accel_path_for_action (const gchar *action_name,
+ GVariant *parameter)
+{
+ GString *s;
+
+ s = g_string_new ("<GAction>/");
+ g_string_append (s, action_name);
+ if (parameter)
+ {
+ g_string_append_c (s, '/');
+ g_variant_print_string (parameter, s, FALSE);
+ }
+ return g_string_free (s, FALSE);
+}
+