~diwic/ubuntu/lucid/pulseaudio/bugfixes

« back to all changes in this revision

Viewing changes to src/modules/module-console-kit.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2009-05-05 14:18:20 UTC
  • mfrom: (1.2.4 upstream) (1.1.8 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090505141820-rrr2mtdd1jkllvr8
Tags: 1:0.9.15-1ubuntu1
* Merge from unreleased Debian pulseaudio git, remaining changes:
  - epoch (my stupid fault :S)
  - Don't build against, and create jack package. Jack is not in main
  - use linear resampler to work better with lack of PREEMPT in jaunty's
    -generic kernel config, also change buffer size
  - Add alsa configuration files to route alsa applications via pulseaudio
  - Move libasound2-plugins from Recommends to Depends
  - Add pm-utils sleep hook to suspend (and resume) users' pulseaudio
    daemons
  - patch to fix source/sink and suspend-on-idle race
  - Make initscript more informative in the default case of per-user
    sessions
  - create /var/run/pulse, and make restart more robust
  - add status check for system wide pulseaudio instance
  - LSB {Required-*,Should-*} should specify hal instead of dbus,
    since hal is required (and already requires dbus)
  - indicate that the system pulseaudio instance is being started from the init
    script
  - Install more upstream man pages
  - Link to pacat for parec man page
  - check whether pulseaudio is running before preloading the padsp library
  - Add DEB_OPT_FLAG = -O3 as per recommendation from
    pulseaudio-discuss/2007-December/001017.html
  - cache /usr/share/sounds/ubuntu/stereo/ wav files on pulseaudio load
  - disable glitch free (use tsched=0)
  - Generate a PO template on build
  - add special case to disable pulseaudio loading if accessibility/speech
    is being used
  - the sd wrapper script should not load pulseaudio if pulseaudio is being
    used as a system service
  - add a pulseaudio apport hook
  - fix some typos in README.Debian
  - demote paprefs to suggests
  - drop padevchooser(Recommends) and pavucontrol (Suggests)
  - drop libasyncns-dev build dependency, its in universe
* add libudev-dev as a build-dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
    PulseAudio is free software; you can redistribute it and/or modify
7
7
    it under the terms of the GNU Lesser General Public License as published
8
 
    by the Free Software Foundation; either version 2 of the License,
 
8
    by the Free Software Foundation; either version 2.1 of the License,
9
9
    or (at your option) any later version.
10
10
 
11
11
    PulseAudio is distributed in the hope that it will be useful, but
44
44
#include <pulsecore/namereg.h>
45
45
#include <pulsecore/core-scache.h>
46
46
#include <pulsecore/modargs.h>
 
47
#include <pulsecore/dbus-shared.h>
47
48
 
48
 
#include "dbus-util.h"
49
49
#include "module-console-kit-symdef.h"
50
50
 
51
51
PA_MODULE_AUTHOR("Lennart Poettering");
63
63
};
64
64
 
65
65
struct userdata {
 
66
    pa_module *module;
66
67
    pa_core *core;
67
68
    pa_dbus_connection *connection;
68
69
    pa_hashmap *sessions;
73
74
    DBusMessage *m = NULL, *reply = NULL;
74
75
    uint32_t uid;
75
76
    struct session *session;
76
 
    char *t;
 
77
    pa_client_new_data data;
77
78
 
78
79
    dbus_error_init (&error);
79
80
 
109
110
    session = pa_xnew(struct session, 1);
110
111
    session->id = pa_xstrdup(id);
111
112
 
112
 
    t = pa_sprintf_malloc("ConsoleKit Session %s", id);
113
 
    session->client = pa_client_new(u->core, __FILE__, t);
114
 
    pa_xfree(t);
 
113
    pa_client_new_data_init(&data);
 
114
    data.module = u->module;
 
115
    data.driver = __FILE__;
 
116
    pa_proplist_setf(data.proplist, PA_PROP_APPLICATION_NAME, "ConsoleKit Session %s", id);
 
117
    pa_proplist_sets(data.proplist, "console-kit.session", id);
 
118
    session->client = pa_client_new(u->core, &data);
 
119
    pa_client_new_data_done(&data);
115
120
 
116
 
    pa_proplist_sets(session->client->proplist, "console-kit.session", id);
 
121
    if (!session->client) {
 
122
        pa_xfree(session->id);
 
123
        pa_xfree(session);
 
124
        goto fail;
 
125
    }
117
126
 
118
127
    pa_hashmap_put(u->sessions, session->id, session);
119
128
 
295
304
 
296
305
    m->userdata = u = pa_xnew(struct userdata, 1);
297
306
    u->core = m->core;
 
307
    u->module = m;
298
308
    u->connection = connection;
299
309
    u->sessions = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
300
310
 
303
313
        goto fail;
304
314
    }
305
315
 
306
 
    dbus_bus_add_match(pa_dbus_connection_get(connection), "type='signal',sender='org.freedesktop.ConsoleKit', interface='org.freedesktop.ConsoleKit.Seat'", &error);
307
 
    if (dbus_error_is_set(&error)) {
 
316
    if (pa_dbus_add_matches(
 
317
                pa_dbus_connection_get(connection), &error,
 
318
                "type='signal',sender='org.freedesktop.ConsoleKit',interface='org.freedesktop.ConsoleKit.Seat',member='SessionAdded'",
 
319
                "type='signal',sender='org.freedesktop.ConsoleKit',interface='org.freedesktop.ConsoleKit.Seat',member='SessionRemoved'", NULL) < 0) {
308
320
        pa_log_error("Unable to subscribe to ConsoleKit signals: %s: %s", error.name, error.message);
309
321
        goto fail;
310
322
    }
344
356
    }
345
357
 
346
358
    if (u->connection) {
347
 
        DBusError error;
348
 
        dbus_error_init(&error);
349
 
 
350
 
        dbus_bus_remove_match(pa_dbus_connection_get(u->connection), "type='signal',sender='org.freedesktop.ConsoleKit', interface='org.freedesktop.ConsoleKit.Seat'", &error);
351
 
        dbus_error_free(&error);
 
359
        pa_dbus_remove_matches(
 
360
                pa_dbus_connection_get(u->connection),
 
361
                "type='signal',sender='org.freedesktop.ConsoleKit',interface='org.freedesktop.ConsoleKit.Seat',member='SessionAdded'",
 
362
                "type='signal',sender='org.freedesktop.ConsoleKit',interface='org.freedesktop.ConsoleKit.Seat',member='SessionRemoved'", NULL);
352
363
 
353
364
        dbus_connection_remove_filter(pa_dbus_connection_get(u->connection), filter_cb, u);
354
 
 
355
365
        pa_dbus_connection_unref(u->connection);
356
366
    }
357
367