vino r999 - in trunk: . capplet
- From: jwendell svn gnome org
- To: svn-commits-list gnome org
- Subject: vino r999 - in trunk: . capplet
- Date: Wed, 22 Oct 2008 16:39:49 +0000 (UTC)
Author: jwendell
Date: Wed Oct 22 16:39:48 2008
New Revision: 999
URL: http://svn.gnome.org/viewvc/vino?rev=999&view=rev
Log:
2008-10-22 Jonh Wendell <jwendell gnome org>
* configure.in: bump version to 2.25.1
* capplet/vino-preferences.[c,glade]:
Replaced the LinkButton with a Label and a Button, this allows the
user to copy the text and gives more space to add more buttons in
the future.
Also, we show a message when the server is not running, instead of
always show the URL. This closes #513705.
Modified:
trunk/ChangeLog
trunk/capplet/vino-preferences.c
trunk/capplet/vino-preferences.glade
trunk/configure.in
Modified: trunk/capplet/vino-preferences.c
==============================================================================
--- trunk/capplet/vino-preferences.c (original)
+++ trunk/capplet/vino-preferences.c Wed Oct 22 16:39:48 2008
@@ -71,7 +71,7 @@
GtkWidget *dialog;
GtkWidget *writability_warning;
- GtkWidget *url_labels_box;
+ GtkWidget *send_email_button;
GtkWidget *url_label;
GtkWidget *allowed_toggle;
GtkWidget *prompt_enabled_toggle;
@@ -88,7 +88,6 @@
GtkWidget *alternative_port_entry;
GtkWidget *lock_screen_toggle;
GtkWidget *disable_background_toggle;
- GtkTooltips *tips;
#ifdef VINO_ENABLE_LIBUNIQUE
UniqueApp *app;
#endif
@@ -101,7 +100,6 @@
int expected_listeners;
guint use_password : 1;
-
} VinoPreferencesDialog;
static void
@@ -176,7 +174,7 @@
{
gtk_widget_set_sensitive (dialog->prompt_enabled_toggle, allowed);
gtk_widget_set_sensitive (dialog->view_only_toggle, allowed);
- gtk_widget_set_sensitive (dialog->url_labels_box, allowed);
+ gtk_widget_set_sensitive (dialog->send_email_button, allowed);
gtk_widget_set_sensitive (dialog->password_toggle, allowed);
gtk_widget_set_sensitive (dialog->password_box, allowed ? dialog->use_password : FALSE);
gtk_widget_set_sensitive (dialog->icon_always_radio, allowed);
@@ -1124,55 +1122,15 @@
static int
vino_preferences_get_server_port (VinoPreferencesDialog *dialog)
{
-#define VINO_DEFAULT_PORT 5900
-#define VINO_MIN_PORT 5000
-#define VINO_MAX_PORT 6000
-
DBusGProxy *proxy;
int port;
GdkScreen *screen;
char *obj_path;
-
- screen = gtk_window_get_screen (GTK_WINDOW (dialog->dialog));
- obj_path = g_strdup_printf ("/org/gnome/vino/screens/%d",
- gdk_screen_get_number (screen));
-
- proxy = dbus_g_proxy_new_for_name (dialog->connection,
- VINO_DBUS_BUS_NAME,
- obj_path,
- VINO_DBUS_INTERFACE);
- g_free (obj_path);
-
- if (!dbus_g_proxy_call (proxy, "GetServerPort", NULL,
- G_TYPE_INVALID,
- G_TYPE_INT, &port,
- G_TYPE_INVALID))
- {
- g_object_unref (proxy);
- return 0;
- }
-
- g_object_unref (proxy);
-
- if (port >= VINO_MIN_PORT && port <= VINO_MAX_PORT)
- return port - VINO_DEFAULT_PORT;
- else
- return port;
-
-#undef VINO_DEFAULT_PORT
-#undef VINO_MIN_PORT
-#undef VINO_MAX_PORT
-}
-
#ifdef VINO_ENABLE_HTTP_SERVER
-static int
-vino_preferences_get_http_server_port (VinoPreferencesDialog *dialog)
-{
-#define VINO_HTTP_DEFAULT_PORT 5800
- DBusGProxy *proxy;
- int port;
- GdkScreen *screen;
- char *obj_path;
+ const char *method = "GetHttpServerPort";
+#else
+ const char *method = "GetServerPort";
+#endif
screen = gtk_window_get_screen (GTK_WINDOW (dialog->dialog));
obj_path = g_strdup_printf ("/org/gnome/vino/screens/%d",
@@ -1184,21 +1142,17 @@
VINO_DBUS_INTERFACE);
g_free (obj_path);
- if (!dbus_g_proxy_call (proxy, "GetHttpServerPort", NULL,
+ if (!dbus_g_proxy_call (proxy, method, NULL,
G_TYPE_INVALID,
G_TYPE_INT, &port,
G_TYPE_INVALID))
{
- g_object_unref (proxy);
- return VINO_HTTP_DEFAULT_PORT;
+ port = 0;
}
g_object_unref (proxy);
-
return port;
-#undef VINO_HTTP_DEFAULT_PORT
}
-#endif /* VINO_ENABLE_HTTP_SERVER */
static char *
vino_preferences_get_local_hostname (void)
@@ -1233,18 +1187,21 @@
char *server_url;
int server_port;
- local_host = vino_preferences_get_local_hostname ();
+ server_port = vino_preferences_get_server_port (dialog);
+
+ gtk_widget_set_sensitive (dialog->send_email_button, server_port);
+
+ if (server_port == 0)
+ return g_strdup (_("The service is not running"));
+
+ local_host = vino_preferences_get_local_hostname ();
if (!local_host)
- {
- local_host = g_strdup_printf ("localhost");
- }
+ local_host = g_strdup_printf ("localhost");
#ifdef VINO_ENABLE_HTTP_SERVER
- server_port = vino_preferences_get_http_server_port (dialog);
server_url = g_strdup_printf ("http://%s:%d", local_host, server_port);
#else
- server_port = vino_preferences_get_server_port (dialog);
- server_url = g_strdup_printf ("vinagre %s:%d", local_host, server_port);
+ server_url = g_strdup_printf ("vinagre %s::%d", local_host, server_port);
#endif
g_free (local_host);
@@ -1253,35 +1210,36 @@
}
static char *
-vino_preferences_dialog_construct_mailto (VinoPreferencesDialog *dialog,
- const char *url)
+vino_preferences_dialog_construct_mailto (VinoPreferencesDialog *dialog)
{
GString *mailto;
+ char *command;
+
+ command = vino_preferences_dialog_get_server_command (dialog);
mailto = g_string_new ("mailto:");
if (dialog->mailto)
mailto = g_string_append (mailto, dialog->mailto);
mailto = g_string_append_c (mailto, '?');
- g_string_append_printf (mailto, "Body=%s", url);
+ g_string_append_printf (mailto, "Body=%s", command);
+ g_free (command);
return g_string_free (mailto, FALSE);
}
static void
vino_preferences_dialog_update_url_label (VinoPreferencesDialog *dialog)
{
- char *command;
- char *mailto;
+ char *command, *label;
command = vino_preferences_dialog_get_server_command (dialog);
- mailto = vino_preferences_dialog_construct_mailto (dialog, command);
-
- gtk_button_set_label (GTK_BUTTON (dialog->url_label), command);
- gtk_link_button_set_uri (GTK_LINK_BUTTON (dialog->url_label), mailto);
+ label = g_strdup_printf ("<i>%s</i>", command);
+
+ gtk_label_set_label (GTK_LABEL (dialog->url_label), label);
g_free (command);
- g_free (mailto);
+ g_free (label);
}
static void
@@ -1307,47 +1265,59 @@
{
g_free (dialog->mailto);
dialog->mailto = g_strdup (mailto);
- vino_preferences_dialog_update_url_label (dialog);
}
}
static void
-vino_preferences_dialog_uri_hook (GtkLinkButton *button,
- const gchar *link,
- gpointer user_data)
+vino_preferences_email_button_clicked (GtkButton *button,
+ VinoPreferencesDialog *dialog)
{
GError *error;
GdkScreen *screen;
+ char *mailto, *command;
- screen = gtk_widget_get_screen (GTK_WIDGET (button));
+ error = NULL;
+ screen = gtk_widget_get_screen (GTK_WIDGET (button));
+ mailto = vino_preferences_dialog_construct_mailto (dialog);
+ command = vino_preferences_dialog_get_server_command (dialog);
- error = NULL;
- if (!gtk_show_uri (screen, link, GDK_CURRENT_TIME, &error))
+ if (!gtk_show_uri (screen, mailto, GDK_CURRENT_TIME, &error))
{
- /* FIXME better error handling!
- * What best to do? For the specific case
- * in this preferences dialog we want to be
- * able to pop up a dialog with the error
- * but also the vino URL as a selectable
- * label.
- *
- * Maybe chain this up to the caller?
- */
+ GtkWidget *message_dialog;
+
+ message_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog->dialog),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("There was an error showing the URL \"%s\""),
+ command);
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
+ "%s",
+ error->message);
+
+ gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE);
+
+ g_signal_connect (message_dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ NULL);
- g_warning ("Failed to show URL '%s': %s\n",
- link, error->message);
+ gtk_widget_show (message_dialog);
g_error_free (error);
}
+
+ g_free (mailto);
+ g_free (command);
}
static void
vino_preferences_dialog_setup_url_labels (VinoPreferencesDialog *dialog)
{
- char *command;
- char *mailto;
+ char *command, *label;
+ GtkWidget *image;
- dialog->url_labels_box = glade_xml_get_widget (dialog->xml, "url_labels_box");
- g_assert (dialog->url_labels_box);
+ dialog->url_label = glade_xml_get_widget (dialog->xml, "url_label");
+ dialog->send_email_button = glade_xml_get_widget (dialog->xml, "send_email_button");
+ g_assert (dialog->url_label);
dialog->listeners [dialog->n_listeners] =
gconf_client_notify_add (dialog->client,
@@ -1364,24 +1334,19 @@
}
command = vino_preferences_dialog_get_server_command (dialog);
- mailto = vino_preferences_dialog_construct_mailto (dialog, command);
+ label = g_strdup_printf ("<i>%s</i>", command);
- gtk_link_button_set_uri_hook (vino_preferences_dialog_uri_hook, NULL, NULL);
+ gtk_label_set_label (GTK_LABEL (dialog->url_label), label);
- dialog->url_label = gtk_link_button_new_with_label (mailto, command);
-
- dialog->tips = gtk_tooltips_new ();
- gtk_tooltips_set_tip (dialog->tips, dialog->url_label,
- _("Send this command by email"), NULL);
- g_object_ref_sink (dialog->tips);
+ image = gtk_image_new_from_icon_name ("gnome-stock-mail-fwd", GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (dialog->send_email_button), image);
+ g_signal_connect (dialog->send_email_button,
+ "clicked",
+ G_CALLBACK (vino_preferences_email_button_clicked),
+ dialog);
g_free (command);
- g_free (mailto);
-
- gtk_box_pack_start (GTK_BOX (dialog->url_labels_box),
- dialog->url_label,
- FALSE, FALSE, 0);
- gtk_widget_show (dialog->url_label);
+ g_free (label);
}
static void
@@ -1523,10 +1488,6 @@
g_free (dialog->mailto);
dialog->mailto = NULL;
- if (dialog->tips)
- g_object_unref (dialog->tips);
- dialog->tips = NULL;
-
if (dialog->client)
{
int i;
Modified: trunk/capplet/vino-preferences.glade
==============================================================================
--- trunk/capplet/vino-preferences.glade (original)
+++ trunk/capplet/vino-preferences.glade Wed Oct 22 16:39:48 2008
@@ -154,6 +154,45 @@
<property name="fill">False</property>
</packing>
</child>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <child>
+ <widget class="GtkLabel" id="url_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="xpad">1</property>
+ <property name="label">label</property>
+ <property name="use_markup">True</property>
+ <property name="selectable">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="send_email_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Send this command by email</property>
+ <property name="relief">GTK_RELIEF_NONE</property>
+ <property name="xalign">0</property>
+ <property name="response_id">0</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="position">3</property>
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Wed Oct 22 16:39:48 2008
@@ -1,4 +1,4 @@
-AC_INIT([vino], [2.24.2],
+AC_INIT([vino], [2.25.1],
[http://bugzilla.gnome.org/enter_bug.cgi?product=vino])
AC_CONFIG_SRCDIR(server/vino-fb.c)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]