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

« back to all changes in this revision

Viewing changes to dnd2share/src/applet-config.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:
15
15
* GNU General Public License for more details.
16
16
* You should have received a copy of the GNU General Public License
17
17
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 
*/
19
 
 
20
 
#include <string.h>
21
 
#include <cairo-dock.h>
22
 
 
23
 
#include "applet-struct.h"
24
 
#include "applet-config.h"
25
 
#include "applet-dnd2share.h"
26
 
 
27
 
 
28
 
//\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload.
29
 
CD_APPLET_GET_CONFIG_BEGIN
30
 
        myConfig.bEnableDialogs = CD_CONFIG_GET_BOOLEAN ("Configuration", "enable_dialogs");
31
 
        myConfig.dTimeDialogs = 1000. * CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "dialogs_duration", 5);
32
 
        myConfig.iNbItems = CD_CONFIG_GET_INTEGER ("Configuration", "nb_items");
33
 
        myConfig.bkeepCopy = CD_CONFIG_GET_BOOLEAN ("Configuration", "keep copy");
 
18
*/
 
19
 
 
20
#include <string.h>
 
21
#include <cairo-dock.h>
 
22
 
 
23
#include "applet-struct.h"
 
24
#include "applet-config.h"
 
25
#include "applet-dnd2share.h"
 
26
 
 
27
 
 
28
//\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload.
 
29
CD_APPLET_GET_CONFIG_BEGIN
 
30
        myConfig.bEnableDialogs = CD_CONFIG_GET_BOOLEAN ("Configuration", "enable_dialogs");
 
31
        myConfig.dTimeDialogs = 1000. * CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "dialogs_duration", 5);
 
32
        myConfig.iNbItems = CD_CONFIG_GET_INTEGER ("Configuration", "nb_items");
 
33
        myConfig.bkeepCopy = CD_CONFIG_GET_BOOLEAN ("Configuration", "keep copy");
34
34
        myConfig.bDisplayLastImage = myConfig.bkeepCopy && CD_CONFIG_GET_BOOLEAN ("Configuration", "display last image");
35
 
        myConfig.iLimitRate = CD_CONFIG_GET_INTEGER ("Configuration", "limit rate");
36
 
        myConfig.cIconAnimation = CD_CONFIG_GET_STRING ("Configuration", "animation");
37
 
        myConfig.iPreferedSite[CD_TYPE_TEXT] = CD_CONFIG_GET_INTEGER ("Configuration", "text site");
38
 
        myConfig.iPreferedSite[CD_TYPE_IMAGE] = CD_CONFIG_GET_INTEGER ("Configuration", "image site");
39
 
        myConfig.iPreferedSite[CD_TYPE_VIDEO] = CD_CONFIG_GET_INTEGER ("Configuration", "video site");
40
 
        myConfig.iPreferedSite[CD_TYPE_FILE] = CD_CONFIG_GET_INTEGER ("Configuration", "file site");
41
 
        
42
 
        myConfig.cCustomScripts[CD_TYPE_TEXT] = CD_CONFIG_GET_STRING ("Configuration", "text script");
43
 
        myConfig.cCustomScripts[CD_TYPE_IMAGE] = CD_CONFIG_GET_STRING ("Configuration", "image script");
44
 
        myConfig.cCustomScripts[CD_TYPE_VIDEO] = CD_CONFIG_GET_STRING ("Configuration", "video script");
45
 
        myConfig.cCustomScripts[CD_TYPE_FILE] = CD_CONFIG_GET_STRING ("Configuration", "file script");
46
 
        int i;
47
 
        for (i = 0; i < CD_NB_FILE_TYPES; i ++)  // on empeche de choisir le backend custom si aucun script n'est fourni.
48
 
        {
49
 
                if (myConfig.cCustomScripts[i] == NULL && myConfig.iPreferedSite[i] == 0)
50
 
                        myConfig.iPreferedSite[i] = 1;
51
 
        }
52
 
        myConfig.cDropboxDir = CD_CONFIG_GET_STRING ("Configuration", "dropbox dir");
53
 
        if (myConfig.cDropboxDir && myConfig.cDropboxDir[strlen(myConfig.cDropboxDir)-1] == '/')
54
 
                myConfig.cDropboxDir[strlen(myConfig.cDropboxDir)-1] = '\0';
55
 
CD_APPLET_GET_CONFIG_END
56
 
 
57
 
 
58
 
//\_________________ Here you have to free all ressources allocated for myConfig. This one will be reseted to 0 at the end of this function. This function is called right before you get the applet's config, and when your applet is stopped, in the end.
59
 
CD_APPLET_RESET_CONFIG_BEGIN
60
 
        g_free (myConfig.cIconAnimation);
61
 
        int i;
62
 
        for (i = 0; i < CD_NB_FILE_TYPES; i ++)
63
 
                g_free (myConfig.cCustomScripts[i]);
64
 
        g_free (myConfig.cDropboxDir);
65
 
CD_APPLET_RESET_CONFIG_END
66
 
 
67
 
 
68
 
//\_________________ Here you have to free all ressources allocated for myData. This one will be reseted to 0 at the end of this function. This function is called when your applet is stopped, in the very end.
69
 
CD_APPLET_RESET_DATA_BEGIN
70
 
        cairo_dock_free_task (myData.pTask);  // stoppe la tache.
71
 
        
72
 
        g_free (myData.cCurrentFilePath);  // on libere la memoire partagee apres.
73
 
        g_strfreev (myData.cResultUrls);
74
 
        
75
 
        cd_dnd2share_clear_history ();
76
 
        
77
 
        g_free (myData.cLastURL);
78
 
        g_free (myData.cWorkingDirPath);
79
 
CD_APPLET_RESET_DATA_END
 
35
        myConfig.iLimitRate = CD_CONFIG_GET_INTEGER ("Configuration", "limit rate");
 
36
        myConfig.cIconAnimation = CD_CONFIG_GET_STRING ("Configuration", "animation");
 
37
        myConfig.iPreferedSite[CD_TYPE_TEXT] = CD_CONFIG_GET_INTEGER ("Configuration", "text site");
 
38
        myConfig.iPreferedSite[CD_TYPE_IMAGE] = CD_CONFIG_GET_INTEGER ("Configuration", "image site");
 
39
        myConfig.iPreferedSite[CD_TYPE_VIDEO] = CD_CONFIG_GET_INTEGER ("Configuration", "video site");
 
40
        myConfig.iPreferedSite[CD_TYPE_FILE] = CD_CONFIG_GET_INTEGER ("Configuration", "file site");
 
41
        
 
42
        myConfig.cCustomScripts[CD_TYPE_TEXT] = CD_CONFIG_GET_STRING ("Configuration", "text script");
 
43
        myConfig.cCustomScripts[CD_TYPE_IMAGE] = CD_CONFIG_GET_STRING ("Configuration", "image script");
 
44
        myConfig.cCustomScripts[CD_TYPE_VIDEO] = CD_CONFIG_GET_STRING ("Configuration", "video script");
 
45
        myConfig.cCustomScripts[CD_TYPE_FILE] = CD_CONFIG_GET_STRING ("Configuration", "file script");
 
46
        int i;
 
47
        for (i = 0; i < CD_NB_FILE_TYPES; i ++)  // on empeche de choisir le backend custom si aucun script n'est fourni.
 
48
        {
 
49
                if (myConfig.cCustomScripts[i] == NULL && myConfig.iPreferedSite[i] == 0)
 
50
                        myConfig.iPreferedSite[i] = 1;
 
51
        }
 
52
        myConfig.cDropboxDir = CD_CONFIG_GET_STRING ("Configuration", "dropbox dir");
 
53
        if (myConfig.cDropboxDir && myConfig.cDropboxDir[strlen(myConfig.cDropboxDir)-1] == '/')
 
54
                myConfig.cDropboxDir[strlen(myConfig.cDropboxDir)-1] = '\0';
 
55
        myConfig.bAnonymous = CD_CONFIG_GET_BOOLEAN ("Configuration", "anonymous");
 
56
        myConfig.iTinyURLService = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "tiny url", 1);
 
57
        if (myConfig.iTinyURLService != 0)
 
58
                myConfig.bUseTinyAsDefault = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "use tiny", FALSE);
 
59
CD_APPLET_GET_CONFIG_END
 
60
 
 
61
 
 
62
//\_________________ Here you have to free all ressources allocated for myConfig. This one will be reseted to 0 at the end of this function. This function is called right before you get the applet's config, and when your applet is stopped, in the end.
 
63
CD_APPLET_RESET_CONFIG_BEGIN
 
64
        g_free (myConfig.cIconAnimation);
 
65
        int i;
 
66
        for (i = 0; i < CD_NB_FILE_TYPES; i ++)
 
67
                g_free (myConfig.cCustomScripts[i]);
 
68
        g_free (myConfig.cDropboxDir);
 
69
CD_APPLET_RESET_CONFIG_END
 
70
 
 
71
 
 
72
//\_________________ Here you have to free all ressources allocated for myData. This one will be reseted to 0 at the end of this function. This function is called when your applet is stopped, in the very end.
 
73
CD_APPLET_RESET_DATA_BEGIN
 
74
        cairo_dock_free_task (myData.pTask);  // stoppe la tache.
 
75
        
 
76
        g_free (myData.cCurrentFilePath);  // on libere la memoire partagee apres.
 
77
        g_strfreev (myData.cResultUrls);
 
78
        
 
79
        cd_dnd2share_clear_history ();
 
80
        
 
81
        g_free (myData.cLastURL);
 
82
        g_free (myData.cWorkingDirPath);
 
83
CD_APPLET_RESET_DATA_END