summaryrefslogtreecommitdiff
path: root/gtk/inspector/action-holder.c
blob: fafef70c9395c3d5aefcf4b3e46dab4e7bf04843 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

#include "action-holder.h"

struct _ActionHolder {
  GObject instance;

  GActionGroup *group;
  char *name;
};

G_DEFINE_TYPE (ActionHolder, action_holder, G_TYPE_OBJECT)

static void
action_holder_init (ActionHolder *holder)
{
}

static void
action_holder_finalize (GObject *object)
{
  ActionHolder *holder = ACTION_HOLDER (object);

  g_object_unref (holder->group);
  g_free (holder->name);

  G_OBJECT_CLASS (action_holder_parent_class)->finalize (object);
}

static void
action_holder_class_init (ActionHolderClass *class)
{
  GObjectClass *object_class = G_OBJECT_CLASS (class);

  object_class->finalize = action_holder_finalize;
}

ActionHolder *
action_holder_new (GActionGroup *group,
                   const char   *name)
{
  ActionHolder *holder;

  holder = g_object_new (ACTION_TYPE_HOLDER, NULL);

  holder->group = g_object_ref (group);
  holder->name = g_strdup (name);

  return holder;
}

GActionGroup *
action_holder_get_group (ActionHolder *holder)
{
  return holder->group;
}

const char *
action_holder_get_name (ActionHolder *holder)
{
  return holder->name;
}