[Top][All Lists]

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

Re: [Denemo-devel] Keybinding modifications and Print from selection

From: Richard Shann
Subject: Re: [Denemo-devel] Keybinding modifications and Print from selection
Date: Thu, 12 Jun 2008 09:23:35 +0100

> I am fairly sure it is really easy
> to manage the labels ourselves, and to stop using accelerators

This was even easier than I thought.
I've added label update to all the proxy widgets of an action using this
code: (I've done it in help_and_set_...() but it needs to be done within
add_keybinding_from_idx(), of course).

      case SHORTCUT_ADD:
        add_keybinding_from_idx(the_keymap, cb_data.keyval, cb_data.modifiers,
        g_string_assign(str, "");
        keymap_foreach_command_binding (the_keymap, idx, listshortcut,
str);//get the shorcuts with commas separating them into str
        update_labels_for_action(action, str->str);//change the labels of all
the proxy widgets

where the function update_labels_for_action(action, shortcutnames) is

update_labels_for_action(GtkAction *action, gchar *shortcut_names) {
  GSList *h = gtk_action_get_proxies (action);
  for(;h;h=h->next) {
    GtkWidget *widget = h->data;
    GtkWidget *child = gtk_bin_get_child(widget);
    if(GTK_IS_BUTTON(child)) {
      child = gtk_bin_get_child(child);
    if(GTK_IS_LABEL(child)) {
        gchar *base;
        g_object_get(action, "label", &base, NULL);
        gtk_label_set_text(child, g_strdup_printf("%s shortcuts: %s", base,

The nice thing is we get the shortcuts showing on items on toolbars if
we want - where ever an action is invoked.
I put this in my own code because I just wanted to see that it would
work, and I knew I could find all the bits (action, shortcut names) in
that code quickly, as I just wrote it. But as I said in the earlier
email the thing to do is get rid of the function help_and_set... in
favour of the Mangage Keybindings dialog. (Which reminds me, I called
this Manage Shorcuts in the last email - we need a consistent


reply via email to

[Prev in Thread] Current Thread [Next in Thread]