Some style fixes + documentation
authorThomas Perl <thp@thpinfo.com>
Wed, 21 Oct 2009 12:10:09 +0000 (14:10 +0200)
committerThomas Perl <thp@thpinfo.com>
Fri, 23 Oct 2009 19:19:07 +0000 (21:19 +0200)
src/headphoned.c

index 42f64da..0279237 100644 (file)
@@ -1,3 +1,17 @@
+/**
+ * headphoned for the Nokia N8x0
+ *
+ * The headphone daemon watches the state of the headphone
+ * plug (connected, disconnected) and carries out actions
+ * based on these events.
+ *
+ * Currently supported:
+ *   * Send "pause" to the media player on disconnect
+ *   * Maintain different volume settings for each state
+ *
+ * Copyright (c) 2009-10-21 Thomas Perl <thpinfo.com>
+ **/
+
 #include <stdio.h>
 #include <assert.h>
 #include <glib.h>
@@ -13,8 +27,9 @@
 #define MEDIA_SERVER_SRVC "com.nokia.osso_media_server"
 #define MEDIA_SERVER_PATH "/com/nokia/osso_media_server"
 #define MEDIA_SERVER_INTF "com.nokia.osso_media_server.music"
-#define MEDIA_SERVER_METH "pause"
 
+// Volume control is currently broken, as something is messing
+// with the controls from outside this process in GConf..
 //#define ENABLE_VOLUME_CONTROL
 #define ENABLE_PAUSE_ON_DISCONNECT
 
@@ -34,7 +49,8 @@ on_volume_changed(GConfClient* client, guint gnxn_id, GConfEntry* entry,
                gpointer data)
 {
        Headphoned* headphoned = (Headphoned*)data;
-       headphoned->volume[headphoned->state] = gconf_value_get_int(entry->value);
+       headphoned->volume[headphoned->state] =
+               gconf_value_get_int(entry->value);
 }
 
 Headphoned*
@@ -81,7 +97,7 @@ on_file_changed(GIOChannel* source, GIOCondition condition, gpointer data)
                                        MEDIA_SERVER_SRVC,
                                        MEDIA_SERVER_PATH,
                                        MEDIA_SERVER_INTF,
-                                       MEDIA_SERVER_METH,
+                                       "pause",
                                        NULL,
                                        DBUS_TYPE_INVALID);
                }
@@ -93,8 +109,8 @@ on_file_changed(GIOChannel* source, GIOCondition condition, gpointer data)
        if (new_volume != volume) {
                gconf_client_set_int(headphoned->client, GCONF_VOLUME_CONTROL,
                                new_volume, NULL);
-               gconf_client_suggest_sync(headphoned->client, NULL);
-               gconf_client_clear_cache(headphoned->client);
+               /*gconf_client_suggest_sync(headphoned->client, NULL);
+               gconf_client_clear_cache(headphoned->client);*/
        }
 #endif
        headphoned->initial = FALSE;