~ubuntu-branches/ubuntu/quantal/cairo-dock-plug-ins/quantal-201208191523

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-10 00:05:57 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100810000557-pfxoz5w7hbyclcqh
Tags: 2.2.0~0beta4-0ubuntu1
* New Upstream Version (LP: #614625)
* Fixed a few bugs on LP:
 - LP: #483963: Dustbin applet does not display trashes on all volumes
 - LP: #485159: Some apps have problem with Systray
 - LP: #500677: ~/.xsession-errors is too much used by CD
 - LP: #500979: Shortcuts: the order gets messed up
 - LP: #521531: Mail: crashes on Maildir
 - LP: #519915: GTG: create a new applet to control GTG
 - LP: #526138: GMenu doesn't handle desktop file exec strings properly
 - LP: #531317: CMake: Added an error if the prefix of 'cairo-dock-plugins'
                 is not the same 'cairo-dock-core'
 - LP: #531319: CMake: check the version of 'cairo-dock' when building
                 'cairo-dock-plugins'
 - LP: #537115: Click at the position where icon lavel was, the icon
                 and dock still receive the event
 - LP: #537943: Terminal applet shortkey behaviour
 - LP: #538637: Trash applet doesn't create .trashinfo files on XFCE
 - More details on the 'ChangeLog' file
* debian/rules:
 - Autotools has been replaced by CMake
 - cdbs is now used.
* debian/copyright:
 - Updated with the new applets
* debian/control:
 - Autotools has been replaced by CMake
 - Added libcurl4-gnutls-dev, libindicator-dev, libdbusmenu-glib-dev
   libido-0.1-dev, libical-dev, libdbusmenu-gtk-dev as Build-deps
 - Bump Standard-Version to 3.9.1
 - Wget is required for dnd2share applet
 - Added the exact realease for 'cairo-dock-dev' in order to prevent any
    build error if this package is not already available (thx to didrocks)
* debian/cairo-dock-plug-ins*.install:
 - All sonames are now installed into lib32 or lib64 (lib*)

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-init.h"
 
26
#include "applet-load-icons.h"
 
27
#include "applet-stacks.h"
 
28
 
 
29
 
 
30
CD_APPLET_DEFINITION (N_("stacks"),
 
31
        1, 6, 2,
 
32
        CAIRO_DOCK_CATEGORY_APPLET_ACCESSORY,
 
33
        N_("This applet allows you to build a stack of files, just like the Stacks applet of MacOS X.\n"
 
34
        "To add file into your stacks, you just have to drag and drop it on the Stacks icon and you're done.\n"
 
35
        "You can drop any file, or web URL, or even some piece of text\n"
 
36
        "You can quickly copy the path/url/text to the clipboard, or open it."),
 
37
        "ChAnGFu (Rémy Robertson)")
 
38
 
 
39
 
 
40
//\___________ 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).
 
41
CD_APPLET_INIT_BEGIN
 
42
        cd_stacks_check_local();
 
43
        cd_stacks_build_icons();
 
44
        
 
45
        CD_APPLET_REGISTER_FOR_CLICK_EVENT;
 
46
        CD_APPLET_REGISTER_FOR_MIDDLE_CLICK_EVENT;
 
47
        CD_APPLET_REGISTER_FOR_BUILD_MENU_EVENT;
 
48
        CD_APPLET_REGISTER_FOR_DROP_DATA_EVENT;
 
49
CD_APPLET_INIT_END
 
50
 
 
51
 
 
52
//\___________ 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.
 
53
CD_APPLET_STOP_BEGIN
 
54
        CD_APPLET_UNREGISTER_FOR_CLICK_EVENT;
 
55
        CD_APPLET_UNREGISTER_FOR_MIDDLE_CLICK_EVENT;
 
56
        CD_APPLET_UNREGISTER_FOR_BUILD_MENU_EVENT;
 
57
        CD_APPLET_UNREGISTER_FOR_DROP_DATA_EVENT;
 
58
        
 
59
CD_APPLET_STOP_END
 
60
 
 
61
 
 
62
//\___________ 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.
 
63
CD_APPLET_RELOAD_BEGIN
 
64
        //\_______________ On recharge les donnees qui ont pu changer.
 
65
        if (CD_APPLET_MY_CONFIG_CHANGED) {
 
66
                cd_stacks_remove_monitors(); //ET oui sinon on se retrouve avec des fichiers qui ne nous concerne plus!
 
67
                cd_stacks_check_local();
 
68
        }
 
69
        else if (myDesklet != NULL) {
 
70
                cairo_dock_set_desklet_renderer_by_name (myDesklet, "Tree", CAIRO_DOCK_LOAD_ICONS_FOR_DESKLET, NULL); 
 
71
        }
 
72
        else {
 
73
                //cairo_dock_glander();
 
74
        }
 
75
        
 
76
        cd_stacks_reload();
 
77
CD_APPLET_RELOAD_END