vinagre r511 - in trunk: . src



Author: jwendell
Date: Fri Nov 14 18:27:02 2008
New Revision: 511
URL: http://svn.gnome.org/viewvc/vinagre?rev=511&view=rev

Log:
2008-11-14  Jonh Wendell <jwendell gnome org>

	* lots of files: Show a secondary text in all error dialogs.



Modified:
   trunk/ChangeLog
   trunk/src/vinagre-applet.c
   trunk/src/vinagre-bookmarks.c
   trunk/src/vinagre-connect.c
   trunk/src/vinagre-notebook.c
   trunk/src/vinagre-tab.c
   trunk/src/vinagre-utils.c
   trunk/src/vinagre-utils.h
   trunk/src/vinagre-window.c

Modified: trunk/src/vinagre-applet.c
==============================================================================
--- trunk/src/vinagre-applet.c	(original)
+++ trunk/src/vinagre-applet.c	Fri Nov 14 18:27:02 2008
@@ -96,13 +96,8 @@
 			    NULL,
 			    &err))
     {
-      gchar *tmp;
-
-      tmp = g_strdup_printf (_("Could not run vinagre: %s"), err->message);
-      vinagre_utils_show_error (tmp, NULL);
-
+      vinagre_utils_show_error (_("Could not run vinagre:"), err->message, NULL);
       g_error_free (err);
-      g_free (tmp);
     }
 
   g_strfreev (argv);
@@ -142,13 +137,8 @@
 
   if (!g_spawn_command_line_async ("vinagre", &err))
     {
-      gchar *tmp;
-
-      tmp = g_strdup_printf (_("Could not run vinagre: %s"), err->message);
-      vinagre_utils_show_error (tmp, NULL);
-
+      vinagre_utils_show_error (_("Could not run vinagre:"), err->message, NULL);
       g_error_free (err);
-      g_free (tmp);
     }
 }
 

Modified: trunk/src/vinagre-bookmarks.c
==============================================================================
--- trunk/src/vinagre-bookmarks.c	(original)
+++ trunk/src/vinagre-bookmarks.c	Fri Nov 14 18:27:02 2008
@@ -388,7 +388,7 @@
 	}
       else
 	{
-	  vinagre_utils_show_error (error_str, window);
+	  vinagre_utils_show_error (NULL, error_str, window);
 	  g_free (error_str);
 	}
 

Modified: trunk/src/vinagre-connect.c
==============================================================================
--- trunk/src/vinagre-connect.c	(original)
+++ trunk/src/vinagre-connect.c	Fri Nov 14 18:27:02 2008
@@ -272,7 +272,7 @@
 	}
       else
 	{
-	  vinagre_utils_show_error (error_msg ? error_msg : _("Unknown error"),
+	  vinagre_utils_show_error (NULL, error_msg ? error_msg : _("Unknown error"),
 				    GTK_WINDOW (window));
 	}
 fail:

Modified: trunk/src/vinagre-notebook.c
==============================================================================
--- trunk/src/vinagre-notebook.c	(original)
+++ trunk/src/vinagre-notebook.c	Fri Nov 14 18:27:02 2008
@@ -126,7 +126,7 @@
   name = vinagre_connection_get_best_name (vinagre_tab_get_conn (tab));
   message = g_strdup_printf (_("Connection to host \"%s\" was closed."),
 			     name);
-  vinagre_utils_show_error (message, GTK_WINDOW (nb->priv->window));
+  vinagre_utils_show_error (_("Connection closed"), message, GTK_WINDOW (nb->priv->window));
   g_free (message);
   g_free (name);
 

Modified: trunk/src/vinagre-tab.c
==============================================================================
--- trunk/src/vinagre-tab.c	(original)
+++ trunk/src/vinagre-tab.c	Fri Nov 14 18:27:02 2008
@@ -307,7 +307,7 @@
   if (vnc_display_open_host (VNC_DISPLAY(tab->priv->vnc), vinagre_connection_get_host (tab->priv->conn), port))
     gtk_widget_grab_focus (tab->priv->vnc);
   else
-    vinagre_utils_show_error (_("Error connecting to host."), NULL);
+    vinagre_utils_show_error (NULL, _("Error connecting to host."), NULL);
 
   g_free (port);
 }
@@ -345,7 +345,7 @@
   	g_string_append_printf (message, " (%s)", msg);
   g_string_append_printf (message, ".");
 
-  vinagre_utils_show_error (message->str, GTK_WINDOW (tab->priv->window));
+  vinagre_utils_show_error (_("Authentication failed"), message->str, GTK_WINDOW (tab->priv->window));
   g_string_free (message, TRUE);
   g_free (name);
 
@@ -371,7 +371,7 @@
 		   name,
 		   auth_type);
 
-  vinagre_utils_show_error (message->str, GTK_WINDOW (tab->priv->window));
+  vinagre_utils_show_error (_("Authentication unsupported"), message->str, GTK_WINDOW (tab->priv->window));
   g_string_free (message, TRUE);
   g_free (name);
 
@@ -448,7 +448,8 @@
   data->is_private = FALSE;
 
   if (!gtk_recent_manager_add_full (manager, uri->str, data))
-    vinagre_utils_show_error (_("Error saving recent connection."),
+    vinagre_utils_show_error (NULL,
+			      _("Error saving recent connection."),
 			      GTK_WINDOW (tab->priv->window));
 
   g_string_free (uri, TRUE);
@@ -479,7 +480,8 @@
                 &tab->priv->keyring_item_id);
 
   if (result != GNOME_KEYRING_RESULT_OK)
-    vinagre_utils_show_error (_("Error saving the credential on the keyring."),
+    vinagre_utils_show_error (NULL,
+			      _("Error saving the credential on the keyring."),
 			      GTK_WINDOW (tab->priv->window));
 
   tab->priv->save_credential = FALSE;
@@ -1105,7 +1107,7 @@
   if (active &&
       gdk_screen_is_composited (gtk_widget_get_screen (GTK_WIDGET (tab->priv->window))))
     {
-      vinagre_utils_show_error (_("Scaling does not work properly on composited windows. Disable the visual effects and try again."),
+      vinagre_utils_show_error (NULL, _("Scaling does not work properly on composited windows. Disable the visual effects and try again."),
 				GTK_WINDOW (tab->priv->window));
       return FALSE;
     }
@@ -1113,7 +1115,7 @@
   vnc_display_set_force_size (VNC_DISPLAY(tab->priv->vnc), !active);
   if (!vnc_display_set_scaling (VNC_DISPLAY (tab->priv->vnc), active))
     {
-      vinagre_utils_show_error (_("Scaling is not supported on this installation.\n\nRead the README file (shipped with Vinagre) in order to know how to enable this feature."),
+      vinagre_utils_show_error (NULL, _("Scaling is not supported on this installation.\n\nRead the README file (shipped with Vinagre) in order to know how to enable this feature."),
 				GTK_WINDOW (tab->priv->window));
       return FALSE;
     }

Modified: trunk/src/vinagre-utils.c
==============================================================================
--- trunk/src/vinagre-utils.c	(original)
+++ trunk/src/vinagre-utils.c	Fri Nov 14 18:27:02 2008
@@ -65,16 +65,28 @@
 }
 
 void
-vinagre_utils_show_error (const gchar *message, GtkWindow *parent)
+vinagre_utils_show_error (const gchar *title, const gchar *message, GtkWindow *parent)
 {
   GtkWidget *d;
+  gchar     *t;
+
+  if (title)
+    t = g_strdup (title);
+  else
+    t = g_strdup (_("An error has occurred:"));
 
   d = gtk_message_dialog_new (parent,
 			      GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
 			      GTK_MESSAGE_ERROR,
 			      GTK_BUTTONS_CLOSE,
 			      "%s",
-			      message);
+			      t);
+  g_free (t);
+
+  if (message)
+    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
+					      "%s",
+					      message);
 
   g_signal_connect_swapped (d,
 			    "response", 
@@ -84,6 +96,21 @@
 }
 
 void
+vinagre_utils_show_many_errors (const gchar *title, GSList *items, GtkWindow *parent)
+{
+  GString *msg;
+  GSList  *l;
+
+  msg = g_string_new (NULL);
+
+  for (l = items; l; l = l->next)
+    g_string_append_printf (msg, "%s\n", (gchar *)l->data);
+
+  vinagre_utils_show_error (title, msg->str, parent);
+  g_string_free (msg, TRUE);
+}
+
+void
 vinagre_utils_toggle_widget_visible (GtkWidget *widget)
 {
   if (GTK_WIDGET_VISIBLE (widget))
@@ -152,23 +179,6 @@
 	return g_string_free (str, FALSE);
 }
 
-void
-vinagre_utils_show_many_errors (const gchar *message, GSList *items, GtkWindow *parent)
-{
-  GString *msg;
-  GSList  *l;
-
-  msg = g_string_new (message);
-  g_string_append_c (msg, '\n');
-
-  for (l = items; l; l = l->next)
-    g_string_append_printf (msg, "\n%s", (gchar *)l->data);
-
-  vinagre_utils_show_error (msg->str, parent);
-  g_string_free (msg, TRUE);
-}
-
-
 static void _default_log (const gchar *log_domain G_GNUC_UNUSED,
 			 GLogLevelFlags log_level G_GNUC_UNUSED,
 			 const gchar *message,
@@ -376,7 +386,7 @@
 
   if (error != NULL) 
     {
-      vinagre_utils_show_error (error->message, GTK_IS_WINDOW (data) ? GTK_WINDOW (data) : NULL);
+      vinagre_utils_show_error (NULL, error->message, GTK_IS_WINDOW (data) ? GTK_WINDOW (data) : NULL);
       g_error_free (error);
     }
 
@@ -399,7 +409,7 @@
 
   if (error != NULL) 
     {
-      vinagre_utils_show_error (error->message, GTK_IS_WINDOW (window) ? window : NULL);
+      vinagre_utils_show_error (NULL, error->message, GTK_IS_WINDOW (window) ? window : NULL);
       g_error_free (error);
     }
 }

Modified: trunk/src/vinagre-utils.h
==============================================================================
--- trunk/src/vinagre-utils.h	(original)
+++ trunk/src/vinagre-utils.h	Fri Nov 14 18:27:02 2008
@@ -33,10 +33,11 @@
 
 GtkWidget	*vinagre_utils_create_small_close_button (void);
 
-void		vinagre_utils_show_error		(const gchar *message,
+void		vinagre_utils_show_error		(const gchar *title,
+							 const gchar *message,
 							 GtkWindow *parent);
 
-void		vinagre_utils_show_many_errors		(const gchar *message,
+void		vinagre_utils_show_many_errors		(const gchar *title,
 							 GSList *items,
 							 GtkWindow *parent);
 

Modified: trunk/src/vinagre-window.c
==============================================================================
--- trunk/src/vinagre-window.c	(original)
+++ trunk/src/vinagre-window.c	Fri Nov 14 18:27:02 2008
@@ -271,7 +271,7 @@
 activate_recent_cb (GtkRecentChooser *action, VinagreWindow *window)
 {
   VinagreConnection *conn;
-  gchar             *error, *msg;
+  gchar             *error;
 
   conn = vinagre_connection_new_from_string (gtk_recent_chooser_get_current_uri (action),
 					     &error);
@@ -281,16 +281,9 @@
       g_object_unref (conn);
     }
   else
-    {
-      msg = g_strdup_printf ("%s %s",
-			     _("The following error has occurred:"),
-			     error ? error : _("Unknown error"));
-      vinagre_utils_show_error (msg, GTK_WINDOW (window));
-      g_free (msg);
-    }
+    vinagre_utils_show_error (NULL, error ? error : _("Unknown error"), GTK_WINDOW (window));
 
-  if (error)
-    g_free (error);
+  g_free (error);
 }
 
 static void



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