vino r1008 - in trunk: . server
- From: jwendell svn gnome org
- To: svn-commits-list gnome org
- Subject: vino r1008 - in trunk: . server
- Date: Mon, 17 Nov 2008 13:08:16 +0000 (UTC)
Author: jwendell
Date: Mon Nov 17 13:08:15 2008
New Revision: 1008
URL: http://svn.gnome.org/viewvc/vino?rev=1008&view=rev
Log:
2008-11-17 Jonh Wendell <jwendell gnome org>
* server/vino-utils.[ch]: Added a new utility function:
vino_util_show_error().
* server/vino-status-icon.c: Don't use gnome-open anymore. Use
gtk_show_uri instead, and, in case of error, use the new helper
function to show an error dialog. Based on a patch from Emilio
Pozuelo Monfort. Closes #561034.
Modified:
trunk/ChangeLog
trunk/server/vino-status-icon.c
trunk/server/vino-util.c
trunk/server/vino-util.h
Modified: trunk/server/vino-status-icon.c
==============================================================================
--- trunk/server/vino-status-icon.c (original)
+++ trunk/server/vino-status-icon.c Mon Nov 17 13:08:15 2008
@@ -183,9 +183,7 @@
return g_object_new (VINO_TYPE_STATUS_ICON,
"icon-name", "preferences-desktop-remote-desktop",
"server", server,
-#if GTK_CHECK_VERSION (2, 11, 0)
"screen", screen,
-#endif
NULL);
}
@@ -198,59 +196,38 @@
}
static void
-vino_status_icon_spawn_command (VinoStatusIcon *icon,
- const char *command,
- const char *error_format)
+vino_status_icon_preferences (VinoStatusIcon *icon)
{
GdkScreen *screen;
- GError *error;
-
- g_return_if_fail (VINO_IS_STATUS_ICON (icon));
+ GError *error = NULL;
-#if GTK_CHECK_VERSION (2, 11, 0)
screen = gtk_status_icon_get_screen (GTK_STATUS_ICON (icon));
-#else
- screen = vino_server_get_screen (icon->priv->server);
-#endif
-
- error = NULL;
-
- if (!gdk_spawn_command_line_on_screen (screen, command, &error))
+ if (!gdk_spawn_command_line_on_screen (screen, "vino-preferences", &error))
{
- GtkWidget *message_dialog;
-
- message_dialog = gtk_message_dialog_new (NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- error_format,
- error->message);
- gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE);
-
- g_signal_connect (message_dialog, "response",
- G_CALLBACK (gtk_widget_destroy),
- NULL);
-
- gtk_widget_show (message_dialog);
-
+ vino_util_show_error (_("Error displaying preferences"),
+ error->message,
+ NULL);
g_error_free (error);
}
}
static void
-vino_status_icon_preferences (VinoStatusIcon *icon)
-{
- vino_status_icon_spawn_command (icon,
- "vino-preferences",
- _("There was an error displaying preferences:\n %s"));
-}
-
-static void
vino_status_icon_help (VinoStatusIcon *icon)
{
- vino_status_icon_spawn_command (icon,
- "gnome-open ghelp:user-guide?goscustdesk-90",
- _("There was an error displaying help:\n %s"));
+ GdkScreen *screen;
+ GError *error = NULL;
+
+ screen = gtk_status_icon_get_screen (GTK_STATUS_ICON (icon));
+ if (!gtk_show_uri (screen,
+ "ghelp:user-guide?goscustdesk-90",
+ GDK_CURRENT_TIME,
+ &error))
+ {
+ vino_util_show_error (_("Error displaying help"),
+ error->message,
+ NULL);
+ g_error_free (error);
+ }
}
static void
Modified: trunk/server/vino-util.c
==============================================================================
--- trunk/server/vino-util.c (original)
+++ trunk/server/vino-util.c Mon Nov 17 13:08:15 2008
@@ -101,3 +101,35 @@
initialized = TRUE;
}
+
+void
+vino_util_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",
+ t);
+ g_free (t);
+
+ if (message)
+ gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (d),
+ "%s",
+ message);
+
+ g_signal_connect_swapped (d,
+ "response",
+ G_CALLBACK (gtk_widget_destroy),
+ d);
+ gtk_widget_show_all (GTK_WIDGET(d));
+}
+
Modified: trunk/server/vino-util.h
==============================================================================
--- trunk/server/vino-util.h (original)
+++ trunk/server/vino-util.h Mon Nov 17 13:08:15 2008
@@ -27,6 +27,7 @@
#include <libintl.h>
#include <glib/gmacros.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
@@ -79,7 +80,12 @@
#endif /* G_ENABLE_DEBUG */
-void vino_init_stock_items (void);
+void vino_init_stock_items (void);
+
+void vino_util_show_error (const gchar *title,
+ const gchar *message,
+ GtkWindow *parent);
+
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]