summaryrefslogtreecommitdiff
path: root/settings/xfae-model.h
blob: 74ac144b093c0f3627217ef683b178f2ece4d9fb (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/* $Id$ */
/*-
 * Copyright (c) 2005 Benedikt Meurer <benny@xfce.org>
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301 USA.
 */

#ifndef __XFAE_MODEL_H__
#define __XFAE_MODEL_H__

#include <gtk/gtk.h>

G_BEGIN_DECLS;

typedef struct _XfaeModelClass XfaeModelClass;
typedef struct _XfaeModel      XfaeModel;

#define XFAE_TYPE_MODEL             (xfae_model_get_type ())
#define XFAE_MODEL(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFAE_TYPE_MODEL, XfaeModel))
#define XFAE_MODEL_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), XFAE_TYPE_MODEL, XfaeModelClass))
#define XFAE_IS_MODEL(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFAE_TYPE_MODEL))
#define XFAE_IS_MODEL_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), XFAE_TYPE_MODEL))
#define XFAE_MODEL_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), XFAE_TYPE_MODEL, XfaeModelClass))

#define XFSM_TYPE_RUN_HOOK (xfsm_run_hook_get_type ())

/**
 * XfsmRunHook:
 * The trigger / hook on which a specific command should be executed
 **/
typedef enum
{
  XFSM_RUN_HOOK_LOGIN,
  XFSM_RUN_HOOK_LOGOUT,
  XFSM_RUN_HOOK_SHUTDOWN,
  XFSM_RUN_HOOK_RESTART,
  XFSM_RUN_HOOK_SUSPEND,
  XFSM_RUN_HOOK_HIBERNATE,
  XFSM_RUN_HOOK_HYBRID_SLEEP,
  XFSM_RUN_HOOK_SWITCH_USER,
} XfsmRunHook;

GType xfsm_run_hook_get_type (void) G_GNUC_CONST;

/**
 * XfaeModelColumn:
 *
 * Columns exported by the #XfaeModelColumn using
 * the #GtkTreeModel interface.
 **/
typedef enum
{
  XFAE_MODEL_COLUMN_ICON,
  XFAE_MODEL_COLUMN_NAME,
  XFAE_MODEL_COLUMN_ENABLED,
  XFAE_MODEL_COLUMN_REMOVABLE,
  XFAE_MODEL_COLUMN_TOOLTIP,
  XFAE_MODEL_RUN_HOOK,
  XFAE_MODEL_N_COLUMNS,
} XfaeModelColumn;

GType         xfae_model_get_type (void) G_GNUC_CONST;

GtkTreeModel *xfae_model_new      (void);

gboolean      xfae_model_add      (XfaeModel    *model,
                                   const gchar  *name,
                                   const gchar  *description,
                                   const gchar  *command,
                                   XfsmRunHook   run_hook,
                                   GError      **error);

gboolean      xfae_model_get      (XfaeModel    *model,
                                   GtkTreeIter  *iter,
                                   gchar       **name,
                                   gchar       **description,
                                   gchar       **command,
                                   XfsmRunHook  *run_hook,
                                   GError      **error);

gboolean      xfae_model_remove   (XfaeModel    *model,
                                   GtkTreeIter  *iter,
                                   GError      **error);

gboolean      xfae_model_edit     (XfaeModel    *model,
                                   GtkTreeIter  *iter,
                                   const gchar  *name,
                                   const gchar  *description,
                                   const gchar  *command,
                                   XfsmRunHook   run_hook,
                                   GError      **error);

gboolean      xfae_model_toggle   (XfaeModel    *model,
                                   GtkTreeIter  *iter,
                                   GError      **error);

gboolean xfae_model_set_run_hook  (GtkTreeModel *tree_model,
                                   GtkTreePath  *path,
                                   GtkTreeIter  *iter,
                                   XfsmRunHook   run_hook,
                                   GError      **error);

G_END_DECLS;

#endif /* !__XFAE_MODEL_H__ */