~cairo-dock-team/ubuntu/quantal/cairo-dock-plug-ins/3.0.2

« back to all changes in this revision

Viewing changes to GMenu/src/applet-init.c

Tags: upstream-2.2.0~0beta4
ImportĀ upstreamĀ versionĀ 2.2.0~0beta4

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "applet-init.h"
28
28
 
29
29
 
30
 
CD_APPLET_DEFINITION ("GMenu",
 
30
CD_APPLET_DEFINE_BEGIN ("GMenu",
31
31
        2, 0, 0,
32
 
        CAIRO_DOCK_CATEGORY_DESKTOP,
 
32
        CAIRO_DOCK_CATEGORY_APPLET_DESKTOP,
33
33
        N_("Displays the common Applications menu and the Recently used files.\n"
34
34
        "It is compatible with any XDG compliant menu (Gnome, XFCE, KDE, ...)\n"
35
35
        "Middle-click to open a dialog to quickly launch any command (you can set up a shortkey for it, like ALT+F2)\n"
36
36
        "You can also set up a shortkey to pop up the menu (like ALT+F1)"),
37
37
        "Fabounet (Fabrice Rey)")
 
38
        CD_APPLET_DEFINE_COMMON_APPLET_INTERFACE
 
39
        CD_APPLET_REDEFINE_TITLE (N_("Applications Menu"))
 
40
CD_APPLET_DEFINE_END
38
41
 
39
42
 
40
43
//\___________ 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).
78
81
 
79
82
//\___________ 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.
80
83
CD_APPLET_RELOAD_BEGIN
81
 
        if (myDesklet)
82
 
        {
83
 
                CD_APPLET_SET_DESKLET_RENDERER ("Simple");  // set a desklet renderer.
84
 
        }
85
 
        
86
84
        if (CD_APPLET_MY_CONFIG_CHANGED)
87
85
        {
 
86
                if (myDesklet && CD_APPLET_MY_CONTAINER_TYPE_CHANGED)  // we are now in a desklet, set a renderer.
 
87
                {
 
88
                        CD_APPLET_SET_DESKLET_RENDERER ("Simple");
 
89
                }
 
90
 
88
91
                CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE;  // set the default icon if none is specified in conf.
89
92
                
90
93
                cd_keybinder_bind (myConfig.cMenuShortkey, (CDBindkeyHandler) cd_menu_on_shortkey_menu, myApplet);  // shortkey were unbinded during reset_config.