[gnome-bluetooth] Use GLib log facilities appropriately
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] Use GLib log facilities appropriately
- Date: Mon, 7 Feb 2011 00:09:10 +0000 (UTC)
commit 011e3354fdd57cc8258fae73bf2ad22198ddf95a
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sun Dec 19 15:17:53 2010 +0100
Use GLib log facilities appropriately
Set a G_LOG_DOMAIN specific for the library and for the applet, so
that messages can be filtered, and use the correct log level (which
is debug, not message)
https://bugzilla.gnome.org/show_bug.cgi?id=637572
applet/Makefile.am | 2 +-
lib/Makefile.am | 2 +-
lib/bluetooth-killswitch.c | 33 ++++++++++++++++-----------------
lib/plugins/geoclue.c | 2 +-
wizard/bluetooth-input.c | 4 ++--
wizard/main.c | 2 +-
6 files changed, 22 insertions(+), 23 deletions(-)
---
diff --git a/applet/Makefile.am b/applet/Makefile.am
index 4bb5345..961e19f 100644
--- a/applet/Makefile.am
+++ b/applet/Makefile.am
@@ -14,7 +14,7 @@ test_agentdialog_LDADD = $(builddir)/libgnome-bluetooth-applet.la $(APPLET_LIBS)
test_icon_SOURCES = test-icon.c notify.h notify.c
test_icon_LDADD = $(APPLET_LIBS)
-AM_CFLAGS += $(APPLET_CFLAGS) $(WARN_CFLAGS) $(DISABLE_DEPRECATED) -DPKGDATADIR="\"$(pkgdatadir)\""
+AM_CFLAGS += $(APPLET_CFLAGS) $(WARN_CFLAGS) $(DISABLE_DEPRECATED) -DPKGDATADIR="\"$(pkgdatadir)\"" -DG_LOG_DOMAIN=\"BluetoothApplet\"
INCLUDES = -I$(top_srcdir)/lib
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 5ffd180..71135e5 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -73,7 +73,7 @@ AM_CFLAGS = \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED) \
-DPLUGINDIR=\"$(libdir)/gnome-bluetooth/plugins\" \
- -DG_LOG_DOMAIN=\"libgnome-bluetooth\"
+ -DG_LOG_DOMAIN=\"Bluetooth\"
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
diff --git a/lib/bluetooth-killswitch.c b/lib/bluetooth-killswitch.c
index c46c829..6e9b584 100644
--- a/lib/bluetooth-killswitch.c
+++ b/lib/bluetooth-killswitch.c
@@ -128,9 +128,8 @@ update_killswitch (BluetoothKillswitch *killswitch,
}
if (changed != FALSE) {
- g_message ("updating killswitch status %d to %s",
- index,
- state_to_string (bluetooth_killswitch_get_state (killswitch)));
+ g_debug ("updating killswitch status %d to %s",
+ index, state_to_string (bluetooth_killswitch_get_state (killswitch)));
g_signal_emit (G_OBJECT (killswitch),
signals[STATE_CHANGED],
0, bluetooth_killswitch_get_state (killswitch));
@@ -180,8 +179,8 @@ bluetooth_killswitch_get_state (BluetoothKillswitch *killswitch)
for (l = priv->killswitches ; l ; l = l->next) {
BluetoothIndKillswitch *ind = l->data;
- g_message ("killswitch %d is %s",
- ind->index, state_to_string (ind->state));
+ g_debug ("killswitch %d is %s",
+ ind->index, state_to_string (ind->state));
if (ind->state == KILLSWITCH_STATE_HARD_BLOCKED) {
state = KILLSWITCH_STATE_HARD_BLOCKED;
@@ -196,7 +195,7 @@ bluetooth_killswitch_get_state (BluetoothKillswitch *killswitch)
state = ind->state;
}
- g_message ("killswitches state %s", state_to_string (state));
+ g_debug ("killswitches state %s", state_to_string (state));
return state;
}
@@ -222,7 +221,7 @@ remove_killswitch (BluetoothKillswitch *killswitch,
BluetoothIndKillswitch *ind = l->data;
if (ind->index == index) {
priv->killswitches = g_list_remove (priv->killswitches, ind);
- g_message ("removing killswitch idx %d", index);
+ g_debug ("removing killswitch idx %d", index);
g_free (ind);
g_signal_emit (G_OBJECT (killswitch),
signals[STATE_CHANGED],
@@ -241,7 +240,7 @@ add_killswitch (BluetoothKillswitch *killswitch,
BluetoothKillswitchPrivate *priv = BLUETOOTH_KILLSWITCH_GET_PRIVATE (killswitch);
BluetoothIndKillswitch *ind;
- g_message ("adding killswitch idx %d state %s", index, state_to_string (state));
+ g_debug ("adding killswitch idx %d state %s", index, state_to_string (state));
ind = g_new0 (BluetoothIndKillswitch, 1);
ind->index = index;
ind->state = state;
@@ -289,11 +288,11 @@ op_to_string (unsigned int op)
static void
print_event (struct rfkill_event *event)
{
- g_message ("RFKILL event: idx %u type %u (%s) op %u (%s) soft %u hard %u",
- event->idx,
- event->type, type_to_string (event->type),
- event->op, op_to_string (event->op),
- event->soft, event->hard);
+ g_debug ("RFKILL event: idx %u type %u (%s) op %u (%s) soft %u hard %u",
+ event->idx,
+ event->type, type_to_string (event->type),
+ event->op, op_to_string (event->op),
+ event->soft, event->hard);
}
static gboolean
@@ -345,7 +344,7 @@ carry_on:
signals[STATE_CHANGED],
0, bluetooth_killswitch_get_state (killswitch));
} else {
- g_message ("something else happened");
+ g_debug ("something else happened");
return FALSE;
}
@@ -369,7 +368,7 @@ bluetooth_killswitch_init (BluetoothKillswitch *killswitch)
}
if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
- g_message ("Can't set RFKILL control device to non-blocking");
+ g_debug ("Can't set RFKILL control device to non-blocking");
close(fd);
return;
}
@@ -382,12 +381,12 @@ bluetooth_killswitch_init (BluetoothKillswitch *killswitch)
if (len < 0) {
if (errno == EAGAIN)
break;
- g_message ("Reading of RFKILL events failed");
+ g_debug ("Reading of RFKILL events failed");
break;
}
if (len != RFKILL_EVENT_SIZE_V1) {
- g_warning("Wrong size of RFKILL event\n");
+ g_warning ("Wrong size of RFKILL event\n");
continue;
}
diff --git a/lib/plugins/geoclue.c b/lib/plugins/geoclue.c
index 4966f64..0a17033 100644
--- a/lib/plugins/geoclue.c
+++ b/lib/plugins/geoclue.c
@@ -192,7 +192,7 @@ device_removed (const char *bdaddr)
str = gconf_client_get_string (client, GPS_KEY, NULL);
if (g_strcmp0 (str, bdaddr) == 0) {
gconf_client_set_string (client, GPS_KEY, "", NULL);
- g_message ("Device '%s' got disabled as a Geoclue GPS", bdaddr);
+ g_debug ("Device '%s' got disabled as a Geoclue GPS", bdaddr);
}
g_free (str);
diff --git a/wizard/bluetooth-input.c b/wizard/bluetooth-input.c
index b3fbdaf..83eb058 100644
--- a/wizard/bluetooth-input.c
+++ b/wizard/bluetooth-input.c
@@ -190,12 +190,12 @@ bluetooth_input_check_for_devices (BluetoothInput *input)
if (bluetooth_input_device_get_type (&device_info[i], &is_mouse, &is_keyboard) == FALSE)
continue;
if (is_mouse != FALSE) {
- g_message ("has mouse: %s (id = %d)", device_info[i].name, device_info[i].id);
+ g_debug ("has mouse: %s (id = %d)", device_info[i].name, device_info[i].id);
has_mouse = TRUE;
//break;
}
if (is_keyboard != FALSE) {
- g_message ("has keyboard: %s (id = %d)", device_info[i].name, device_info[i].id);
+ g_debug ("has keyboard: %s (id = %d)", device_info[i].name, device_info[i].id);
has_keyboard = TRUE;
//break;
}
diff --git a/wizard/main.c b/wizard/main.c
index dc40092..de079d8 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -352,7 +352,7 @@ connect_callback (BluetoothClient *_client,
}
if (success == FALSE)
- g_message ("Failed to connect to device %s", data->path);
+ g_debug ("Failed to connect to device %s", data->path);
g_timer_destroy (data->timer);
g_free (data->path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]