~cairo-dock-team/ubuntu/precise/cairo-dock-plug-ins/3.0.0.0rc1

« back to all changes in this revision

Viewing changes to Scooby-Do/src/applet-init.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne, Matthieu Baerts (matttbe), Julien Lavergne
  • Date: 2009-10-05 19:27:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20091005192717-mvqvb395guktr401
Tags: 2.0.9-0ubuntu1
[ Matthieu Baerts (matttbe) ]
* New upstream release (LP: #435590)
* debian/control: 
 - Remove ${shlibs:Depends} for integration plug-ins to avoid
   pulling shared libraries which are detected automatically.
 - Added curl as depends for cairo-dock-plug-ins
* debian/rules:
 - Add --enable-dnd2share and --enable-musicplayer to enable new applets.
 - Remove --enable-rhythmbox and --enable-nvidia to remove those applets,
   not maintained upstream.
* Update *.install to take all generated applets.

[ Julien Lavergne ]
* Adjust changelog with Daniel Holbach suggestions.
* cairo-dock-plug-ins.changelogs:  Install specific changelog for 2.0.9
* Build-depends on cairo-dock-dev (>= 2.0.9)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 "applet-config.h"
 
23
#include "applet-notifications.h"
 
24
#include "applet-struct.h"
 
25
#include "applet-session.h"
 
26
#include "applet-search.h"
 
27
#include "applet-listing.h"
 
28
#include "applet-backend-files.h"
 
29
#include "applet-backend-web.h"
 
30
#include "applet-backend-command.h"
 
31
#include "applet-init.h"
 
32
 
 
33
 
 
34
CD_APPLET_DEFINITION ("Scooby-Do",
 
35
        2, 1, 0,
 
36
        CAIRO_DOCK_CATEGORY_PLUG_IN,
 
37
        N_("A Gnome-Do-like plug-in that lets you control your dock from the keyboard.\n"
 
38
        "It has 2 modes, each one being triggered by a keyboard shortcut:\n"
 
39
        "- the navigation mode : use the arrows to navigate into the docks and sub-docks,\n"
 
40
        "  or type the name of a launcher and press Tab to automatically jump to the next suitable launcher\n"
 
41
        "  press Enter to click on the icon, Shift+Enter for Shift+click, Alt+Enter for middle click, and Ctrl+Enter for left click\n"
 
42
        "- the finder mode : type some text to launch any command, file or calculation.\n"
 
43
        "  use the arrows to navigate between the results, press Enter to validate, maintain CTRL, ALT or SHIFT to keep the results.\n"
 
44
        "Escape or the same shortkey to cancel."),
 
45
        "Fabounet (Fabrice Rey)")
 
46
 
 
47
 
 
48
//\___________ Here is where you initiate your applet. myConfig is already set at this point, and also myIcon, myContainer, myDock, myDesklet (and myDrawContext if you're in dock mode). The macro CD_APPLET_MY_CONF_FILE and CD_APPLET_MY_KEY_FILE can give you access to the applet's conf-file and its corresponding key-file (also available during reload). If you're in desklet mode, myDrawContext is still NULL, and myIcon's buffers has not been filled, because you may not need them then (idem when reloading).
 
49
CD_APPLET_INIT_BEGIN
 
50
        cairo_dock_register_notification (CAIRO_DOCK_KEY_PRESSED, (CairoDockNotificationFunc) cd_do_key_pressed, CAIRO_DOCK_RUN_AFTER, NULL);
 
51
        
 
52
        cd_keybinder_bind (myConfig.cShortkeyNav, (CDBindkeyHandler) cd_do_on_shortkey_nav, myApplet);
 
53
        cd_keybinder_bind (myConfig.cShortkeySearch, (CDBindkeyHandler) cd_do_on_shortkey_search, myApplet);
 
54
        
 
55
        cd_do_register_files_backend ();
 
56
        cd_do_register_web_backend ();
 
57
        cd_do_register_command_backend ();
 
58
CD_APPLET_INIT_END
 
59
 
 
60
 
 
61
//\___________ Here is where you stop your applet. myConfig and myData are still valid, but will be reseted to 0 at the end of the function. In the end, your applet will go back to its original state, as if it had never been activated.
 
62
CD_APPLET_STOP_BEGIN
 
63
        cairo_dock_remove_notification_func (CAIRO_DOCK_KEY_PRESSED, (CairoDockNotificationFunc) cd_do_key_pressed, NULL);
 
64
        
 
65
        cd_do_exit_session ();
 
66
        cd_do_stop_all_backends ();
 
67
CD_APPLET_STOP_END
 
68
 
 
69
 
 
70
//\___________ The reload occurs in 2 occasions : when the user changes the applet's config, and when the user reload the cairo-dock's config or modify the desklet's size. The macro CD_APPLET_MY_CONFIG_CHANGED can tell you this. myConfig has already been reloaded at this point if you're in the first case, myData is untouched. You also have the macro CD_APPLET_MY_CONTAINER_TYPE_CHANGED that can tell you if you switched from dock/desklet to desklet/dock mode.
 
71
CD_APPLET_RELOAD_BEGIN
 
72
        if (CD_APPLET_MY_CONFIG_CHANGED)
 
73
        {
 
74
                cd_keybinder_bind (myConfig.cShortkeyNav, (CDBindkeyHandler) cd_do_on_shortkey_nav, myApplet);  // shortkey were unbinded during reset_config.
 
75
                cd_keybinder_bind (myConfig.cShortkeySearch, (CDBindkeyHandler) cd_do_on_shortkey_search, myApplet);  // shortkey were unbinded during reset_config.
 
76
                
 
77
                cd_do_destroy_listing (myData.pListing);
 
78
                myData.pListing = NULL;
 
79
                
 
80
                if (myData.sCurrentText != NULL)
 
81
                {
 
82
                        /// recharger surfaces / textures
 
83
                        
 
84
                        
 
85
                        cairo_dock_redraw_container (CAIRO_CONTAINER (g_pMainDock));
 
86
                }
 
87
        }
 
88
CD_APPLET_RELOAD_END