Debian Codegraph @

gnome-integration/src/applet-init.c

raw
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 #include "stdlib.h"
21
22 #include "cairo-dock-gio-vfs.h"
23
24 #include "applet-utils.h"
25 #include "applet-init.h"
26
27
28 CD_APPLET_DEFINE_BEGIN ("gnome integration",
29 1, 6, 2,
30 CAIRO_DOCK_CATEGORY_APPLET_SYSTEM,
31 "This applet provides functions for a better integration into a GNOME environnement.\n"
32 "It is auto-activated, so you don't need to activate it.\n"
33 "It is designed for the a GNOME version >= 2.22",
34 "Fabounet (Fabrice Rey)")
35
36 CairoDockDesktopEnvBackend *pVFSBackend = NULL;
37 if (! cairo_dock_fm_vfs_backend_is_defined ()) // the Gnome backend will register the GVFS functions, even if it's not a Gnome environment. It will not overwrite the other functions of the backend, and if another backend comes later, it can set its own functions.
38 {
39 if (cairo_dock_gio_vfs_init ())
40 {
41 cd_debug ("GVFS");
42 pVFSBackend = g_new0 (CairoDockDesktopEnvBackend, 1);
43 cairo_dock_gio_vfs_fill_backend (pVFSBackend);
44 }
45 }
46
47 if (g_iDesktopEnv == CAIRO_DOCK_GNOME && (glib_major_version > 2 || glib_minor_version >= 16))
48 {
49 cd_debug ("GNOME");
50 if (pVFSBackend == NULL)
51 pVFSBackend = g_new0 (CairoDockDesktopEnvBackend, 1);
52
53 pVFSBackend->logout = env_backend_logout;
54 pVFSBackend->shutdown = env_backend_shutdown;
55 pVFSBackend->reboot = env_backend_shutdown;
56 pVFSBackend->lock_screen = env_backend_lock_screen;
57 pVFSBackend->setup_time = env_backend_setup_time;
58 pVFSBackend->show_system_monitor = env_backend_show_system_monitor;
59 }
60
61 if (pVFSBackend != NULL)
62 cairo_dock_fm_register_vfs_backend (pVFSBackend);
63 else
64 return FALSE;
65 CD_APPLET_SET_CONTAINER_TYPE (CAIRO_DOCK_MODULE_IS_PLUGIN);
66 CD_APPLET_DEFINE_END