run-program: Remove trailing spaces
[anjuta.git] / plugins / snippets-manager / snippet-variables-store.h
blob94afbdfc87952686f66f59e2b6364ce626cb10e6
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3 snippet-variables-store.h
4 Copyright (C) Dragos Dena 2010
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301 USA
22 #ifndef __SNIPPET_VARIABLES_STORE_H__
23 #define __SNIPPET_VARIABLES_STORE_H__
25 #include "snippet.h"
26 #include "snippets-db.h"
27 #include <glib.h>
28 #include <glib-object.h>
29 #include <gtk/gtk.h>
31 G_BEGIN_DECLS
33 typedef struct _SnippetVarsStore SnippetVarsStore;
34 typedef struct _SnippetVarsStorePrivate SnippetVarsStorePrivate;
35 typedef struct _SnippetVarsStoreClass SnippetVarsStoreClass;
37 #define ANJUTA_TYPE_SNIPPET_VARS_STORE (snippet_vars_store_get_type ())
38 #define ANJUTA_SNIPPET_VARS_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ANJUTA_TYPE_SNIPPET_VARS_STORE, SnippetVarsStore))
39 #define ANJUTA_SNIPPET_VARS_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ANJUTA_TYPE_SNIPPET_VARS_STORE, SnippetsVarsStoreClass))
40 #define ANJUTA_IS_SNIPPET_VARS_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ANJUTA_TYPE_SNIPPET_VARS_STORE))
41 #define ANJUTA_IS_SNIPPET_VARS_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ANJUTA_TYPE_SNIPPET_VARS_STORE))
43 typedef enum
45 SNIPPET_VAR_TYPE_LOCAL = 0,
46 SNIPPET_VAR_TYPE_GLOBAL,
47 SNIPPET_VAR_TYPE_ANY
48 } SnippetVariableType;
50 /**
51 * @VARS_STORE_COL_NAME: A #gchar * representing the name of the variable
52 * @VARS_STORE_COL_TYPE: If the variable is global or local. See #SnippetVariableType.
53 * @VARS_STORE_COL_DEFAULT_VALUE: The default value for a local or inserted global variable,
54 * or an empty string.
55 * @VARS_STORE_COL_INSTANT_VALUE: The instant value for a global variable or the default value
56 * for a local variable.
57 * @VARS_STORE_COL_IN_SNIPPET: A #gboolean. If TRUE then the variable is inserted in the snippet.
58 * This is always TRUE for local variables.
59 * @VARS_STORE_COL_UNDEFINED: If the variable type is global and the database doesn't store an entry
60 * for it, this field is TRUE.
62 enum
64 VARS_STORE_COL_NAME = 0,
65 VARS_STORE_COL_TYPE,
66 VARS_STORE_COL_DEFAULT_VALUE,
67 VARS_STORE_COL_INSTANT_VALUE,
68 VARS_STORE_COL_IN_SNIPPET,
69 VARS_STORE_COL_UNDEFINED,
70 VARS_STORE_COL_N
73 struct _SnippetVarsStore
75 GtkListStore parent;
77 /*< private >*/
78 SnippetVarsStorePrivate *priv;
81 struct _SnippetVarsStoreClass
83 GtkListStoreClass parent_class;
87 GType snippet_vars_store_get_type (void) G_GNUC_CONST;
88 SnippetVarsStore * snippet_vars_store_new (void);
90 void snippet_vars_store_load (SnippetVarsStore *vars_store,
91 SnippetsDB *snippets_db,
92 AnjutaSnippet *snippet);
93 void snippet_vars_store_unload (SnippetVarsStore *vars_store);
94 void snippet_vars_store_set_variable_name (SnippetVarsStore *vars_store,
95 const gchar *old_variable_name,
96 const gchar *new_variable_name);
97 void snippet_vars_store_set_variable_type (SnippetVarsStore *vars_store,
98 const gchar *variable_name,
99 SnippetVariableType new_type);
100 void snippet_vars_store_set_variable_default (SnippetVarsStore *vars_store,
101 const gchar *variable_name,
102 const gchar *default_value);
103 void snippet_vars_store_add_variable_to_snippet (SnippetVarsStore *vars_store,
104 const gchar *variable_name,
105 gboolean get_global);
106 void snippet_vars_store_remove_variable_from_snippet (SnippetVarsStore *vars_store,
107 const gchar *variable_name);
108 G_END_DECLS
110 #endif /* __SNIPPET_VARIABLES_STORE_H__ */