[PATCH] Re: How to find the NM version?
- From: Jirka Klimes <jklimes redhat com>
- To: networkmanager-list gnome org
- Subject: [PATCH] Re: How to find the NM version?
- Date: Wed, 22 Sep 2010 16:46:39 +0200
On Wednesday 23 of September 2009 06:40:03 Dan Williams wrote:
> On Tue, 2009-09-22 at 17:44 -0700, Raj Sidh wrote:
> > Hello,
> >
> > I find that some NetworkManager dbus APIs are of older version in some
> > distros (e.g. Ubuntu 8.04) whereas Fedora 9 seems to have what is listed
> > under http://projects.gnome.org/NetworkManager/developers/spec.html
> > which apparently is 0.7.0. How do I determine what version of NM I am
> > running so I can make right choices (bus.GetDevices() vs.
> > bus.getDevices() and similar) ?
>
> Programmatically, you can use some tricks to figrue it out like you
> mention, but Tambet also proposed the addition of a Version property on
> the /org/freedesktop/NetworkManager base object that we can add to both
> 0.7.2 and 0.8+.
>
> 0.7.0 vs. 0.7.1 shouldn't be difference to care about, it's mostly
> between 0.6, 0.7, and 0.8.
>
> Dan
>
I think Version property is really helpful. I don't know whether a patch
exists. Anyway, I'm attaching a patch to add the property.
Jirka
diff --git a/introspection/nm-manager-client.xml b/introspection/nm-manager-client.xml
index f30d1d6..24e4a29 100644
--- a/introspection/nm-manager-client.xml
+++ b/introspection/nm-manager-client.xml
@@ -61,6 +61,7 @@ object. dbus-glib generates the same bound function names for D-Bus the methods
<property name="WwanEnabled" type="b" access="readwrite"/>
<property name="WwanHardwareEnabled" type="b" access="read"/>
<property name="ActiveConnections" type="ao" access="read"/>
+ <property name="Version" type="s" access="read"/>
<property name="State" type="u" access="read"/>
<signal name="StateChanged">
diff --git a/introspection/nm-manager.xml b/introspection/nm-manager.xml
index e1b4667..f281d9d 100644
--- a/introspection/nm-manager.xml
+++ b/introspection/nm-manager.xml
@@ -206,6 +206,12 @@
</tp:docstring>
</property>
+ <property name="Version" type="s" access="read">
+ <tp:docstring>
+ NetworkManager version.
+ </tp:docstring>
+ </property>
+
<property name="State" type="u" access="read" tp:type="NM_STATE">
<tp:docstring>
The overall state of the NetworkManager daemon.
diff --git a/src/nm-manager.c b/src/nm-manager.c
index abe30bf..591c073 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -274,6 +274,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
enum {
PROP_0,
+ PROP_VERSION,
PROP_STATE,
PROP_NETWORKING_ENABLED,
PROP_WIRELESS_ENABLED,
@@ -4398,6 +4399,9 @@ get_property (GObject *object, guint prop_id,
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
switch (prop_id) {
+ case PROP_VERSION:
+ g_value_set_string (value, VERSION);
+ break;
case PROP_STATE:
nm_manager_update_state (self);
g_value_set_uint (value, priv->state);
@@ -4588,6 +4592,14 @@ nm_manager_class_init (NMManagerClass *manager_class)
/* properties */
g_object_class_install_property
+ (object_class, PROP_VERSION,
+ g_param_spec_string (NM_MANAGER_VERSION,
+ "Version",
+ "NetworkManager version",
+ NULL,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property
(object_class, PROP_STATE,
g_param_spec_uint (NM_MANAGER_STATE,
"State",
diff --git a/src/nm-manager.h b/src/nm-manager.h
index 889938d..280d554 100644
--- a/src/nm-manager.h
+++ b/src/nm-manager.h
@@ -35,6 +35,7 @@
#define NM_IS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_MANAGER))
#define NM_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_MANAGER, NMManagerClass))
+#define NM_MANAGER_VERSION "version"
#define NM_MANAGER_STATE "state"
#define NM_MANAGER_NETWORKING_ENABLED "networking-enabled"
#define NM_MANAGER_WIRELESS_ENABLED "wireless-enabled"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]