[packages/google-gadgets] Drop XUL support, as it doesn't build since xulrunner 4.0 (15.0 is current) Fix building with gcc 4.
baggins
baggins at pld-linux.org
Thu Aug 30 08:38:41 CEST 2012
commit de154302f4ca989cab7f2fc2cf11b24ff03ca5d6
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Thu Aug 30 08:37:17 2012 +0200
Drop XUL support, as it doesn't build since xulrunner 4.0 (15.0 is current)
Fix building with gcc 4.7 and glib2 2.32+
Update to NetworkManager 0.9 API
gcc-4.7.patch | 325 +++++++++++++++++++++++++++++++++++++++++++++++
glib-2.32.patch | 33 +++++
google-gadgets.spec | 38 ++----
nm-mobile-devtypes.patch | 38 ++++++
nm09.patch | 204 +++++++++++++++++++++++++++++
5 files changed, 613 insertions(+), 25 deletions(-)
---
diff --git a/google-gadgets.spec b/google-gadgets.spec
index a4633bd..52b79bc 100644
--- a/google-gadgets.spec
+++ b/google-gadgets.spec
@@ -11,7 +11,7 @@
Summary: Google Gadgets for Linux
Name: google-gadgets
Version: 0.11.2
-Release: 7
+Release: 8
License: Apache License v2.0
Group: X11/Applications
#Source0: %{name}-for-linux-%{version}-%{rev}.tar.bz2
@@ -22,6 +22,10 @@ Source2: %{name}-for-linux-qt.desktop
Patch0: %{name}-for-linux-cmake.patch
Patch1: %{name}-for-linux-link_with_qtnetwork.patch
Patch2: %{name}-for-linux-js.patch
+Patch3: gcc-4.7.patch
+Patch4: glib-2.32.patch
+Patch5: nm09.patch
+Patch6: nm-mobile-devtypes.patch
URL: http://code.google.com/p/google-gadgets-for-linux/
BuildRequires: NetworkManager-devel >= 0.6.5
%if %{with qt}
@@ -48,7 +52,6 @@ BuildRequires: libtool >= 2:1.5.22
BuildRequires: libxml2-devel >= 1:2.4.0
BuildRequires: pkgconfig
BuildRequires: qt4-build
-BuildRequires: xulrunner-devel >= 1.8
BuildRequires: zip
BuildRequires: zlib-devel >= 1.2.0
Requires: libggadget = %{version}-%{release}
@@ -139,7 +142,6 @@ Summary: GTK+ Version of Google Gadgets
Group: X11/Applications
Requires: google-gadgets = %{version}-%{release}
Requires: google-gadgets-gst = %{version}-%{release}
-Requires: google-gadgets-xul = %{version}-%{release}
Requires: libggadget-gtk = %{version}-%{release}
Obsoletes: google-gadgets-for-linux-gtk
@@ -181,25 +183,15 @@ well as the Universal Gadgets on iGoogle.
This package includes the GStreamer modules.
-%package xul
-Summary: XULRunner modules for Google Gadgets
-Group: X11/Applications
-Requires: libggadget = %{version}-%{release}
-Requires: xulrunner
-
-%description xul
-Google Gadgets for Linux provides a platform for running desktop
-gadgets under Linux, catering to the unique needs of Linux users. It's
-compatible with the gadgets written for Google Desktop for Windows as
-well as the Universal Gadgets on iGoogle.
-
-This package includes the XULRunner modules.
-
%prep
%setup -q -n %{name}-for-linux-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
%build
install -d libltdl
@@ -213,7 +205,9 @@ install -d libltdl
--disable-static \
--disable-werror \
--with-oem-brand=pld-linux \
- --with-browser-plugins-dir=%{_libdir}/browser-plugins
+ --with-browser-plugins-dir=%{_libdir}/browser-plugins \
+ --disable-gtkmoz-browser-element \
+ --disable-smjs-script-runtime
%{__make}
@@ -221,7 +215,7 @@ install -d libltdl
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
-%{__make} install \
+%{__make} -j1 install \
DESTDIR=$RPM_BUILD_ROOT
# desync with cmake/ac makefiles
@@ -366,9 +360,3 @@ rm -rf $RPM_BUILD_ROOT
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/google-gadgets/modules/gst-audio-framework.so
%attr(755,root,root) %{_libdir}/google-gadgets/modules/gst-video-element.so
-
-%files xul
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/google-gadgets/modules/smjs-script-runtime.so
-%attr(755,root,root) %{_libdir}/google-gadgets/modules/gtkmoz-browser-element.so
-%attr(755,root,root) %{_libdir}/google-gadgets/gtkmoz-browser-child
diff --git a/gcc-4.7.patch b/gcc-4.7.patch
new file mode 100644
index 0000000..2e77e10
--- /dev/null
+++ b/gcc-4.7.patch
@@ -0,0 +1,325 @@
+Author: Pino Toscano <pino at debian.org>
+Description: Fix building with GCC 4.7
+ This patch fixes the two kinds of issues that arise with GCC 4.7:
+ - include <unistd.h> for functions like access(), fork(), readlink(), etc
+ - fix argument-dependent lookup issues by qualifying the lookup of functions
+Forwarded: no
+Last-Update: 2012-04-04
+
+--- a/ggadget/scriptable_enumerator.h
++++ b/ggadget/scriptable_enumerator.h
+@@ -68,22 +68,22 @@
+
+ protected:
+ virtual void DoClassRegister() {
+- RegisterMethod("atEnd",
++ this->RegisterMethod("atEnd",
+ NewSlot(&E::AtEnd,
+ &ScriptableEnumerator<E, Wrapper, Param, ClassId>
+ ::enumerator_));
+- RegisterMethod("moveFirst",
++ this->RegisterMethod("moveFirst",
+ NewSlot(&E::MoveFirst,
+ &ScriptableEnumerator<E, Wrapper, Param, ClassId>
+ ::enumerator_));
+- RegisterMethod("moveNext",
++ this->RegisterMethod("moveNext",
+ NewSlot(&E::MoveNext,
+ &ScriptableEnumerator<E, Wrapper, Param, ClassId>
+ ::enumerator_));
+- RegisterMethod("item",
++ this->RegisterMethod("item",
+ NewSlot(&ScriptableEnumerator<E, Wrapper, Param, ClassId>
+ ::GetItem));
+- RegisterProperty("count",
++ this->RegisterProperty("count",
+ NewSlot(&E::GetCount,
+ &ScriptableEnumerator<E, Wrapper, Param, ClassId>
+ ::enumerator_),
+--- a/ggadget/uuid.cc
++++ b/ggadget/uuid.cc
+@@ -24,6 +24,7 @@
+ #include <cstdlib>
+ #include <cstring>
+ #include <ctime>
++#include <unistd.h>
+
+ #include "string_utils.h"
+
+--- a/ggadget/xml_dom.cc
++++ b/ggadget/xml_dom.cc
+@@ -1327,15 +1327,15 @@
+
+ virtual void DoClassRegister() {
+ Super::DoClassRegister();
+- RegisterProperty("data", NewSlot(&DOMCharacterData::GetData),
++ this->RegisterProperty("data", NewSlot(&DOMCharacterData::GetData),
+ NewSlot(&DOMCharacterData::SetData));
+- RegisterProperty("length", NewSlot(&DOMCharacterData::GetLength), NULL);
+- RegisterMethod("substringData",
++ this->RegisterProperty("length", NewSlot(&DOMCharacterData::GetLength), NULL);
++ this->RegisterMethod("substringData",
+ NewSlot(&DOMCharacterData::ScriptSubstringData));
+- RegisterMethod("appendData", NewSlot(&DOMCharacterData::AppendData));
+- RegisterMethod("insertData", NewSlot(&DOMCharacterData::ScriptInsertData));
+- RegisterMethod("deleteData", NewSlot(&DOMCharacterData::ScriptDeleteData));
+- RegisterMethod("replaceData",
++ this->RegisterMethod("appendData", NewSlot(&DOMCharacterData::AppendData));
++ this->RegisterMethod("insertData", NewSlot(&DOMCharacterData::ScriptInsertData));
++ this->RegisterMethod("deleteData", NewSlot(&DOMCharacterData::ScriptDeleteData));
++ this->RegisterMethod("replaceData",
+ NewSlot(&DOMCharacterData::ScriptReplaceData));
+ }
+
+@@ -1377,20 +1377,20 @@
+ private:
+ UTF16String ScriptSubstringData(size_t offset, size_t count) {
+ UTF16String result;
+- CheckException(SubstringData(offset, count, &result));
++ this->CheckException(SubstringData(offset, count, &result));
+ return result;
+ }
+
+ void ScriptInsertData(size_t offset, const UTF16String &arg) {
+- CheckException(InsertData(offset, arg));
++ this->CheckException(InsertData(offset, arg));
+ }
+
+ void ScriptDeleteData(size_t offset, size_t count) {
+- CheckException(DeleteData(offset, count));
++ this->CheckException(DeleteData(offset, count));
+ }
+
+ void ScriptReplaceData(size_t offset, size_t count, const UTF16String &arg) {
+- CheckException(ReplaceData(offset, count, arg));
++ this->CheckException(ReplaceData(offset, count, arg));
+ }
+
+ DOMCharacterDataImpl impl_;
+@@ -1417,10 +1417,10 @@
+
+ virtual void DoClassRegister() {
+ Super::DoClassRegister();
+- RegisterProperty("name", NewSlot(&DOMAttr::GetName), NULL);
++ this->RegisterProperty("name", NewSlot(&DOMAttr::GetName), NULL);
+ // Our DOMAttrs are always specified, because we don't support DTD for now.
+- RegisterConstant("specified", true);
+- RegisterProperty("value", NewSlot(&DOMAttr::GetValue),
++ this->RegisterConstant("specified", true);
++ this->RegisterProperty("value", NewSlot(&DOMAttr::GetValue),
+ NewSlot(&DOMAttr::SetValue));
+ // ownerElement is a DOM2 property, so not registered for now.
+ }
+@@ -1516,19 +1516,19 @@
+
+ virtual void DoClassRegister() {
+ Super::DoClassRegister();
+- RegisterProperty("tagName", NewSlot(&DOMElement::GetTagName), NULL);
+- RegisterMethod("getAttribute", NewSlot(&DOMElement::GetAttribute));
+- RegisterMethod("setAttribute",
++ this->RegisterProperty("tagName", NewSlot(&DOMElement::GetTagName), NULL);
++ this->RegisterMethod("getAttribute", NewSlot(&DOMElement::GetAttribute));
++ this->RegisterMethod("setAttribute",
+ NewSlot(&DOMElement::ScriptSetAttribute));
+- RegisterMethod("removeAttribute",
++ this->RegisterMethod("removeAttribute",
+ NewSlot(&DOMElement::RemoveAttribute));
+- RegisterMethod("getAttributeNode",
++ this->RegisterMethod("getAttributeNode",
+ NewSlot(&DOMElement::GetAttributeNodeNotConst));
+- RegisterMethod("setAttributeNode",
++ this->RegisterMethod("setAttributeNode",
+ NewSlot(&DOMElement::ScriptSetAttributeNode));
+- RegisterMethod("removeAttributeNode",
++ this->RegisterMethod("removeAttributeNode",
+ NewSlot(&DOMElement::ScriptRemoveAttributeNode));
+- RegisterMethod("getElementsByTagName",
++ this->RegisterMethod("getElementsByTagName",
+ NewSlot(&Super::GetElementsByTagNameNotConst));
+ }
+
+@@ -1696,16 +1696,16 @@
+ }
+
+ virtual void DoClassRegister() {
+- RegisterProperty("length", NewSlot(&AttrsNamedMap::GetLength), NULL);
+- RegisterMethod("getNamedItem",
++ this->RegisterProperty("length", NewSlot(&AttrsNamedMap::GetLength), NULL);
++ this->RegisterMethod("getNamedItem",
+ NewSlot(&AttrsNamedMap::GetNamedItemNotConst));
+- RegisterMethod("setNamedItem",
++ this->RegisterMethod("setNamedItem",
+ NewSlot(&AttrsNamedMap::ScriptSetNamedItem));
+- RegisterMethod("removeNamedItem",
++ this->RegisterMethod("removeNamedItem",
+ NewSlot(&AttrsNamedMap::ScriptRemoveNamedItem));
+- RegisterMethod("item", NewSlot(&AttrsNamedMap::GetItemNotConst));
++ this->RegisterMethod("item", NewSlot(&AttrsNamedMap::GetItemNotConst));
+ // Microsoft compatibility.
+- RegisterMethod("", NewSlot(&AttrsNamedMap::GetItemNotConst));
++ this->RegisterMethod("", NewSlot(&AttrsNamedMap::GetItemNotConst));
+ }
+
+ virtual DOMNodeInterface *GetNamedItem(const std::string &name) {
+@@ -1875,7 +1875,7 @@
+
+ virtual void DoClassRegister() {
+ Super::DoClassRegister();
+- RegisterMethod("splitText", NewSlot(&DOMText::ScriptSplitText));
++ this->RegisterMethod("splitText", NewSlot(&DOMText::ScriptSplitText));
+ }
+
+ virtual NodeType GetNodeType() const { return TEXT_NODE; }
+@@ -2060,9 +2060,9 @@
+
+ virtual void DoClassRegister() {
+ Super::DoClassRegister();
+- RegisterProperty("target",
++ this->RegisterProperty("target",
+ NewSlot(&DOMProcessingInstruction::GetTarget), NULL);
+- RegisterProperty("data", NewSlot(&DOMProcessingInstruction::GetData),
++ this->RegisterProperty("data", NewSlot(&DOMProcessingInstruction::GetData),
+ NewSlot(&DOMProcessingInstruction::SetData));
+ }
+
+@@ -2109,7 +2109,7 @@
+ DEFINE_CLASS_ID(0xd23149a89cf24e12, DOMImplementationInterface);
+
+ virtual void DoClassRegister() {
+- RegisterMethod("hasFeature", NewSlot(&DOMImplementation::HasFeature));
++ this->RegisterMethod("hasFeature", NewSlot(&DOMImplementation::HasFeature));
+ }
+
+ virtual bool HasFeature(const char *feature, const char *version) const {
+@@ -2129,13 +2129,13 @@
+ void SetCode(int code) { code_ = code; }
+
+ virtual void DoClassRegister() {
+- RegisterProperty("errorCode", NewSlot(&ParseError::GetCode), NULL);
+- RegisterConstant("filepos", 0);
+- RegisterConstant("line", 0);
+- RegisterConstant("linepos", 0);
+- RegisterConstant("reason", "");
+- RegisterConstant("srcText", "");
+- RegisterConstant("url", "");
++ this->RegisterProperty("errorCode", NewSlot(&ParseError::GetCode), NULL);
++ this->RegisterConstant("filepos", 0);
++ this->RegisterConstant("line", 0);
++ this->RegisterConstant("linepos", 0);
++ this->RegisterConstant("reason", "");
++ this->RegisterConstant("srcText", "");
++ this->RegisterConstant("url", "");
+ }
+
+ private:
+@@ -2180,45 +2180,45 @@
+
+ virtual void DoClassRegister() {
+ Super::DoClassRegister();
+- RegisterConstant("doctype", static_cast<ScriptableInterface *>(NULL));
+- RegisterConstant("implementation", &dom_implementation_);
+- RegisterProperty("documentElement",
++ this->RegisterConstant("doctype", static_cast<ScriptableInterface *>(NULL));
++ this->RegisterConstant("implementation", &dom_implementation_);
++ this->RegisterProperty("documentElement",
+ NewSlot(&DOMDocument::GetDocumentElementNotConst), NULL);
+- RegisterMethod("loadXML", NewSlot(&DOMDocument::LoadXML));
+- RegisterMethod("createElement",
++ this->RegisterMethod("loadXML", NewSlot(&DOMDocument::LoadXML));
++ this->RegisterMethod("createElement",
+ NewSlot(&DOMDocument::ScriptCreateElement));
+- RegisterMethod("createDocumentFragment",
++ this->RegisterMethod("createDocumentFragment",
+ NewSlot(&DOMDocument::CreateDocumentFragment));
+- RegisterMethod("createTextNode",
++ this->RegisterMethod("createTextNode",
+ NewSlot(&DOMDocument::CreateTextNode));
+- RegisterMethod("createComment", NewSlot(&DOMDocument::CreateComment));
+- RegisterMethod("createCDATASection",
++ this->RegisterMethod("createComment", NewSlot(&DOMDocument::CreateComment));
++ this->RegisterMethod("createCDATASection",
+ NewSlot(&DOMDocument::CreateCDATASection));
+- RegisterMethod("createProcessingInstruction",
++ this->RegisterMethod("createProcessingInstruction",
+ NewSlot(&DOMDocument::ScriptCreateProcessingInstruction));
+- RegisterMethod("createAttribute",
++ this->RegisterMethod("createAttribute",
+ NewSlot(&DOMDocument::ScriptCreateAttribute));
+- RegisterMethod("createEntityReference",
++ this->RegisterMethod("createEntityReference",
+ NewSlot(&DOMDocument::ScriptCreateEntityReference));
+- RegisterMethod("getElementsByTagName",
++ this->RegisterMethod("getElementsByTagName",
+ NewSlot(&Super::GetElementsByTagNameNotConst));
+- RegisterMethod("importNode", NewSlot(&DOMDocument::ScriptImportNode));
++ this->RegisterMethod("importNode", NewSlot(&DOMDocument::ScriptImportNode));
+ // Compatibility with Microsoft DOM.
+- RegisterProperty("parsed", NewFixedGetterSlot(true), NULL);
+- RegisterProperty("parseError", NewSlot(&DOMDocument::GetParseError), NULL);
+- RegisterProperty("resolveExternals", NULL, NewSlot(&DummySetter));
+- RegisterProperty("validateOnParse", NULL, NewSlot(&DummySetter));
+- RegisterProperty("preserveWhiteSpace",
++ this->RegisterProperty("parsed", NewFixedGetterSlot(true), NULL);
++ this->RegisterProperty("parseError", NewSlot(&DOMDocument::GetParseError), NULL);
++ this->RegisterProperty("resolveExternals", NULL, NewSlot(&DummySetter));
++ this->RegisterProperty("validateOnParse", NULL, NewSlot(&DummySetter));
++ this->RegisterProperty("preserveWhiteSpace",
+ NewSlot(&DOMDocument::PreservesWhiteSpace),
+ NewSlot(&DOMDocument::SetPreserveWhiteSpace));
+- RegisterMethod("getProperty", NewSlot(DummyGetProperty));
+- RegisterMethod("setProperty", NewSlot(DummySetProperty));
++ this->RegisterMethod("getProperty", NewSlot(DummyGetProperty));
++ this->RegisterMethod("setProperty", NewSlot(DummySetProperty));
+ // Compatibility with Microsoft DOM: XMLHttpRequest functions.
+- RegisterProperty("async", NewSlot(&DOMDocument::IsAsync),
++ this->RegisterProperty("async", NewSlot(&DOMDocument::IsAsync),
+ NewSlot(&DOMDocument::SetAsync));
+- RegisterProperty("readyState", NewSlot(&DOMDocument::GetReadyState), NULL);
+- RegisterMethod("load", NewSlot(&DOMDocument::Load));
+- RegisterClassSignal("onreadystatechange",
++ this->RegisterProperty("readyState", NewSlot(&DOMDocument::GetReadyState), NULL);
++ this->RegisterMethod("load", NewSlot(&DOMDocument::Load));
++ this->RegisterClassSignal("onreadystatechange",
+ &DOMDocument::onreadystatechange_signal_);
+ }
+
+--- a/ggadget/xdg/icon_theme.cc
++++ b/ggadget/xdg/icon_theme.cc
+@@ -16,6 +16,7 @@
+ #include <sys/time.h>
+ #include <time.h>
+ #include <cstdlib>
++#include <unistd.h>
+
+ #include <map>
+ #include <vector>
+--- a/extensions/qt_system_framework/qt_system_framework.cc
++++ b/extensions/qt_system_framework/qt_system_framework.cc
+@@ -32,6 +32,7 @@
+ #include <ggadget/xdg/desktop_entry.h>
+ #include <ggadget/xdg/icon_theme.h>
+ #include <ggadget/xdg/utilities.h>
++#include <unistd.h>
+
+ #define Initialize qt_system_framework_LTX_Initialize
+ #define Finalize qt_system_framework_LTX_Finalize
+--- a/extensions/linux_system_framework/process.cc
++++ b/extensions/linux_system_framework/process.cc
+@@ -17,6 +17,7 @@
+ #include <sys/types.h>
+ #include <dirent.h>
+ #include <cstdlib>
++#include <unistd.h>
+
+ #ifdef HAVE_X11
+ #include <X11/Xlib.h>
+--- a/gadgets/designer/designer_script_utils.cc
++++ b/gadgets/designer/designer_script_utils.cc
+@@ -39,6 +39,7 @@
+ #include <ggadget/system_utils.h>
+ #include <ggadget/uuid.h>
+ #include <ggadget/view_interface.h>
++#include <unistd.h>
+
+ namespace ggadget {
+ namespace designer {
diff --git a/glib-2.32.patch b/glib-2.32.patch
new file mode 100644
index 0000000..bc7e20e
--- /dev/null
+++ b/glib-2.32.patch
@@ -0,0 +1,33 @@
+Author: Pino Toscano <pino at kde.org>
+Description: Only include <glib.h> instead of other glib headers.
+ Starting with glib 2.32 it is now mandatory to include <glib.h> instead
+ of individual headers.
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=665541
+Origin: vendor
+Forwarded: no
+Last-Update: 2012-03-24
+
+--- a/ggadget/gtk/main_loop.cc
++++ b/ggadget/gtk/main_loop.cc
+@@ -16,9 +16,8 @@
+
+ #include <fcntl.h>
+ #include <stdint.h>
+-#include <glib/ghash.h>
++#include <glib.h>
+ #include <gtk/gtk.h>
+-#include <glib/gthread.h>
+ #include <ggadget/common.h>
+ #include "main_loop.h"
+ #include "utilities.h"
+--- a/hosts/gtk/main.cc
++++ b/hosts/gtk/main.cc
+@@ -15,7 +15,7 @@
+ */
+
+ #include <gtk/gtk.h>
+-#include <glib/gthread.h>
++#include <glib.h>
+ #include <locale.h>
+ #include <signal.h>
+ #include <unistd.h>
diff --git a/nm-mobile-devtypes.patch b/nm-mobile-devtypes.patch
new file mode 100644
index 0000000..36ea7ae
--- /dev/null
+++ b/nm-mobile-devtypes.patch
@@ -0,0 +1,38 @@
+Description: update for additional NM device types
+ This patch adds support for mobile broadband device types.
+ It should be backwards compatible with 0.6, 0.7, and 0.8 as well as using
+ the new device types in 0.9.
+Author: danielcbwilliams at gmail.com
+Bug: http://code.google.com/p/google-gadgets-for-linux/issues/detail?id=378
+
+diff -up google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc.devtypes google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc
+--- google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc.devtypes 2011-03-25 11:04:20.697374611 -0500
++++ google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc 2011-03-25 11:08:01.732611291 -0500
+@@ -26,6 +26,11 @@ namespace linux_system {
+ static const int kDeviceTypeUnknown = 0;
+ static const int kDeviceTypeEthernet = 1;
+ static const int kDeviceTypeWifi = 2;
++static const int kDeviceTypeOldGsm = 3;
++static const int kDeviceTypeOldCdma = 4;
++static const int kDeviceTypeBluetooth = 5;
++static const int kDeviceTypeWimax = 7;
++static const int kDeviceTypeModem = 8;
+
+ // 0.6, 0.7, and 0.8 connected state
+ static const int kOldConnected = 3;
+@@ -171,6 +176,15 @@ void Network::Update() {
+ } else if (type == kDeviceTypeWifi) {
+ connection_type_ = CONNECTION_TYPE_NATIVE_802_11;
+ physcial_media_type_ = PHYSICAL_MEDIA_TYPE_NATIVE_802_11;
++ } else if (type == kDeviceTypeBluetooth) {
++ connection_type_ = CONNECTION_TYPE_WIRELESS_WAN;
++ physcial_media_type_ = PHYSICAL_MEDIA_TYPE_BLUETOOTH;
++ } else if (type == kDeviceTypeModem ||
++ type == kDeviceTypeOldGsm ||
++ type == kDeviceTypeOldCdma ||
++ type == kDeviceTypeWimax) {
++ connection_type_ = CONNECTION_TYPE_WIRELESS_WAN;
++ physcial_media_type_ = PHYSICAL_MEDIA_TYPE_WIRELESS_WAN;
+ } else {
+ connection_type_ = CONNECTION_TYPE_UNKNOWN;
+ physcial_media_type_ = PHYSICAL_MEDIA_TYPE_UNSPECIFIED;
diff --git a/nm09.patch b/nm09.patch
new file mode 100644
index 0000000..45b3a27
--- /dev/null
+++ b/nm09.patch
@@ -0,0 +1,204 @@
+Description: Update for NetworkManager 0.9 API changes
+ This patch updates the code for a few NM 0.9 API changes.
+ It builds, but I have not extensively tested the functionality.
+ NM 0.9 has added a few new connection and device states, and renumbered the
+ existing ones.
+ This means it's possible to keep compatibility with both old and new versions
+ of NM since the state numbers don't conflict.
+ The patch does this by removing some usage of defines from NetworkManager.h.
+ .
+ Furthermore, the device enums aren't going to get renumbered so I added them
+ to the code instead of using the defines. They've been the same since the
+ beginning.
+Author: danielcbwilliams at gmail.com
+Bug: http://code.google.com/p/google-gadgets-for-linux/issues/detail?id=377
+
+diff -up google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc.nm09 google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc
+--- google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc.nm09 2009-03-14 23:12:42.000000000 -0500
++++ google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc 2011-03-25 10:58:29.022771149 -0500
+@@ -23,19 +23,21 @@ namespace ggadget {
+ namespace framework {
+ namespace linux_system {
+
+-#ifdef NM_DEVICE_TYPE_WIFI
+-static const int kDeviceTypeWifi = NM_DEVICE_TYPE_WIFI;
+-#else
+-static const int kDeviceTypeWifi = DEVICE_TYPE_802_11_WIRELESS;
+-#endif
+-
+-#ifdef NM_DEVICE_TYPE_ETHERNET
+-static const int kDeviceTypeEthernet = NM_DEVICE_TYPE_ETHERNET;
+-#else
+-static const int kDeviceTypeEthernet = DEVICE_TYPE_802_3_ETHERNET;
+-#endif
+-
+ static const int kDeviceTypeUnknown = 0;
++static const int kDeviceTypeEthernet = 1;
++static const int kDeviceTypeWifi = 2;
++
++// 0.6, 0.7, and 0.8 connected state
++static const int kOldConnected = 3;
++// New 0.9 connected states
++static const int kConnectedLocal = 50;
++static const int kConnectedSite = 60;
++static const int kConnectedGlobal = 70;
++
++// 0.6, 0.7, and 0.8 activated device state
++static const int kOldDeviceStateActivated = 8;
++// New 0.9 activated device state
++static const int kDeviceStateActivated = 100;
+
+ Network::Network()
+ : is_new_api_(false),
+@@ -59,14 +61,14 @@ Network::Network()
+ is_new_api_ = true;
+ int state;
+ if (network_manager_->GetProperty("State").v().ConvertToInt(&state)) {
+- is_online_ = (state == NM_STATE_CONNECTED);
++ is_online_ = IsOnlineState(state);
+ }
+ } else {
+ DLOG("network manager 0.6.x might be used.");
+ DBusIntReceiver result;
+ if (network_manager_->CallMethod("state", true, kDefaultDBusTimeout,
+ result.NewSlot(), MESSAGE_TYPE_INVALID)) {
+- is_online_ = (result.GetValue() == NM_STATE_CONNECTED);
++ is_online_ = IsOnlineState(result.GetValue());
+ }
+ }
+
+@@ -87,14 +89,21 @@ Network::~Network() {
+ delete network_manager_;
+ }
+
++bool Network::IsOnlineState(int state) {
++ return (state == kOldConnected ||
++ state == kConnectedLocal ||
++ state == kConnectedSite ||
++ state == kConnectedGlobal);
++}
++
+ void Network::OnSignal(const std::string &name, int argc, const Variant *argv) {
+ DLOG("Got signal from network manager: %s", name.c_str());
+ bool need_update = false;
+- // nm 0.6.x uses "StateChange", 0.7.x uses "StateChanged".
++ // nm 0.6.x uses "StateChange", 0.7.x and later use "StateChanged".
+ if (name == "StateChange" || name == "StateChanged") {
+ int state;
+ if (argc >= 1 && argv[0].ConvertToInt(&state)) {
+- is_online_ = (state == NM_STATE_CONNECTED);
++ is_online_ = IsOnlineState(state);
+ DLOG("Network is %s.", is_online_ ? "connected" : "disconnected");
+ if (is_online_) {
+ need_update = true;
+@@ -133,7 +142,8 @@ void Network::Update() {
+ if (is_new_api_) {
+ int state;
+ if (dev->GetProperty("State").v().ConvertToInt(&state))
+- active = (state == 8); // NM_DEVICE_STATE_ACTIVATED
++ active = (state == kOldDeviceStateActivated ||
++ state == kDeviceStateActivated);
+ } else {
+ DBusBooleanReceiver result;
+ if (dev->CallMethod("getLinkActive", true, kDefaultDBusTimeout,
+diff -up google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.h.nm09 google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.h
+--- google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.h.nm09 2011-03-25 10:51:31.120995640 -0500
++++ google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.h 2011-03-25 10:52:03.881586075 -0500
+@@ -55,6 +55,7 @@ class Network : public NetworkInterface
+ private:
+ void OnSignal(const std::string &name, int argc, const Variant *argv);
+ void Update();
++ bool IsOnlineState(int state);
+
+ private:
+ // true if using nm 0.7 or above, false if using nm 0.6.x
+diff -up google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/wireless.cc.nm09 google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/wireless.cc
+--- google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/wireless.cc.nm09 2011-03-25 10:53:42.462353647 -0500
++++ google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/wireless.cc 2011-03-25 11:01:53.707212241 -0500
+@@ -28,11 +28,10 @@
+ #include <ggadget/string_utils.h>
+ #include <ggadget/slot.h>
+
+-// defined in <linux/wireless.h>, but we don't want to introduce such
+-// dependency.
+-#define IW_MODE_AUTO 0
+-#define IW_MODE_ADHOC 1
+-#define IW_MODE_INFRA 2
++// Define them anyway for all versions of NM
++static const int kNmWifiModeUnknown = 0;
++static const int kNmWifiModeAdhoc = 1;
++static const int kNmWifiModeInfra = 2;
+
+ #if !defined(NM_DBUS_SERVICE) || !defined(NM_DBUS_PATH) || \
+ !defined(NM_DBUS_INTERFACE)
+@@ -77,15 +76,15 @@ namespace linux_system {
+
+ using namespace ggadget::dbus;
+
+-#ifdef NM_DEVICE_TYPE_WIFI
+-static const int kDeviceTypeWifi = NM_DEVICE_TYPE_WIFI;
+-#else
+-static const int kDeviceTypeWifi = DEVICE_TYPE_802_11_WIRELESS;
+-#endif
++static const int kDeviceTypeWifi = 2;
+
+ // Defined in nm 0.7
+-static const int kDeviceStateActivated = 8;
+-static const int kDeviceStateFailed = 9;
++static const int kOldDeviceStateActivated = 8;
++static const int kOldDeviceStateFailed = 9;
++// New 0.9 activated device state
++static const int kDeviceStateActivated = 100;
++static const int kDeviceStateDeactivating = 110;
++static const int kDeviceStateFailed = 120;
+
+ class Wireless::Impl {
+ class WirelessAccessPoint : public WirelessAccessPointInterface {
+@@ -191,7 +190,7 @@ class Wireless::Impl {
+
+ void UpdateInfo() {
+ if (ap_) {
+- int mode = IW_MODE_AUTO;
++ int mode = kNmWifiModeUnknown;
+ if (new_api_) { // nm 0.7.x
+ ResultVariant prop = ap_->GetProperty("Ssid");
+ if (prop.v().type() == Variant::TYPE_SCRIPTABLE) {
+@@ -223,9 +222,9 @@ class Wireless::Impl {
+ }
+ }
+
+- if (mode == IW_MODE_ADHOC)
++ if (mode == kNmWifiModeAdhoc)
+ type_ = WIRELESS_TYPE_INDEPENDENT;
+- else if (mode == IW_MODE_INFRA)
++ else if (mode == kNmWifiModeInfra)
+ type_ = WIRELESS_TYPE_INFRASTRUCTURE;
+ else
+ type_ = WIRELESS_TYPE_ANY;
+@@ -404,9 +403,13 @@ class Wireless::Impl {
+ } else if (signal == "StateChanged") { // nm 0.7.x
+ int new_state;
+ if (argc >= 1 && argv[0].ConvertToInt(&new_state)) {
+- connected_ = (new_state == kDeviceStateActivated);
++ connected_ = (new_state == kDeviceStateActivated ||
++ new_state == kOldDeviceStateActivated);
+ connect_performed = (new_state == kDeviceStateActivated ||
+- new_state == kDeviceStateFailed);
++ new_state == kDeviceStateDeactivating ||
++ new_state == kDeviceStateFailed ||
++ new_state == kOldDeviceStateActivated ||
++ new_state == kOldDeviceStateFailed);
+ }
+ } else if (signal == "AccessPointAdded") { // nm 0.7.x
+ std::string ap_path;
+@@ -441,7 +444,9 @@ class Wireless::Impl {
+ if (new_api_ && dev_ && dev_wireless_) {
+ ResultVariant prop = dev_->GetProperty("State");
+ if (prop.v().type() == Variant::TYPE_INT64) {
+- connected_ = (VariantValue<int>()(prop.v()) == kDeviceStateActivated);
++ int state = VariantValue<int>()(prop.v());
++ connected_ = (state == kDeviceStateActivated ||
++ state == kOldDeviceStateActivated);
+ }
+ } else if (!new_api_ && dev_) {
+ DBusBooleanReceiver bool_receiver;
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/google-gadgets.git/commitdiff/de154302f4ca989cab7f2fc2cf11b24ff03ca5d6
More information about the pld-cvs-commit
mailing list