[frogr] Report errors in more situations



commit 0a75012218a16786d983e7f0626ab49160867c42
Author: Mario Sanchez Prada <msanchez gnome org>
Date:   Fri Nov 2 09:20:51 2012 +0100

    Report errors in more situations

 src/frogr-controller.c |   25 +++----------------------
 1 files changed, 3 insertions(+), 22 deletions(-)
---
diff --git a/src/frogr-controller.c b/src/frogr-controller.c
index 85ba84a..f80f36f 100644
--- a/src/frogr-controller.c
+++ b/src/frogr-controller.c
@@ -286,6 +286,7 @@ _handle_flicksoup_error (FrogrController *self, GError *error, gboolean notify_u
   void (* error_function) (GtkWindow *, const gchar *) = NULL;
   gchar *msg = NULL;
 
+  error_function = frogr_util_show_error_dialog;
   switch (error->code)
     {
     case FSP_ERROR_CANCELLED:
@@ -295,67 +296,54 @@ _handle_flicksoup_error (FrogrController *self, GError *error, gboolean notify_u
 
     case FSP_ERROR_NETWORK_ERROR:
       msg = g_strdup (_("Connection error:\nNetwork not available"));
-      error_function = frogr_util_show_error_dialog;
       break;
 
     case FSP_ERROR_CLIENT_ERROR:
       msg = g_strdup (_("Connection error:\nBad request"));
-      error_function = frogr_util_show_error_dialog;
       break;
 
     case FSP_ERROR_SERVER_ERROR:
       msg = g_strdup (_("Connection error:\nServer-side error"));
-      error_function = frogr_util_show_error_dialog;
       break;
 
     case FSP_ERROR_UPLOAD_INVALID_FILE:
       msg = g_strdup (_("Error uploading picture:\nFile invalid"));
-      error_function = frogr_util_show_error_dialog;
       break;
 
     case FSP_ERROR_UPLOAD_QUOTA_EXCEEDED:
       msg = g_strdup (_("Error uploading picture:\nQuota exceeded"));
-      error_function = frogr_util_show_error_dialog;
       break;
 
     case FSP_ERROR_PHOTO_NOT_FOUND:
       msg = g_strdup (_("Error:\nPhoto not found"));
-      error_function = frogr_util_show_error_dialog;
       break;
 
     case FSP_ERROR_PHOTOSET_PHOTO_ALREADY_IN:
       msg = g_strdup (_("Error:\nPhoto already in photoset"));
-      error_function = NULL; /* Don't notify the user about this */
       break;
 
     case FSP_ERROR_GROUP_PHOTO_ALREADY_IN:
       msg = g_strdup (_("Error:\nPhoto already in group"));
-      error_function = NULL; /* Don't notify the user about this */
       break;
 
     case FSP_ERROR_GROUP_PHOTO_IN_MAX_NUM:
       msg = g_strdup (_("Error:\nPhoto already in the maximum number of groups possible"));
-      error_function = NULL; /* Don't notify the user about this */
       break;
 
     case FSP_ERROR_GROUP_LIMIT_REACHED:
       msg = g_strdup (_("Error:\nGroup limit already reached"));
-      error_function = NULL; /* Don't notify the user about this */
       break;
 
     case FSP_ERROR_GROUP_PHOTO_ADDED_TO_QUEUE:
       msg = g_strdup (_("Error:\nPhoto added to group's queue"));
-      error_function = NULL; /* Don't notify the user about this */
       break;
 
     case FSP_ERROR_GROUP_PHOTO_ALREADY_IN_QUEUE:
       msg = g_strdup (_("Error:\nPhoto already added to group's queue"));
-      error_function = NULL; /* Don't notify the user about this */
       break;
 
     case FSP_ERROR_GROUP_CONTENT_NOT_ALLOWED:
       msg = g_strdup (_("Error:\nContent not allowed for this group"));
-      error_function = NULL; /* Don't notify the user about this */
       break;
 
     case FSP_ERROR_AUTHENTICATION_FAILED:
@@ -367,38 +355,31 @@ _handle_flicksoup_error (FrogrController *self, GError *error, gboolean notify_u
       frogr_controller_revoke_authorization (self);
       msg = g_strdup_printf (_("Error\n%s is not properly authorized to upload pictures "
                                "to flickr.\nPlease re-authorize it"), APP_SHORTNAME);
-      error_function = frogr_util_show_error_dialog;
       break;
 
     case FSP_ERROR_OAUTH_UNKNOWN_ERROR:
       msg = g_strdup_printf (_("Unable to authenticate in flickr\nPlease try again."));
-      error_function = frogr_util_show_error_dialog;
       break;
 
     case FSP_ERROR_OAUTH_NOT_AUTHORIZED_YET:
       msg = g_strdup_printf (_("You have not properly authorized %s yet.\n"
                                "Please try again."), APP_SHORTNAME);
-      error_function = frogr_util_show_error_dialog;
       break;
 
     case FSP_ERROR_OAUTH_VERIFIER_INVALID:
       msg = g_strdup_printf (_("Invalid verification code.\nPlease try again."));
-      error_function = frogr_util_show_error_dialog;
       break;
 
     case FSP_ERROR_SERVICE_UNAVAILABLE:
       msg = g_strdup_printf (_("Error:\nService not available"));
-      error_function = frogr_util_show_error_dialog;
       break;
 
     default:
       /* General error: just dump the raw error description */
-      msg = g_strdup_printf (_("An error happened: %s."),
-                             error->message);
-      error_function = frogr_util_show_error_dialog;
+      msg = g_strdup_printf (_("An error happened: %s."), error->message);
     }
 
-  if (notify_user && error_function)
+  if (notify_user)
     {
       GtkWindow *window = NULL;
       window = frogr_main_view_get_window (priv->mainview);



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