1 /*
2 * This file is a part of the Cairo-Dock project
3 *
4 * Copyright : (C) see the 'copyright' file.
5 * E-mail    : see the 'copyright' file.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * 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, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef __CAIRO_DOCK_UTILS__
21 #define  __CAIRO_DOCK_UTILS__
22 G_BEGIN_DECLS
23 
24 /**
25 *@file cairo-dock-utils.h Some helper functions.
26 */
27 
28 
29 gchar *cairo_dock_generate_unique_filename (const gchar *cBaseName, const gchar *cCairoDockDataDir);
30 
31 gchar *cairo_dock_cut_string (const gchar *cString, int iNbCaracters);;
32 
33 /** Remove the version number from a string. Directly modifies the string.
34  * @param cString a string.
35  * @return TRUE if a version has been removed.
36  */
37 gboolean cairo_dock_remove_version_from_string (gchar *cString);
38 
39 /** Replace the %20 by normal spaces into the string. The string is directly modified.
40 *@param cString the string (it can't be a constant string)
41 */
42 void cairo_dock_remove_html_spaces (gchar *cString);
43 
44 /** Get the 3 version numbers of a string.
45 *@param cVersionString the string of the form "x.y.z".
46 *@param iMajorVersion pointer to the major version.
47 *@param iMinorVersion pointer to the minor version.
48 *@param iMicroVersion pointer to the micro version.
49 */
50 void cairo_dock_get_version_from_string (const gchar *cVersionString, int *iMajorVersion, int *iMinorVersion, int *iMicroVersion);
51 
52 /** Say if a string is an adress (file://xxx, http://xxx, ftp://xxx, etc).
53 * @param cString a string.
54 * @return TRUE if it's an address.
55 */
56 gboolean cairo_dock_string_is_address (const gchar *cString);
57 #define cairo_dock_string_is_adress cairo_dock_string_is_address
58 
59 gboolean cairo_dock_string_contains (const char *cNames, const gchar *cName, const gchar *separators);
60 
61 
62 gchar *cairo_dock_launch_command_sync_with_stderr (const gchar *cCommand, gboolean bPrintStdErr);
63 #define cairo_dock_launch_command_sync(cCommand) cairo_dock_launch_command_sync_with_stderr (cCommand, TRUE)
64 
65 gboolean cairo_dock_launch_command_printf (const gchar *cCommandFormat, const gchar *cWorkingDirectory, ...) G_GNUC_PRINTF (1, 3);
66 gboolean cairo_dock_launch_command_full (const gchar *cCommand, const gchar *cWorkingDirectory);
67 #define cairo_dock_launch_command(cCommand) cairo_dock_launch_command_full (cCommand, NULL)
68 
69 /** Get the command to launch the default terminal
70  */
71 const gchar * cairo_dock_get_default_terminal (void);
72 /** Get the command to launch another one from a terminal
73  * @param cCommand command to launch from a terminal
74  */
75 gchar * cairo_dock_get_command_with_right_terminal (const gchar *cCommand);
76 
77 /* Like g_strcmp0, but saves a function call.
78 */
79 #define gldi_strings_differ(s1, s2) (!s1 ? s2 != NULL : !s2 ? s1 != NULL : strcmp(s1, s2) != 0)
80 #define cairo_dock_strings_differ gldi_strings_differ
81 
82 
83 #include "gldi-config.h"
84 #ifdef HAVE_X11
85 
86 gboolean cairo_dock_property_is_present_on_root (const gchar *cPropertyName);  // env-manager
87 
88 gboolean cairo_dock_check_xrandr (int major, int minor);  // showDesktop
89 
90 #endif
91 
92 G_END_DECLS
93 #endif
94 
95