[maemo-commits] [maemo-commits] r13541 - in projects/haf/trunk/hildon-fm: . debian hildon-fm
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Fri Aug 31 18:16:15 EEST 2007
- Previous message: [maemo-commits] r13540 - projects/haf/trunk/hildon-fm
- Next message: [maemo-commits] r13542 - in projects/haf/trunk/hildon-fm: . debian hildon-fm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: marivoll
Date: 2007-08-31 18:16:13 +0300 (Fri, 31 Aug 2007)
New Revision: 13541
Modified:
projects/haf/trunk/hildon-fm/ChangeLog
projects/haf/trunk/hildon-fm/debian/changelog
projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-obex.c
projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-settings.c
Log:
* hildon-fm/hildon-file-system-settings.c: change
::bonding-changed property to ::bondings, containing the number of
addresses.
(request_bonding_list) (bonding_list_received): Added
(hildon_file_system_settings_handle_dbus_signal): request bondings
list when bondings change. Fixes NB64420.
* hildon-fm/hildon-file-system-obex.c (bonding_changed): moved to
(bondings_changed): get number of addresses to know whether the
obex location is visible or not
Modified: projects/haf/trunk/hildon-fm/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-fm/ChangeLog 2007-08-31 15:11:03 UTC (rev 13540)
+++ projects/haf/trunk/hildon-fm/ChangeLog 2007-08-31 15:16:13 UTC (rev 13541)
@@ -1,5 +1,16 @@
2007-08-31 Marius Vollmer <marius.vollmer at nokia.com>
+ * hildon-fm/hildon-file-system-settings.c: change
+ ::bonding-changed property to ::bondings, containing the number of
+ addresses.
+ (request_bonding_list) (bonding_list_received): Added
+ (hildon_file_system_settings_handle_dbus_signal): request bondings
+ list when bondings change. Fixes NB64420.
+
+ * hildon-fm/hildon-file-system-obex.c (bonding_changed): moved to
+ (bondings_changed): get number of addresses to know whether the
+ obex location is visible or not
+
Fark, had to put half of our own asynchronicity magic back. I
feel stupid now for removing it in the first place...
Modified: projects/haf/trunk/hildon-fm/debian/changelog
===================================================================
--- projects/haf/trunk/hildon-fm/debian/changelog 2007-08-31 15:11:03 UTC (rev 13540)
+++ projects/haf/trunk/hildon-fm/debian/changelog 2007-08-31 15:16:13 UTC (rev 13541)
@@ -4,7 +4,7 @@
* Do not show USB mass storage device when no volumes are mounted.
Fixes: NB#62319.
* Correct sort order of top-level items. Fixes: NB#65611.
- * Fixes: NB#65543, NB#67080, NB#66863.
+ * Fixes: NB#65543, NB#67080, NB#66863, NB#64420.
-- Marius Vollmer <marius.vollmer at nokia.com> Tue, 14 Aug 2007 19:48:47 +0300
Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-obex.c
===================================================================
--- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-obex.c 2007-08-31 15:11:03 UTC (rev 13540)
+++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-obex.c 2007-08-31 15:16:13 UTC (rev 13541)
@@ -81,11 +81,16 @@
}
static void
-bonding_changed (GObject *settings, GParamSpec *param, gpointer data)
+bondings_changed (GObject *settings, GParamSpec *param, gpointer data)
{
HildonFileSystemObex *obex = HILDON_FILE_SYSTEM_OBEX (data);
+ gint bondings;
- obex->has_children = FALSE;
+ g_object_get (settings, "bondings", &bondings, NULL);
+
+ obex->has_children = (bondings > 0);
+
+ g_signal_emit_by_name (data, "changed");
g_signal_emit_by_name (data, "rescan");
}
@@ -107,8 +112,8 @@
device->bonding_handler_id =
g_signal_connect (fs_settings,
- "notify::bonding-changed",
- G_CALLBACK (bonding_changed),
+ "notify::bondings",
+ G_CALLBACK (bondings_changed),
device);
}
@@ -163,7 +168,7 @@
hildon_file_system_special_location_set_display_name (child, name);
g_free (name);
}
-
+
g_free (new_uri);
child->basepath = g_strdup (uri);
Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-settings.c
===================================================================
--- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-settings.c 2007-08-31 15:11:03 UTC (rev 13540)
+++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-settings.c 2007-08-31 15:16:13 UTC (rev 13541)
@@ -60,7 +60,7 @@
PROP_MMC_CORRUPTED,
PROP_INTERNAL_MMC_CORRUPTED,
PROP_IAP_CONNECTED,
- PROP_BONDING_CHANGED
+ PROP_BONDINGS
};
#define PRIVATE(obj) HILDON_FILE_SYSTEM_SETTINGS(obj)->priv
@@ -106,6 +106,7 @@
#define BTNAME_REQ_GET "GetName"
#define BTNAME_SIG_CHANGED "NameChanged"
+#define BTNAME_LIST_BONDINGS "ListBondings"
#define BTNAME_MATCH_RULE "type='signal',interface='" BTNAME_SIGNAL_IF \
"',member='" BTNAME_SIG_CHANGED "'"
@@ -131,6 +132,8 @@
gboolean mmc_is_corrupted;
gboolean mmc_used_over_usb;
gboolean mmc_cover_open;
+
+ gint bondings;
};
G_DEFINE_TYPE(HildonFileSystemSettings, \
@@ -176,8 +179,8 @@
case PROP_IAP_CONNECTED:
g_value_set_boolean(value, priv->iap_connected);
break;
- case PROP_BONDING_CHANGED:
- g_value_set_boolean(value, TRUE);
+ case PROP_BONDINGS:
+ g_value_set_int(value, priv->bondings);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -378,6 +381,57 @@
}
}
+static void
+bonding_list_received (DBusPendingCall *call,
+ HildonFileSystemSettings *self)
+{
+ DBusMessage *reply;
+ DBusMessageIter iter, list_iter;
+ gint n_elements = 0;
+
+ reply = dbus_pending_call_steal_reply(call);
+
+ if (reply)
+ {
+ dbus_message_iter_init (reply, &iter);
+ dbus_message_iter_recurse (&iter, &list_iter);
+
+ while (dbus_message_iter_get_arg_type (&list_iter) == DBUS_TYPE_STRING)
+ {
+ n_elements++;
+ dbus_message_iter_next (&list_iter);
+ }
+
+ dbus_message_unref (reply);
+ }
+
+ self->priv->bondings = n_elements;
+ g_object_notify (G_OBJECT (self), "bondings");
+}
+
+static void
+request_bonding_list (HildonFileSystemSettings *self)
+{
+ DBusMessage *request;
+ DBusPendingCall *pending_call;
+
+ request = dbus_message_new_method_call(BTNAME_SERVICE,
+ BTNAME_REQUEST_PATH,
+ BTNAME_REQUEST_IF,
+ BTNAME_LIST_BONDINGS);
+
+ if (dbus_connection_send_with_reply (self->priv->dbus_conn,
+ request, &pending_call, -1))
+ {
+ dbus_pending_call_set_notify (pending_call,
+ (DBusPendingCallNotifyFunction) bonding_list_received,
+ self, NULL);
+ dbus_pending_call_unref (pending_call);
+ }
+
+ dbus_message_unref (request);
+}
+
static DBusHandlerResult
hildon_file_system_settings_handle_dbus_signal(DBusConnection *conn,
DBusMessage *msg,
@@ -397,7 +451,7 @@
|| dbus_message_is_signal(msg, "org.bluez.Adapter",
"BondingRemoved"))
{
- g_object_notify (data, "bonding-changed");
+ request_bonding_list (HILDON_FILE_SYSTEM_SETTINGS (data));
}
else if (dbus_message_is_signal (msg, ICD_DBUS_INTERFACE,
ICD_STATUS_CHANGED_SIG))
@@ -697,10 +751,10 @@
g_param_spec_boolean("iap-connected", "IAP Connected",
"Whether or not we have a internet connection",
FALSE, G_PARAM_READABLE));
- g_object_class_install_property(object_class, PROP_BONDING_CHANGED,
- g_param_spec_boolean("bonding-changed", "Bluetooth bondings changed",
- "Hack: only used for notify signals...",
- FALSE, G_PARAM_READABLE));
+ g_object_class_install_property(object_class, PROP_BONDINGS,
+ g_param_spec_int("bondings", "Bluetooth bondings",
+ "Number of bluetooth bondings",
+ 0, G_MAXINT, 0, G_PARAM_READABLE));
}
static gboolean delayed_init(gpointer data)
- Previous message: [maemo-commits] r13540 - projects/haf/trunk/hildon-fm
- Next message: [maemo-commits] r13542 - in projects/haf/trunk/hildon-fm: . debian hildon-fm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
