~ubuntu-branches/ubuntu/precise/cairo-dock/precise-updates

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-notifications.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2011-03-17 14:08:48 UTC
  • mfrom: (1.1.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20110317140848-b8efysl4ynhjm87k
Tags: 2.3.0~1-0ubuntu1
* New Upstream Version (LP: #723994)
* Upstream short ChangeLog:
 - Updated translations
 - Updated the integration of the new versions of kwin and compiz
 - Updated default theme
 - Fixed a few bugs
 - Updated the man
* debian/control:
 - Added suggests apps for cairo-dock-core (needed by the default theme)
 - Updated the description (from launchpad.net/cairo-dock)
 - Added cairo-dock-plug-ins as a new suggestion for cairo-dock-core
* debian/patches:
 - Updated the default theme to use default apps of Ubuntu Natty 
* Switch to dpkg-source 3.0 (quilt) format
* Removed the desktop-file-category patch (sync with debian packages)
* debian/rules:
 - Added a CMake flag to disable the gtk grip
 - No longer used simple-patchsys
* Updated the debian/watch

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
18
*/
19
19
 
20
 
#include "cairo-dock-icons.h"
 
20
#include "cairo-dock-icon-factory.h"
 
21
#include "cairo-dock-log.h"
21
22
#include "cairo-dock-notifications.h"
22
23
 
23
24
static GPtrArray *s_pNotificationsTab = NULL;  // tables des notifications globales.
24
25
 
25
 
 
26
 
#define _check_notification_table(pNotificationsTab) do {\
27
 
        if (pNotificationsTab == NULL) {\
28
 
                pNotificationsTab = g_ptr_array_new ();\
29
 
                g_ptr_array_set_size (pNotificationsTab, CAIRO_DOCK_NB_NOTIFICATIONS); } } while (0)
30
 
 
31
26
static void _cairo_dock_register_notification_in_tab (GPtrArray *pNotificationsTab, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gboolean bRunFirst, gpointer pUserData)
32
27
{
33
28
        g_return_if_fail (iNotifType < pNotificationsTab->len);
42
37
        else
43
38
                pNotificationsTab->pdata[iNotifType] = g_slist_append (pNotificationRecordList, pNotificationRecord);
44
39
}
45
 
void cairo_dock_register_notification (CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gboolean bRunFirst, gpointer pUserData)
46
 
{
47
 
        _check_notification_table (s_pNotificationsTab);
48
 
        
49
 
        _cairo_dock_register_notification_in_tab (s_pNotificationsTab, iNotifType, pFunction, bRunFirst, pUserData);
50
 
}
51
 
void cairo_dock_register_notification_on_icon (Icon *pIcon, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gboolean bRunFirst, gpointer pUserData)
52
 
{
53
 
        _check_notification_table (pIcon->pNotificationsTab);
54
 
        
55
 
        _cairo_dock_register_notification_in_tab (pIcon->pNotificationsTab, iNotifType, pFunction, bRunFirst, pUserData);
56
 
}
57
 
void cairo_dock_register_notification_on_container (CairoContainer *pContainer, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gboolean bRunFirst, gpointer pUserData)
58
 
{
59
 
        _check_notification_table (pContainer->pNotificationsTab);
60
 
        
61
 
        _cairo_dock_register_notification_in_tab (pContainer->pNotificationsTab, iNotifType, pFunction, bRunFirst, pUserData);
62
 
}
63
 
 
64
40
 
65
41
 
66
42
static void _cairo_dock_remove_notification_func_in_tab (GPtrArray *pNotificationsTab, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gpointer pUserData)
84
60
{
85
61
        _cairo_dock_remove_notification_func_in_tab (s_pNotificationsTab, iNotifType, pFunction, pUserData);
86
62
}
87
 
void cairo_dock_remove_notification_func_on_icon (Icon *pIcon, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gpointer pUserData)
88
 
{
89
 
        _cairo_dock_remove_notification_func_in_tab (pIcon->pNotificationsTab, iNotifType, pFunction, pUserData);
90
 
}
91
 
void cairo_dock_remove_notification_func_on_container (CairoContainer *pContainer, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gpointer pUserData)
92
 
{
93
 
        _cairo_dock_remove_notification_func_in_tab (pContainer->pNotificationsTab, iNotifType, pFunction, pUserData);
94
 
}
95
 
 
96
63
 
97
64
 
98
65
GSList *cairo_dock_get_notifications_list (CairoDockNotificationType iNotifType)
117
84
        }
118
85
        g_ptr_array_free (pNotificationsTab, TRUE);
119
86
}
 
87
 
 
88
 
 
89
 
 
90
void cairo_dock_register_notification_on_object (gpointer pObject, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gboolean bRunFirst, gpointer pUserData)
 
91
{
 
92
        g_return_if_fail (pObject != NULL);
 
93
        GPtrArray **pNotificationsTabPtr = (GPtrArray**) pObject;
 
94
        GPtrArray *pNotificationsTab = *pNotificationsTabPtr;
 
95
        
 
96
        if (pNotificationsTab == NULL)
 
97
        {
 
98
                pNotificationsTab = g_ptr_array_new ();
 
99
                *pNotificationsTabPtr = pNotificationsTab;
 
100
                g_ptr_array_set_size (pNotificationsTab, 10);
 
101
        }
 
102
        
 
103
        if (pNotificationsTab->len < iNotifType)
 
104
        {
 
105
                cd_warning ("someone tried to register to an inexisting notification (%d) on an object", iNotifType);
 
106
                g_ptr_array_set_size (pNotificationsTab, iNotifType+1);
 
107
        }
 
108
        
 
109
        _cairo_dock_register_notification_in_tab (pNotificationsTab, iNotifType, pFunction, bRunFirst, pUserData);
 
110
}
 
111
 
 
112
void cairo_dock_remove_notification_func_on_object (gpointer pObject, CairoDockNotificationType iNotifType, CairoDockNotificationFunc pFunction, gpointer pUserData)
 
113
{
 
114
        g_return_if_fail (pObject != NULL);
 
115
        GPtrArray **pNotificationsTabPtr = (GPtrArray**) pObject;
 
116
        GPtrArray *pNotificationsTab = *pNotificationsTabPtr;
 
117
        _cairo_dock_remove_notification_func_in_tab (pNotificationsTab, iNotifType, pFunction, pUserData);
 
118
}