| 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 |
#include "string.h" |
| 22 |
|
| 23 |
#include "applet-config.h" |
| 24 |
#include "applet-notifications.h" |
| 25 |
#include "applet-bookmarks.h" |
| 26 |
#include "applet-load-icons.h" |
| 27 |
#include "applet-disk-usage.h" |
| 28 |
#include "applet-struct.h" |
| 29 |
#include "applet-init.h" |
| 30 |
|
| 31 |
|
| 32 |
CD_APPLET_DEFINITION (N_("shortcuts"), |
| 33 |
2, 0, 0, |
| 34 |
CAIRO_DOCK_CATEGORY_APPLET_FILES, |
| 35 |
N_("An applet that let you access quickly to all of your shortcuts.\n" |
| 36 |
"It can manage disks, network points, and Nautilus bookmarks (even if you don't have Nautilus).\n" |
| 37 |
"Drag and drop a folder on the main icon or the sub-dock to add a bookmark.\n" |
| 38 |
"Middle-click on the main icon to show your home folder.\n" |
| 39 |
"Middle-click on a mounting point icon to (un)mount is quickly.\n" |
| 40 |
"The applet can also display valuable information about your disks, like free space, type, etc."), |
| 41 |
"Fabounet (Fabrice Rey) & Jackass (Benjamin SANS)") |
| 42 |
|
| 43 |
|
| 44 |
CD_APPLET_INIT_BEGIN |
| 45 |
//\_______________ get a slot for our private data (for disk usage) |
| 46 |
if (! CD_APPLET_RESERVE_DATA_SLOT ()) |
| 47 |
return; |
| 48 |
|
| 49 |
//\_______________ // set the default icon if none is specified in conf. |
| 50 |
if (myDock) // in desklet, we use the "Slide" view, so we don't display the main icon. |
| 51 |
CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE; |
| 52 |
|
| 53 |
//\_______________ get and load all the icons in a sub-dock. |
| 54 |
cd_shortcuts_start (myApplet); |
| 55 |
|
| 56 |
CD_APPLET_REGISTER_FOR_CLICK_EVENT; |
| 57 |
CD_APPLET_REGISTER_FOR_BUILD_MENU_EVENT; |
| 58 |
CD_APPLET_REGISTER_FOR_MIDDLE_CLICK_EVENT; |
| 59 |
CD_APPLET_REGISTER_FOR_DROP_DATA_EVENT; |
| 60 |
gldi_object_register_notification (&myIconObjectMgr, |
| 61 |
NOTIFICATION_DESTROY, |
| 62 |
(GldiNotificationFunc) cd_shortcuts_free_data, |
| 63 |
GLDI_RUN_AFTER, myApplet); |
| 64 |
CD_APPLET_INIT_END |
| 65 |
|
| 66 |
|
| 67 |
CD_APPLET_STOP_BEGIN |
| 68 |
//\_______________ On se desabonne de nos notifications. |
| 69 |
CD_APPLET_UNREGISTER_FOR_CLICK_EVENT; |
| 70 |
CD_APPLET_UNREGISTER_FOR_BUILD_MENU_EVENT; |
| 71 |
CD_APPLET_UNREGISTER_FOR_MIDDLE_CLICK_EVENT; |
| 72 |
CD_APPLET_UNREGISTER_FOR_DROP_DATA_EVENT; |
| 73 |
gldi_object_remove_notification (&myIconObjectMgr, |
| 74 |
NOTIFICATION_DESTROY, |
| 75 |
(GldiNotificationFunc) cd_shortcuts_free_data, myApplet); |
| 76 |
CD_APPLET_STOP_END |
| 77 |
|
| 78 |
|
| 79 |
CD_APPLET_RELOAD_BEGIN |
| 80 |
//\_______________ On recharge les donnees qui ont pu changer. |
| 81 |
if (CD_APPLET_MY_CONFIG_CHANGED) |
| 82 |
{ |
| 83 |
//\_______________ reset all data (including sub-dock). |
| 84 |
cd_shortcuts_reset_all_datas (myApplet); // stoppe toutes les mesures et remet myData a 0. |
| 85 |
|
| 86 |
//\_______________ // set the default icon if none is specified in conf. |
| 87 |
if (myDock) // in desklet, we use the "Slide" view, so we don't display the main icon. |
| 88 |
CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE; |
| 89 |
|
| 90 |
//\_______________ get and load all the icons in a sub-dock. |
| 91 |
cd_shortcuts_start (myApplet); |
| 92 |
} |
| 93 |
CD_APPLET_RELOAD_END |
| 94 |
|