vinagre r187 - in trunk: . src
- From: jwendell svn gnome org
- To: svn-commits-list gnome org
- Subject: vinagre r187 - in trunk: . src
- Date: Sun, 10 Feb 2008 18:30:52 +0000 (GMT)
Author: jwendell
Date: Sun Feb 10 18:30:52 2008
New Revision: 187
URL: http://svn.gnome.org/viewvc/vinagre?rev=187&view=rev
Log:
2008-02-10 Jonh Wendell <jwendell gnome org>
* src/vinagre-window.c,
* src/vinagre-main.c,
* src/vinagre-connection.[ch]: More work on vnc:// protocol, also
fixes issues in recent connections stuff.
Modified:
trunk/ChangeLog
trunk/src/vinagre-connection.c
trunk/src/vinagre-connection.h
trunk/src/vinagre-main.c
trunk/src/vinagre-window.c
Modified: trunk/src/vinagre-connection.c
==============================================================================
--- trunk/src/vinagre-connection.c (original)
+++ trunk/src/vinagre-connection.c Sun Feb 10 18:30:52 2008
@@ -144,14 +144,31 @@
}
VinagreConnection *
-vinagre_connection_new_from_string (const gchar *url)
+vinagre_connection_new_from_string (const gchar *uri, gchar **error_msg)
{
VinagreConnection *conn;
- gchar **server;
+ gchar **server, **url;
gint port;
gchar *host;
- server = g_strsplit (url, ":", 2);
+ *error_msg = NULL;
+
+ url = g_strsplit (uri, "://", 2);
+ if (g_strv_length (url) == 2)
+ {
+ if (g_strcmp0 (url[0], "vnc"))
+ {
+ *error_msg = g_strdup_printf (_("The protocol %s is not supported."),
+ url[0]);
+ g_strfreev (url);
+ return NULL;
+ }
+ host = url[1];
+ }
+ else
+ host = (gchar *) uri;
+
+ server = g_strsplit (host, ":", 2);
host = server[0];
port = server[1] ? atoi (server[1]) : 5900;
@@ -164,6 +181,8 @@
}
g_strfreev (server);
+ g_strfreev (url);
+
return conn;
}
Modified: trunk/src/vinagre-connection.h
==============================================================================
--- trunk/src/vinagre-connection.h (original)
+++ trunk/src/vinagre-connection.h Sun Feb 10 18:30:52 2008
@@ -2,7 +2,7 @@
* vinagre-connection.h
* This file is part of vinagre
*
- * Copyright (C) 2007 - Jonh Wendell <wendell bani com br>
+ * Copyright (C) 2007,2008 - Jonh Wendell <wendell bani com br>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@
VinagreConnection *vinagre_connection_clone (VinagreConnection *conn);
-VinagreConnection *vinagre_connection_new_from_string (const gchar *url);
+VinagreConnection *vinagre_connection_new_from_string (const gchar *url, gchar **error_msg);
VinagreConnection *vinagre_connection_new_from_file (const gchar *uri, gchar **error_msg);
GdkPixbuf *vinagre_connection_get_icon (VinagreConnection *conn);
Modified: trunk/src/vinagre-main.c
==============================================================================
--- trunk/src/vinagre-main.c (original)
+++ trunk/src/vinagre-main.c Sun Feb 10 18:30:52 2008
@@ -54,8 +54,6 @@
gint i;
VinagreConnection *conn;
gchar *error;
- gchar *host;
- gchar **url;
GSList *errors = NULL;
if (files)
@@ -82,27 +80,17 @@
{
for (i = 0; remaining_args[i]; i++)
{
- url = g_strsplit (remaining_args[i], "://", 2);
- if (g_strv_length (url) == 2)
- {
- if (g_strcmp0 (url[0], "vnc"))
- {
- errors = g_slist_prepend (errors,
- g_strdup_printf (_("The protocol %s is not supported."),
- url[0]));
- g_strfreev (url);
- continue;
- }
- host = url[1];
- }
- else
- host = remaining_args[i];
-
- conn = vinagre_connection_new_from_string (host);
+ conn = vinagre_connection_new_from_string (remaining_args[i], &error);
if (conn)
servers = g_slist_prepend (servers, conn);
+ else
+ errors = g_slist_prepend (errors,
+ g_strdup_printf ("%s: %s",
+ remaining_args[i],
+ error ? error : _("Unknown error")));
- g_strfreev (url);
+ if (error)
+ g_free (error);
}
g_strfreev (remaining_args);
Modified: trunk/src/vinagre-window.c
==============================================================================
--- trunk/src/vinagre-window.c (original)
+++ trunk/src/vinagre-window.c Sun Feb 10 18:30:52 2008
@@ -268,11 +268,26 @@
activate_recent_cb (GtkRecentChooser *action, VinagreWindow *window)
{
VinagreConnection *conn;
+ gchar *error, *msg;
- conn = vinagre_connection_new_from_string (gtk_recent_chooser_get_current_uri (action));
- vinagre_cmd_open_bookmark (window, conn);
+ conn = vinagre_connection_new_from_string (gtk_recent_chooser_get_current_uri (action),
+ &error);
+ if (conn)
+ {
+ vinagre_cmd_open_bookmark (window, conn);
+ vinagre_connection_free (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_connection_free (conn);
+ if (error)
+ g_free (error);
}
static void update_recent_connections (VinagreWindow *window)
@@ -413,6 +428,14 @@
window->priv->recent_action = gtk_recent_action_new ("recent_connections",
_("_Recent connections"),
NULL, NULL);
+ g_object_set (G_OBJECT (window->priv->recent_action),
+ "show-not-found", TRUE,
+ "local-only", FALSE,
+ "show-private", TRUE,
+ "show-tips", TRUE,
+ "sort-type", GTK_RECENT_SORT_MRU,
+ NULL);
+ gtk_recent_chooser_set_local_only (GTK_RECENT_CHOOSER (window->priv->recent_action), FALSE);
g_signal_connect (window->priv->recent_action,
"item-activated",
G_CALLBACK (activate_recent_cb),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]