[gnome-packagekit] Never show two modal dialog boxes when using the install helpers



commit c627554a91a044991700dcf28b25f54eaa6d383f
Author: Richard Hughes <richard hughsie com>
Date:   Thu Apr 11 12:30:56 2013 +0100

    Never show two modal dialog boxes when using the install helpers

 src/gpk-common.c               |   37 -------------------------------------
 src/gpk-common.h               |    1 -
 src/gpk-install-catalog.c      |   11 +++--------
 src/gpk-install-local-file.c   |    9 ++-------
 src/gpk-install-mime-type.c    |    9 ++-------
 src/gpk-install-package-name.c |    9 ++-------
 src/gpk-install-provide-file.c |    9 ++-------
 7 files changed, 11 insertions(+), 74 deletions(-)
---
diff --git a/src/gpk-common.c b/src/gpk-common.c
index 81add1b..fbc01e0 100644
--- a/src/gpk-common.c
+++ b/src/gpk-common.c
@@ -776,43 +776,6 @@ gpk_package_entry_completion_new (void)
        return completion;
 }
 
-/**
- * gpk_ignore_session_error:
- *
- * Returns true if the error is a remote exception where we canceled
- **/
-gboolean
-gpk_ignore_session_error (GError *error)
-{
-       gboolean ret = FALSE;
-       const gchar *name;
-
-       if (error == NULL)
-               goto out;
-       if (error->domain != DBUS_GERROR)
-               goto out;
-       if (error->code != DBUS_GERROR_REMOTE_EXCEPTION)
-               goto out;
-
-       /* use one of our local codes */
-       name = dbus_g_error_get_name (error);
-       if (name == NULL)
-               goto out;
-
-       if (g_str_has_prefix (name, "org.freedesktop.PackageKit.Modify.Cancelled")) {
-               ret = TRUE;
-               goto out;
-       }
-
-       /* DBus-glib hates us */
-       if (g_str_has_prefix (name, "Org.freedesktop.PackageKit.Modify.Cancelled")) {
-               ret = TRUE;
-               goto out;
-       }
-out:
-       return ret;
-}
-
 /***************************************************************************
  ***                          MAKE CHECK TESTS                           ***
  ***************************************************************************/
diff --git a/src/gpk-common.h b/src/gpk-common.h
index d50ee3b..f762d92 100644
--- a/src/gpk-common.h
+++ b/src/gpk-common.h
@@ -95,7 +95,6 @@ GtkEntryCompletion *gpk_package_entry_completion_new  (void);
 gboolean        gpk_window_set_size_request            (GtkWindow      *window,
                                                         guint           width,
                                                         guint           height);
-gboolean        gpk_ignore_session_error               (GError         *error);
 gboolean        gpk_window_set_parent_xid              (GtkWindow      *window,
                                                         guint32         xid);
 GPtrArray      *pk_strv_to_ptr_array                   (gchar          **array)
diff --git a/src/gpk-install-catalog.c b/src/gpk-install-catalog.c
index 7e73f66..f4e30c6 100644
--- a/src/gpk-install-catalog.c
+++ b/src/gpk-install-catalog.c
@@ -108,16 +108,11 @@ main (int argc, char *argv[])
        ret = dbus_g_proxy_call (proxy, "InstallCatalogs", &error,
                                 G_TYPE_UINT, 0, /* xid */
                                 G_TYPE_STRV, files, /* data */
-                                G_TYPE_STRING, "hide-finished,hide-warnings", /* interaction */
+                                G_TYPE_STRING, "hide-finished,show-warnings", /* interaction */
                                 G_TYPE_INVALID,
                                 G_TYPE_INVALID);
-       if (!ret && !gpk_ignore_session_error (error)) {
-               /* TRANSLATORS: This is when the specified D-Bus method did not execute successfully */
-               gpk_error_dialog (_("The action could not be completed"),
-                                 /* TRANSLATORS: we don't have anything more useful to translate. sorry. */
-                                 _("The request failed. More details are available in the detailed report."),
-                                 error->message);
-               g_warning ("%i: %s", error->code, error->message);
+       if (!ret) {
+               g_warning ("%s", error->message);
                goto out;
        }
 out:
diff --git a/src/gpk-install-local-file.c b/src/gpk-install-local-file.c
index 3301056..73826a6 100644
--- a/src/gpk-install-local-file.c
+++ b/src/gpk-install-local-file.c
@@ -108,15 +108,10 @@ main (int argc, char *argv[])
        ret = dbus_g_proxy_call (proxy, "InstallPackageFiles", &error,
                                 G_TYPE_UINT, 0, /* xid */
                                 G_TYPE_STRV, files, /* data */
-                                G_TYPE_STRING, "hide-finished,hide-warnings", /* interaction */
+                                G_TYPE_STRING, "hide-finished,show-warnings", /* interaction */
                                 G_TYPE_INVALID,
                                 G_TYPE_INVALID);
-       if (!ret && !gpk_ignore_session_error (error)) {
-               /* TRANSLATORS: This is when the specified D-Bus method did not execute successfully */
-               gpk_error_dialog (_("The action could not be completed"),
-                                 /* TRANSLATORS: we don't have anything more useful to translate. sorry. */
-                                 _("The request failed. More details are available in the detailed report."),
-                                 error->message);
+       if (!ret) {
                g_warning ("%s", error->message);
                goto out;
        }
diff --git a/src/gpk-install-mime-type.c b/src/gpk-install-mime-type.c
index 1c5a15e..0a9c66c 100644
--- a/src/gpk-install-mime-type.c
+++ b/src/gpk-install-mime-type.c
@@ -108,15 +108,10 @@ main (int argc, char *argv[])
        ret = dbus_g_proxy_call (proxy, "InstallMimeTypes", &error,
                                 G_TYPE_UINT, 0, /* xid */
                                 G_TYPE_STRV, types, /* data */
-                                G_TYPE_STRING, "hide-finished,hide-warnings", /* interaction */
+                                G_TYPE_STRING, "hide-finished,show-warnings", /* interaction */
                                 G_TYPE_INVALID,
                                 G_TYPE_INVALID);
-       if (!ret && !gpk_ignore_session_error (error)) {
-               /* TRANSLATORS: This is when the specified D-Bus method did not execute successfully */
-               gpk_error_dialog (_("The action could not be completed"),
-                                 /* TRANSLATORS: we don't have anything more useful to translate. sorry. */
-                                 _("The request failed. More details are available in the detailed report."),
-                                 error->message);
+       if (!ret) {
                g_warning ("%s", error->message);
                goto out;
        }
diff --git a/src/gpk-install-package-name.c b/src/gpk-install-package-name.c
index 4ca2442..415c207 100644
--- a/src/gpk-install-package-name.c
+++ b/src/gpk-install-package-name.c
@@ -107,15 +107,10 @@ main (int argc, char *argv[])
        ret = dbus_g_proxy_call (proxy, "InstallPackageNames", &error,
                                 G_TYPE_UINT, 0, /* xid */
                                 G_TYPE_STRV, packages, /* data */
-                                G_TYPE_STRING, "hide-finished,hide-warnings", /* interaction */
+                                G_TYPE_STRING, "hide-finished,show-warnings", /* interaction */
                                 G_TYPE_INVALID,
                                 G_TYPE_INVALID);
-       if (!ret && !gpk_ignore_session_error (error)) {
-               /* TRANSLATORS: This is when the specified D-Bus method did not execute successfully */
-               gpk_error_dialog (_("The action could not be completed"),
-                                 /* TRANSLATORS: we don't have anything more useful to translate. sorry. */
-                                 _("The request failed. More details are available in the detailed report."),
-                                 error->message);
+       if (!ret) {
                g_warning ("%s", error->message);
                goto out;
        }
diff --git a/src/gpk-install-provide-file.c b/src/gpk-install-provide-file.c
index ac9d2e7..d687cf9 100644
--- a/src/gpk-install-provide-file.c
+++ b/src/gpk-install-provide-file.c
@@ -108,15 +108,10 @@ main (int argc, char *argv[])
        ret = dbus_g_proxy_call (proxy, "InstallProvideFiles", &error,
                                 G_TYPE_UINT, 0, /* xid */
                                 G_TYPE_STRV, files, /* data */
-                                G_TYPE_STRING, "hide-finished,hide-warnings", /* interaction */
+                                G_TYPE_STRING, "hide-finished,show-warnings", /* interaction */
                                 G_TYPE_INVALID,
                                 G_TYPE_INVALID);
-       if (!ret && !gpk_ignore_session_error (error)) {
-               /* TRANSLATORS: This is when the specified D-Bus method did not execute successfully */
-               gpk_error_dialog (_("The action could not be completed"),
-                                 /* TRANSLATORS: we don't have anything more useful to translate. sorry. */
-                                 _("The request failed. More details are available in the detailed report."),
-                                 error->message);
+       if (!ret) {
                g_warning ("%s", error->message);
                goto out;
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]