remove unused header
[poetteringd.git] / utils.h
blobf4313870c66d98f955c9de1dd363fd18ffc784cd
1 /*
2 Copyright 2012 Alexandre Rostovtsev
4 Permission is hereby granted, free of charge, to any person obtaining
5 a copy of this software and associated documentation files (the
6 "Software"), to deal in the Software without restriction, including
7 without limitation the rights to use, copy, modify, merge, publish,
8 distribute, sublicense, and/or sell copies of the Software, and to
9 permit persons to whom the Software is furnished to do so, subject to
10 the following conditions:
12 The above copyright notice and this permission notice shall be
13 included in all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 #ifndef _SHELL_UTILS_H_
25 #define _SHELL_UTILS_H_
27 #include <glib.h>
28 #include <gio/gio.h>
30 typedef struct _ShellParser ShellParser;
32 struct _ShellParser
34 GFile *file;
35 gchar *filename;
36 GList *entry_list;
39 /* Always return TRUE */
40 gboolean
41 _g_match_info_clear (GMatchInfo **match_info);
43 gchar *
44 strstr0 (const char *haystack, const char *needle);
46 void
47 check_polkit_async (const gchar *unique_name,
48 const gchar *action_id,
49 const gboolean user_interaction,
50 GAsyncReadyCallback callback,
51 gpointer user_data);
53 gboolean
54 check_polkit_finish (GAsyncResult *res,
55 GError **error);
57 gchar *
58 shell_source_var (GFile *file,
59 const gchar *variable,
60 GError **error);
62 ShellParser *
63 shell_parser_new (GFile *file,
64 GError **error);
66 ShellParser *
67 shell_parser_new_from_string (GFile *file,
68 gchar *filebuf,
69 GError **error);
71 void
72 shell_parser_free (ShellParser *parser);
74 gboolean
75 shell_parser_is_empty (ShellParser *parser);
77 gboolean
78 shell_parser_set_variable (ShellParser *parser,
79 const gchar *variable,
80 const gchar *value,
81 gboolean add_if_unset);
83 void
84 shell_parser_clear_variable (ShellParser *parser,
85 const gchar *variable);
87 gboolean
88 shell_parser_save (ShellParser *parser,
89 GError **error);
91 gboolean
92 shell_parser_set_and_save (GFile *file,
93 GError **error,
94 const gchar *first_var_name,
95 const gchar *first_alt_var_name,
96 const gchar *first_value,
97 ...);
99 gchar **
100 shell_parser_source_var_list (GFile *file,
101 const gchar * const *var_names,
102 GError **error);
104 void
105 utils_init (void);
107 void
108 utils_destroy (void);
110 #endif