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

« back to all changes in this revision

Viewing changes to Status-Notifier/src/applet-host.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe), Matthieu Baerts (matttbe), Didier Roche
  • Date: 2010-09-18 14:20:27 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100918142027-b0zsay70mqxv63l0
Tags: 2.2.0~2-0ubuntu1
[ Matthieu Baerts (matttbe) ]
* New Upstream Version (LP: #638529)
* Fixed a few bugs on LP:
 - Fixed a crash in rainbow view when the cone is completely opened
 - Fixed a crash in rainbow view if the subdock is empty
 - Installed in lib directory by default even in 64bits arch
 - Status-Notifier: fixed few bugs
 - Clock applet:
   - Notify of missed tasks (moved some functions to a new file)
   - Fixed a little memory leak
 - Removed some 'g_print' (LP: #500677: xsession-errors log)
* Updated translations
* debian/control
 - Updated the version of cairo-dock-dev and cairo-dock-core

[ Didier Roche ]
* debian/control: depends on latest libindicator-dev (LP: #637692)

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
        gpointer invocation_hint G_GNUC_UNUSED,
50
50
        gpointer marshal_data)
51
51
{
52
 
        g_print ("%s ()\n", __func__);
 
52
        //g_print ("%s ()\n", __func__);
53
53
        typedef void (*GMarshalFunc_VOID__STRING_INT_STRING_STRING_STRING_STRING_STRING) (
54
54
                gpointer     data1,
55
55
                gchar      *arg_1,
169
169
static void on_new_item (DBusGProxy *proxy_watcher, const gchar *cService, CairoDockModuleInstance *myApplet)
170
170
{
171
171
        CD_APPLET_ENTER;
172
 
        g_print ("%s (%s)\n", __func__, cService);
 
172
        //g_print ("%s (%s)\n", __func__, cService);
173
173
        
174
174
        _add_new_item (cService, NULL, -1);  // on suppose que leur indicator-application ne mettra jamais -1 comme position.
175
175
        
179
179
static void on_removed_item (DBusGProxy *proxy_watcher, const gchar *cService, CairoDockModuleInstance *myApplet)
180
180
{
181
181
        CD_APPLET_ENTER;
182
 
        g_print ("%s (%s)\n", __func__, cService);
 
182
        //g_print ("%s (%s)\n", __func__, cService);
183
183
        
184
184
        gchar *str = strchr (cService, '/');
185
185
        if (str)
193
193
static void on_new_application (DBusGProxy *proxy_watcher, const gchar *cIconName, gint iPosition, const gchar *cAdress, const gchar *cObjectPath, const gchar *cIconThemePath, const gchar *cLabel, const gchar *cLabelGuide, CairoDockModuleInstance *myApplet)
194
194
{
195
195
        CD_APPLET_ENTER;
196
 
        g_print ("%s (%s, %s, %s, %s, %d)\n", __func__, cAdress, cObjectPath, cIconName, cIconThemePath, iPosition);
 
196
        //g_print ("%s (%s, %s, %s, %s, %d)\n", __func__, cAdress, cObjectPath, cIconName, cIconThemePath, iPosition);
197
197
        
198
198
        _add_new_item (cAdress, cObjectPath, iPosition);
199
199
        
203
203
static void on_removed_application (DBusGProxy *proxy_watcher, gint iPosition, CairoDockModuleInstance *myApplet)
204
204
{
205
205
        CD_APPLET_ENTER;
206
 
        g_print ("%s (%d)\n", __func__, iPosition);
 
206
        //g_print ("%s (%d)\n", __func__, iPosition);
207
207
        
208
208
        _remove_item (NULL, iPosition);
209
209
        
217
217
 
218
218
static void _on_get_applications_from_service (DBusGProxy *proxy, DBusGProxyCall *call_id, CairoDockModuleInstance *myApplet)
219
219
{
220
 
        g_print ("%s ()\n", __func__);
 
220
        //g_print ("%s ()\n", __func__);
221
221
        CD_APPLET_ENTER;
222
222
        myData.pGetApplicationsCall = NULL;
223
223
        
252
252
        GValueArray *va;
253
253
        GValue *v;
254
254
        CDStatusNotifierItem *pItem=NULL;
255
 
        g_print ("%d apps in the systray\n", pApplications->len);
 
255
        //g_print ("%d apps in the systray\n", pApplications->len);
256
256
        for (i = 0; i < pApplications->len; i ++)
257
257
        {
258
258
                va = pApplications->pdata[i];
295
295
                if (v && G_VALUE_HOLDS_STRING (v))
296
296
                        cLabelGuide = g_value_get_string (v);
297
297
                
298
 
                g_print (" + item {%s ; %d ; %s ; %s ; %s ; %s ; %s}\n",
 
298
                /*g_print (" + item {%s ; %d ; %s ; %s ; %s ; %s ; %s}\n",
299
299
                        cIconName,
300
300
                        iPosition,
301
301
                        cAdress,
302
302
                        cObjectPath,
303
303
                        cIconThemePath,
304
304
                        cLabel,
305
 
                        cLabelGuide);
 
305
                        cLabelGuide);*/
306
306
                
307
307
                pItem = cd_satus_notifier_create_item (cAdress, cObjectPath);
308
308
                if (! pItem)
326
326
 
327
327
static void _cd_satus_notifier_get_indicator_application (void)
328
328
{
329
 
        g_print ("%s ()\n", __func__);
 
329
        //g_print ("%s ()\n", __func__);
330
330
        // get the service
331
331
        myData.pProxyIndicatorApplicationService = cairo_dock_create_new_session_proxy (
332
332
                CD_INDICATOR_APPLICATION_ADDR,
364
364
 
365
365
static void _on_get_applications_from_watcher (DBusGProxy *proxy, DBusGProxyCall *call_id, CairoDockModuleInstance *myApplet)
366
366
{
367
 
        g_print ("%s ()\n", __func__);
 
367
        //g_print ("%s ()\n", __func__);
368
368
        CD_APPLET_ENTER;
369
369
        myData.pGetApplicationsCall = NULL;
370
370
        
408
408
        }
409
409
        else  // un watcher asocial comme celui d'Ubuntu, on essaye avec l'"indicator-application".
410
410
        {
411
 
                g_print ("this watcher is not so friendly, let's try the 'application indicator'\n");
 
411
                //g_print ("this watcher is not so friendly, let's try the 'application indicator'\n");
412
412
                _cd_satus_notifier_get_indicator_application ();
413
413
        }
414
414
        CD_APPLET_LEAVE ();
416
416
 
417
417
static void _on_register_host (DBusGProxy *proxy, DBusGProxyCall *call_id, CairoDockModuleInstance *myApplet)
418
418
{
419
 
        g_print ("%s ()\n", __func__);
 
419
        //g_print ("%s ()\n", __func__);
420
420
        CD_APPLET_ENTER;
421
421
        GError *erreur = NULL;
422
422
        gboolean bSuccess = dbus_g_proxy_end_call (proxy,
433
433
        
434
434
        if (bSuccess)  // il y'a un watcher.
435
435
        {
436
 
                g_print ("found a friendly watcher, now ask for the items...\n");
 
436
                //g_print ("found a friendly watcher, now ask for the items...\n");
437
437
                // get the items
438
438
                DBusGProxy *pProxyWatcherProps = cairo_dock_create_new_session_proxy (
439
439
                        CD_STATUS_NOTIFIER_WATCHER_ADDR,
460
460
        }
461
461
        else  // pas de watcher, ou un asocial comme celui d'Ubuntu, on essaye avec l'"indicator-application".
462
462
        {
463
 
                g_print ("no friendy watcher, let's try the 'application indicator'\n");
 
463
                //g_print ("no friendy watcher, let's try the 'application indicator'\n");
464
464
                _cd_satus_notifier_get_indicator_application ();
465
465
        }
466
466
        CD_APPLET_LEAVE ();
468
468
static void _cd_satus_notifier_register_host (void)
469
469
{
470
470
        // register to the watcher.
471
 
        g_print ("registering to the watcher...\n");
 
471
        //g_print ("registering to the watcher...\n");
472
472
        myData.pRegisterHostCall = dbus_g_proxy_begin_call (myData.pProxyWatcher, "RegisterNotificationHost",
473
473
                (DBusGProxyCallNotify)_on_register_host,
474
474
                myApplet,
500
500
        // Register the service name on the bus.
501
501
        pid_t pid = getpid ();
502
502
        myData.cHostName = g_strdup_printf (CD_STATUS_NOTIFIER_HOST_ADDR"-%d", pid);
503
 
        g_print ("registering name '%s' on the bus ...\n", myData.cHostName);
 
503
        //g_print ("registering name '%s' on the bus ...\n", myData.cHostName);
504
504
        cairo_dock_register_service_name (myData.cHostName);
505
505
        
506
506
        // get the watcher.
507
 
        g_print ("getting the watcher ...\n");
 
507
        //g_print ("getting the watcher ...\n");
508
508
        myData.pProxyWatcher = cairo_dock_create_new_session_proxy (
509
509
                CD_STATUS_NOTIFIER_WATCHER_ADDR,
510
510
                CD_STATUS_NOTIFIER_WATCHER_OBJ,
511
511
                CD_STATUS_NOTIFIER_WATCHER_IFACE);  /// dbus_g_proxy_new_for_name_owner ?...
512
512
        if (myData.pProxyWatcher == NULL)  // no watcher yet, let's try again in a few moment.
513
513
        {
514
 
                g_print ("no watcher yet, let's try again in a few moment\n");
 
514
                //g_print ("no watcher yet, let's try again in a few moment\n");
515
515
                myData.iSidGetWatcher = g_timeout_add (1000., (GSourceFunc)_get_watcher, myApplet);
516
516
                return;
517
517
        }