* 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 "gtkwindowprivate.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_foreach:
- * @data: data to be passed into @foreach_func
+ * @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
*
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);
+}
+