~ubuntu-branches/ubuntu/utopic/cairo-dock-plug-ins/utopic

« back to all changes in this revision

Viewing changes to GMenu-old/src/applet-config.c

  • Committer: Package Import Robot
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2013-03-26 00:17:44 UTC
  • mfrom: (36.1.3 cairo-dock-plug-ins)
  • Revision ID: package-import@ubuntu.com-20130326001744-10z2kb7sa66c6c6q
Tags: 3.2.0-0ubuntu1
* New upstream release.
* Upstream ChangeLog:
  - Clock: iCal: don't add a new task if the uid is NULL
  - DBus interfaces: install python interfaces for both python2 and 3
  - Dock rendering: fixed the drawing of the 3D and Curve views when the
    alignment  is not centered
  - Fixed a few compilation errors and warning for FreeBSD
  - GMenu: init: load all menus and submenus in a separated thread and
    not in the mainloop to avoid tiny freezes at startup
  - GMenu: split the applet in two directories: one if libgnome-menu-3 is
    available and another one (GMenu-old) if libgnome-menu is available.
  - GMenu: if the user wants to show the menu before it's loaded, set a
    pending event
  - gvfs integration: hidden files were not correctly handled
  - po: Imported translations from Launchpad
  - Shortcuts: Disk usage: some sentenses was not translatable
  - Shortcuts: for a bookmark that points to a volume mount it before
  - Shortcuts: if the user wants to show the menu before it's loaded, set
    a pending event
  - ShowDesktop: Gnome-Shell workaround: add a small delay before
    triggering the desktop Exposé or Gnome-Shell will not respond
  - Sound-control: ignore alsa callbacks that are not 'value changed'
  - Status-Notifier: don't reset the icon if not in compact mode
* debian/control:
  - Used the newer version of libgnome-menu (libgnome-menu-3-dev)
  - Bumped Cairo-Dock versions
  - Build-Depends: Added python3 in order to install both python 2 and 3
    interfaces

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 <string.h>
 
21
#include <cairo-dock.h>
 
22
 
 
23
#include "applet-struct.h"
 
24
#include "applet-notifications.h"
 
25
#include "applet-config.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.bShowRecent = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "show recent", TRUE);
 
31
        myConfig.cMenuShortkey = CD_CONFIG_GET_STRING ("Configuration", "menu shortkey");
 
32
        myConfig.cQuickLaunchShortkey = CD_CONFIG_GET_STRING ("Configuration", "quick launch shortkey");
 
33
        myConfig.cConfigureMenuCommand = CD_CONFIG_GET_STRING ("Configuration", "config menu");
 
34
        myConfig.iNbRecentItems = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "nb recent", 20);
 
35
        myConfig.iShowQuit = CD_CONFIG_GET_INTEGER ("Configuration", "show quit");
 
36
        myConfig.bLoadIconsAtStartup = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "startup load", FALSE);
 
37
CD_APPLET_GET_CONFIG_END
 
38
 
 
39
 
 
40
//\_________________ 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.
 
41
CD_APPLET_RESET_CONFIG_BEGIN
 
42
        g_free (myConfig.cConfigureMenuCommand);
 
43
        g_free (myConfig.cMenuShortkey);
 
44
        g_free (myConfig.cQuickLaunchShortkey);
 
45
CD_APPLET_RESET_CONFIG_END
 
46
 
 
47
 
 
48
//\_________________ 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.
 
49
CD_APPLET_RESET_DATA_BEGIN
 
50
        myData.bIconsLoaded = TRUE;
 
51
        if (myData.pTask)
 
52
                cairo_dock_discard_task (myData.pTask);
 
53
        g_list_free (myData.pPreloadedImagesList);
 
54
 
 
55
        if (myData.pMenu)
 
56
                gtk_widget_destroy (myData.pMenu);  // detruit aussi pRecentMenuItem.
 
57
        
 
58
        if (myData.loaded_icons != NULL)
 
59
        {
 
60
                g_hash_table_destroy (myData.loaded_icons);  // wll unref objects inside.
 
61
                myData.loaded_icons = NULL;  // set to NULL for the callback
 
62
        }
 
63
        
 
64
        if (myData.image_menu_items != NULL)
 
65
        {
 
66
                g_slist_free (myData.image_menu_items);  // objects inside will be destroyed with the menu.
 
67
                myData.image_menu_items = NULL;
 
68
        }
 
69
        
 
70
        if (myData.dir_hash)
 
71
                g_hash_table_destroy (myData.dir_hash);
 
72
        
 
73
        GList *l;
 
74
        for (l = myData.possible_executables; l; l = l->next)
 
75
                g_free (l->data);
 
76
        g_list_free (myData.possible_executables);
 
77
        
 
78
        for (l = myData.completion_items; l; l = l->next)
 
79
                g_free (l->data);
 
80
        g_list_free (myData.completion_items);
 
81
        
 
82
        if (myData.completion)
 
83
                g_completion_free (myData.completion);
 
84
        
 
85
        if (!cairo_dock_dialog_unreference (myData.pQuickLaunchDialog))
 
86
                cairo_dock_dialog_unreference (myData.pQuickLaunchDialog);
 
87
CD_APPLET_RESET_DATA_END