aboutsummaryrefslogtreecommitdiff
path: root/util/fbautostart/include/fbautostart.hh
diff options
context:
space:
mode:
Diffstat (limited to 'util/fbautostart/include/fbautostart.hh')
-rw-r--r--util/fbautostart/include/fbautostart.hh147
1 files changed, 147 insertions, 0 deletions
diff --git a/util/fbautostart/include/fbautostart.hh b/util/fbautostart/include/fbautostart.hh
new file mode 100644
index 0000000..6ce1144
--- /dev/null
+++ b/util/fbautostart/include/fbautostart.hh
@@ -0,0 +1,147 @@
1/*
2 * fbautostart.hh
3 *
4 * This file is part of the Fluxbox Autostart ( fbautostart )
5 * Utility.
6 *
7 * Copyright (C) 2011 by Paul Tagliamonte <paultag@ubuntu.com>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 * THE SOFTWARE.
26 *
27 */
28
29#ifndef _FBAUTOSTART_H
30#define _FBAUTOSTART_H ohai
31
32#define PACKAGE "fbautostart"
33#define PACKAGE_VERSION "2.71828"
34
35#ifndef _DEBUG_MODE
36#define _DEBUG_MODE 0
37#endif
38
39extern const char * _ON_BEHALF_OF;
40extern bool noexec;
41
42#include "dot_desktop.hh"
43
44#define _DEFAULT_XDG_HOME "~/.config"
45#define _DEFAULT_XDG_DIRS "/etc/xdg"
46#define _XDG_AUTOSTART_DIR "/autostart/"
47
48// XXX: Please document these functions better.
49// the @param names need to be fixed up as well.
50// stuff like `foo' or `loc' sucks ass.
51// -PRT
52
53namespace fbautostart {
54
55 /**
56 * Print a help message to the user
57 */
58 void help();
59
60 /**
61 * Lecture the user on correct invocation.
62 */
63 void lecture();
64
65 /**
66 * Print version of fbautostart to stdout.
67 */
68 void version();
69
70 /**
71 * Log an error to stderr.
72 * @param s std::string with the error message
73 */
74 void logError( std::string s );
75
76 /**
77 * Log an error to stderr, to print a single integer.
78 * @param i int to print to stderr
79 */
80 void logError( int i );
81
82 /**
83 * Print the string to the screen if debug mode is enabled.
84 * @param s std::string with the message to print to the screen
85 */
86 void debug( const std::string & s );
87
88 /**
89 * Print a std::vector to the screen if debug mode is enabled.
90 * @param foo std::vector<std::string> to dump
91 */
92 void debug( const std::vector<std::string> & foo );
93
94 /**
95 * Print a size_t to the screen if debug mode is enabled.
96 * @param foo size_t to be printed to the screen
97 */
98 void debug( size_t foo );
99
100 /**
101 * processArgs should only be called by main, and pass the main arguments to processArgs.
102 * @param argc number of arguments in args
103 * @param argv char array of arguments
104 */
105 void processArgs( int argc, char ** args );
106
107 /**
108 * Run a command on the system
109 * @param appl command to run
110 * @return return status of the application
111 */
112 int runCommand( std::string appl );
113
114 /**
115 * Break a line up based on a ":"
116 * @param locs the std::vector to push tokens back into
117 * @param lines to process
118 */
119 void breakupLine( std::vector<std::string> * locs, std::string lines );
120
121 /**
122 * Fix paths with a tilde in them.
123 * @param locs a std::vector of paths to fix up
124 * @param home the home path of the user, absolute
125 */
126 void fixHomePathing( std::vector<std::string> * locs, std::string home );
127
128 /**
129 * Get configuration directories according to the XDG spec.
130 * @param loc std::vector to load up results in
131 * @return returns false if we are unable to complete processing (such as null $HOME)
132 */
133 bool getConfDirs( std::vector<std::string> & loc );
134
135 /**
136 * Get all the .desktop files to process.
137 * @param dirs the directories to search
138 * @param out_files the vector we are loading up
139 * @return if we were able to complete processing with success
140 */
141 bool getDesktopFiles(
142 const std::vector<std::string> & dirs,
143 std::vector<dot_desktop> & out_files
144 );
145}
146
147#endif