PackageKit/PackageKit-BNC383261-suggest-daemon-quit.patch

60 lines
1.9 KiB
Diff

diff --git a/lib/packagekit-glib/pk-control.c b/lib/packagekit-glib/pk-control.c
index d0bbd47..ae4a975 100644
--- a/lib/packagekit-glib/pk-control.c
+++ b/lib/packagekit-glib/pk-control.c
@@ -317,6 +317,41 @@ out:
}
/**
+ * pk_control_suggest_daemon_quit:
+ * @control: a valid #PkControl instance
+ * @error: a %GError to put the error code and message in, or %NULL
+ *
+ * Return value: if the call was made successfully
+ **/
+gboolean
+pk_control_suggest_daemon_quit (PkControl *control, GError **error)
+{
+ gboolean ret;
+ GError *error_local = NULL;
+
+ g_return_val_if_fail (PK_IS_CONTROL (control), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ /* check to see if we have a valid proxy */
+ if (control->priv->proxy == NULL) {
+ egg_warning ("No proxy for manager");
+ return FALSE;
+ }
+ ret = dbus_g_proxy_call (control->priv->proxy, "SuggestDaemonQuit", &error_local,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+ if (!ret) {
+ /* abort as the DBUS method failed */
+ egg_warning ("SuggestDaemonQuit failed :%s", error_local->message);
+ pk_control_error_set (error, PK_CONTROL_ERROR_FAILED, error_local->message);
+ g_error_free (error_local);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
* pk_control_get_network_state:
* @control: a valid #PkControl instance
* @error: a %GError to put the error code and message in, or %NULL
diff --git a/lib/packagekit-glib/pk-control.h b/lib/packagekit-glib/pk-control.h
index a14603d..fe8a687 100644
--- a/lib/packagekit-glib/pk-control.h
+++ b/lib/packagekit-glib/pk-control.h
@@ -108,6 +108,8 @@ gchar **pk_control_get_mime_types (PkControl *control,
GError **error);
PkNetworkEnum pk_control_get_network_state (PkControl *control,
GError **error);
+gboolean pk_control_suggest_daemon_quit (PkControl *control,
+ GError **error);
gboolean pk_control_get_backend_detail (PkControl *control,
gchar **name,
gchar **author,