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 "applet-config.h" 21 #include "applet-notifications.h" 22 #include "applet-struct.h" 23 #include "applet-composite-manager.h" 24 #include "applet-init.h" 25 26 27 CD_APPLET_DEFINITION (N_("Composite-Manager"), 28 2, 3, 0, 29 CAIRO_DOCK_CATEGORY_APPLET_DESKTOP, 30 N_("This applet allows you to <b>toggle the composite ON/OFF</b>.\n" 31 "The composite is what allows transparency on the desktop, but it can slow down your PC, especially during games.\n" 32 "<b>Click</b> on the icon to switch the composite ON/OFF. You can define a <b>shortcut</b> for this action.\n" 33 "The applet also lets you acces to some actions of the Window-Manager, from <b>middle-click and the menu</b>.\n" 34 "You can define in the configuration a Window-Manager that will provide the composite, and another as a fallback."), 35 "Fabounet") 36 37 38 CD_APPLET_INIT_BEGIN 39 if (myDesklet) 40 { 41 CD_APPLET_SET_DESKLET_RENDERER ("Simple"); 42 } 43 44 cd_init_wms (); 45 46 CD_APPLET_REGISTER_FOR_CLICK_EVENT; 47 CD_APPLET_REGISTER_FOR_MIDDLE_CLICK_EVENT; 48 CD_APPLET_REGISTER_FOR_BUILD_MENU_EVENT; 49 50 // keyboard events 51 myData.cKeyBinding = CD_APPLET_BIND_KEY (myConfig.cShortcut, 52 D_("Toggle the composite ON/OFF"), 53 "Configuration", "shortkey", 54 (CDBindkeyHandler) cd_on_keybinding_pull); 55 CD_APPLET_INIT_END 56 57 58 CD_APPLET_STOP_BEGIN 59 cd_stop_wms (); 60 61 CD_APPLET_UNREGISTER_FOR_CLICK_EVENT; 62 CD_APPLET_UNREGISTER_FOR_MIDDLE_CLICK_EVENT; 63 CD_APPLET_UNREGISTER_FOR_BUILD_MENU_EVENT; 64 65 // shortkey 66 gldi_object_unref (GLDI_OBJECT(myData.cKeyBinding)); 67 CD_APPLET_STOP_END 68 69 70 CD_APPLET_RELOAD_BEGIN 71 if (CD_APPLET_MY_CONFIG_CHANGED) 72 { 73 if (myDesklet && CD_APPLET_MY_CONTAINER_TYPE_CHANGED) // we are now in a desklet, set a renderer. 74 { 75 CD_APPLET_SET_DESKLET_RENDERER ("Simple"); 76 } 77 78 cd_define_prefered_wms (); 79 80 cd_draw_current_state (); 81 82 gldi_shortkey_rebind (myData.cKeyBinding, myConfig.cShortcut, NULL); 83 } 84 CD_APPLET_RELOAD_END 85