示例#1
0
static void
shortcuts_accel_cleared_cb (GtkCellRenderer* renderer,
                            const gchar*     tree_path,
                            GtkTreeModel*    model)
{
    GtkTreeIter iter;

    if (gtk_tree_model_get_iter_from_string (model, &iter, tree_path))
    {
        GtkAction* action;
        const gchar* accel_path;
        GtkTreeIter child_iter;
        GtkTreeModel* liststore;

        gtk_tree_model_get (model, &iter, 6, &action, -1);
        accel_path = gtk_action_get_accel_path (action);
        gtk_accel_map_change_entry (accel_path, 0, 0, FALSE);

        gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (model),
                                                        &child_iter, &iter);
        liststore = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (model));
        gtk_list_store_set (GTK_LIST_STORE (liststore),
            &child_iter, 1, 0, 2, 0, -1);

        g_object_unref (action);
    }
}
示例#2
0
static gboolean
shortcuts_hotkey_for_action (GtkAction*   action,
                             GtkAccelKey* key)
{
    const gchar* accel_path = gtk_action_get_accel_path (action);
    if (accel_path)
        if (gtk_accel_map_lookup_entry (accel_path, key))
            return TRUE;

    return FALSE;
}
示例#3
0
static const gchar *
gimp_action_view_get_accel_action (GimpActionView  *view,
                                   const gchar     *path_string,
                                   GtkAction      **action_return,
                                   guint           *action_accel_key,
                                   GdkModifierType *action_accel_mask)
{
  GtkTreeModel *model;
  GtkTreePath  *path;
  GtkTreeIter   iter;

  model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
  if (! model)
    return NULL;

  path = gtk_tree_path_new_from_string (path_string);

  if (gtk_tree_model_get_iter (model, &iter, path))
    {
      GtkAction *action;

      gtk_tree_model_get (model, &iter,
                          GIMP_ACTION_VIEW_COLUMN_ACTION,     &action,
                          GIMP_ACTION_VIEW_COLUMN_ACCEL_KEY,  action_accel_key,
                          GIMP_ACTION_VIEW_COLUMN_ACCEL_MASK, action_accel_mask,
                          -1);

      if (! action)
        goto done;

      gtk_tree_path_free (path);
      g_object_unref (action);

      *action_return = action;

      return gtk_action_get_accel_path (action);
    }

 done:
  gtk_tree_path_free (path);

  return NULL;
}
示例#4
0
static void
windows_actions_update_display_accels (GimpActionGroup *group)
{
  GList *list;
  gint   i;

  for (list = gimp_get_display_iter (group->gimp), i = 0;
       list && i < 10;
       list = g_list_next (list), i++)
    {
      GimpDisplay *display = list->data;
      GtkAction   *action;
      gchar       *action_name;

      if (! gimp_display_get_image (display))
        break;

      action_name = gimp_display_get_action_name (display);

      action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
                                            action_name);
      g_free (action_name);

      if (action)
        {
          const gchar *accel_path;
          guint        accel_key;

          accel_path = gtk_action_get_accel_path (action);

          if (i < 9)
            accel_key = GDK_KEY_1 + i;
          else
            accel_key = GDK_KEY_0;

          gtk_accel_map_change_entry (accel_path,
                                      accel_key, GDK_MOD1_MASK,
                                      TRUE);
        }
    }
}
示例#5
0
const char *
_moo_action_get_accel_path (gpointer action)
{
    g_return_val_if_fail (MOO_IS_ACTION_BASE (action), NULL);
    return gtk_action_get_accel_path (GTK_ACTION (action));
}
示例#6
0
static VALUE
rg_accel_path(VALUE self)
{
    return CSTR2RVAL(gtk_action_get_accel_path(_SELF(self)));
}