Commit 2bd41bc2 authored by Jonathan Michalon's avatar Jonathan Michalon

OVCCGtk: fix few mishandling/segfault when connection dialog fails to load

parent 68ac911f
......@@ -469,7 +469,7 @@ ovccgtk_connection_dialog_validate (OVCCGtkConnectionDialog *self)
const gchar *
ovccgtk_connection_dialog_get_hostname (OVCCGtkConnectionDialog *self)
{
g_return_val_if_fail (OVCCGTK_IS_CONNECTION_DIALOG (self), FALSE);
g_return_val_if_fail (OVCCGTK_IS_CONNECTION_DIALOG (self), NULL);
return gtk_entry_get_text (GTK_ENTRY (self->priv->host));
}
......@@ -478,10 +478,15 @@ void
ovccgtk_connection_dialog_set_hostname (OVCCGtkConnectionDialog *self,
const gchar *hostname)
{
const gchar *old_hostname;
g_return_if_fail (OVCCGTK_IS_CONNECTION_DIALOG (self));
g_return_if_fail (hostname != NULL);
if (strcmp (ovccgtk_connection_dialog_get_hostname (self), hostname) != 0) {
old_hostname = ovccgtk_connection_dialog_get_hostname (self);
if (old_hostname == NULL)
return;
if (strcmp (old_hostname, hostname) != 0) {
gtk_entry_set_text (GTK_ENTRY (self->priv->host), hostname);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_HOSTNAME]);
}
......@@ -490,7 +495,7 @@ ovccgtk_connection_dialog_set_hostname (OVCCGtkConnectionDialog *self,
guint16
ovccgtk_connection_dialog_get_port (OVCCGtkConnectionDialog *self)
{
g_return_val_if_fail (OVCCGTK_IS_CONNECTION_DIALOG (self), FALSE);
g_return_val_if_fail (OVCCGTK_IS_CONNECTION_DIALOG (self), 0);
return (guint16) gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (self->priv->port));
}
......@@ -517,7 +522,7 @@ ovccgtk_connection_dialog_set_port (OVCCGtkConnectionDialog *self,
const gchar *
ovccgtk_connection_dialog_get_username (OVCCGtkConnectionDialog *self)
{
g_return_val_if_fail (OVCCGTK_IS_CONNECTION_DIALOG (self), FALSE);
g_return_val_if_fail (OVCCGTK_IS_CONNECTION_DIALOG (self), NULL);
return gtk_entry_get_text (GTK_ENTRY (self->priv->username));
}
......@@ -526,10 +531,15 @@ void
ovccgtk_connection_dialog_set_username (OVCCGtkConnectionDialog *self,
const gchar *username)
{
const gchar *old_username;
g_return_if_fail (OVCCGTK_IS_CONNECTION_DIALOG (self));
g_return_if_fail (username != NULL);
if (strcmp (ovccgtk_connection_dialog_get_username (self), username) != 0) {
old_username = ovccgtk_connection_dialog_get_username (self);
if (old_username == NULL)
return;
if (strcmp (old_username, username) != 0) {
gtk_entry_set_text (GTK_ENTRY (self->priv->username), username);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_USERNAME]);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment