- Add another upstreamed patch for setting the default timeout on a proxy

This commit is contained in:
David Zeuthen 2008-04-04 19:44:27 +00:00
parent ae1890dc0d
commit 036dffd143
2 changed files with 123 additions and 3 deletions

View File

@ -0,0 +1,114 @@
From: David Zeuthen <davidz@redhat.com>
Date: Sat, 15 Mar 2008 19:32:56 +0000 (-0400)
Subject: Add new function to specify the default timeout for a proxy
X-Git-Url: http://gitweb.freedesktop.org/?p=dbus/dbus-glib.git;a=commitdiff;h=bf0c9b3d6adc95863d5b5a4ce6ca994fd7fdc137
Add new function to specify the default timeout for a proxy
Without a function like this the generated client glue code is
unusable for D-Bus methods that take a long time to complete (such as
disk operations like mkfs and partitioning).
Also add some missing _with_timeout functions on DBusGProxy to the gtk
docs.
---
--- a/dbus/dbus-glib.h
+++ b/dbus/dbus-glib.h
@@ -252,6 +252,9 @@ DBusGProxyCall * dbus_g_proxy_begin_call
GType first_arg_type,
...);
+void dbus_g_proxy_set_default_timeout (DBusGProxy *proxy,
+ int timeout);
+
gboolean dbus_g_proxy_end_call (DBusGProxy *proxy,
DBusGProxyCall *call,
GError **error,
--- a/dbus/dbus-gproxy.c
+++ b/dbus/dbus-gproxy.c
@@ -73,6 +73,8 @@ struct _DBusGProxyPrivate
GData *signal_signatures; /**< D-BUS signatures for each signal */
GHashTable *pending_calls; /**< Calls made on this proxy which have not yet returned */
+
+ int default_timeout; /**< Default timeout to use, see dbus_g_proxy_set_default_timeout */
};
static void dbus_g_proxy_init (DBusGProxy *proxy);
@@ -1315,6 +1317,7 @@ dbus_g_proxy_init (DBusGProxy *proxy)
(GDestroyNotify) dbus_pending_call_unref);
priv->name_call = 0;
priv->associated = FALSE;
+ priv->default_timeout = -1;
}
static GObject *
@@ -2377,6 +2380,7 @@ dbus_g_proxy_begin_call (DBusGProxy
guint call_id;
va_list args;
GValueArray *arg_values;
+ DBusGProxyPrivate *priv = DBUS_G_PROXY_GET_PRIVATE(proxy);
g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), NULL);
g_return_val_if_fail (!DBUS_G_PROXY_DESTROYED (proxy), NULL);
@@ -2385,7 +2389,7 @@ dbus_g_proxy_begin_call (DBusGProxy
DBUS_G_VALUE_ARRAY_COLLECT_ALL (arg_values, first_arg_type, args);
- call_id = dbus_g_proxy_begin_call_internal (proxy, method, notify, user_data, destroy, arg_values,-1);
+ call_id = dbus_g_proxy_begin_call_internal (proxy, method, notify, user_data, destroy, arg_values, priv->default_timeout);
g_value_array_free (arg_values);
@@ -2515,15 +2519,18 @@ dbus_g_proxy_call (DBusGProxy *pr
guint call_id;
va_list args;
GValueArray *in_args;
+ DBusGProxyPrivate *priv;
g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), FALSE);
g_return_val_if_fail (!DBUS_G_PROXY_DESTROYED (proxy), FALSE);
+ priv = DBUS_G_PROXY_GET_PRIVATE(proxy);
+
va_start (args, first_arg_type);
DBUS_G_VALUE_ARRAY_COLLECT_ALL (in_args, first_arg_type, args);
- call_id = dbus_g_proxy_begin_call_internal (proxy, method, NULL, NULL, NULL, in_args,-1);
+ call_id = dbus_g_proxy_begin_call_internal (proxy, method, NULL, NULL, NULL, in_args, priv->default_timeout);
g_value_array_free (in_args);
@@ -2889,6 +2896,30 @@ dbus_g_proxy_disconnect_signal (DBusGPro
g_free (name);
}
+/**
+ * dbus_g_proxy_set_default_timeout:
+ * @proxy: a proxy for a remote interface
+ * @timeout: specify the timeout in milliseconds
+ *
+ * Sets the default timeout to use for a proxy. This timeout will be
+ * used in calls where the timeout is not specified.
+ *
+ * Since: 0.75
+ */
+void
+dbus_g_proxy_set_default_timeout (DBusGProxy *proxy,
+ int timeout)
+{
+ DBusGProxyPrivate *priv;
+
+ g_return_if_fail (DBUS_IS_G_PROXY (proxy));
+ g_return_if_fail (!DBUS_G_PROXY_DESTROYED (proxy));
+
+ priv = DBUS_G_PROXY_GET_PRIVATE(proxy);
+ priv->default_timeout = timeout;
+}
+
+
/** @} End of DBusGLib public */
#ifdef DBUS_BUILD_TESTS

View File

@ -8,7 +8,7 @@
Summary: GLib bindings for D-Bus
Name: dbus-glib
Version: 0.74
Release: 5%{?dist}
Release: 6%{?dist}
URL: http://www.freedesktop.org/software/dbus/
Source0: http://dbus.freedesktop.org/releases/dbus-glib/%{name}-%{version}.tar.gz
Source1: dbus-bus-introspect.xml
@ -16,7 +16,8 @@ Patch0: broken-xml.patch
Patch1: dbus-glib-proxy-signals-once.patch
# https://bugs.freedesktop.org/show_bug.cgi?id=14429
Patch2: dbus-glib-0.73-ignore-namespaces-and-children.patch
Patch3: dbus-glib-0.74-export-getall.patch
Patch3: dbus-glib-0.74-set-default-timeout-for-proxy.patch
Patch4: dbus-glib-0.74-export-getall.patch
License: AFL/GPL
Group: System Environment/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -65,7 +66,8 @@ D-Bus tools written using the gtk+ GUI libaries
%patch0 -p1 -b .broken-xml
%patch1 -p1 -b .proxy-signals-once
%patch2 -p1 -b .ignore-namespaces
%patch3 -p1 -b .export-getall
%patch3 -p1 -b .set-default-timeout
%patch4 -p1 -b .export-getall
%build
@ -121,6 +123,10 @@ rm -rf %{buildroot}
%endif
%changelog
* Fri Apr 4 2008 David Zeuthen <davidz@redhat.com> - 0.74-6
- Add another upstreamed patch for setting the default timeout
on a proxy
* Fri Apr 4 2008 David Zeuthen <davidz@redhat.com> - 0.74-5
- Add an already upstreamed patch to export the GetAll() method on
the org.freedesktop.DBus.Properties interface