[epiphany] prefs-dialog: Don't allow empty string for sync device name
- From: Gabriel Ivașcu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] prefs-dialog: Don't allow empty string for sync device name
- Date: Sun, 26 Nov 2017 00:03:24 +0000 (UTC)
commit f92f634eceb6fc3a339982cc35c6b6ccbf362fb2
Author: Gabriel Ivascu <gabrielivascu gnome org>
Date: Sun Nov 26 02:02:48 2017 +0200
prefs-dialog: Don't allow empty string for sync device name
src/prefs-dialog.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 5baf45f..4490018 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -636,10 +636,16 @@ on_sync_device_name_save_button_clicked (GtkWidget *button,
PrefsDialog *dialog)
{
EphySyncService *service = ephy_shell_get_sync_service (ephy_shell_get_default ());
- const char *name;
+ const char *text;
- name = gtk_entry_get_text (GTK_ENTRY (dialog->sync_device_name_entry));
- ephy_sync_service_register_device (service, name);
+ text = gtk_entry_get_text (GTK_ENTRY (dialog->sync_device_name_entry));
+ if (!g_strcmp0 (text, "")) {
+ char *name = ephy_sync_utils_get_device_name ();
+ gtk_entry_set_text (GTK_ENTRY (dialog->sync_device_name_entry), name);
+ g_free (name);
+ } else {
+ ephy_sync_service_register_device (service, text);
+ }
gtk_widget_set_sensitive (GTK_WIDGET (dialog->sync_device_name_entry), FALSE);
gtk_widget_set_visible (GTK_WIDGET (dialog->sync_device_name_change_button), TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]