diff --git a/gnome/src/account_schema.h b/gnome/src/account_schema.h index 5021bafc54a4535fb7bd89ca245a9822df12f30b..e85dc7c160b23110ba660fd0a58c2619d37b026c 100644 --- a/gnome/src/account_schema.h +++ b/gnome/src/account_schema.h @@ -75,6 +75,7 @@ static const char *const CONFIG_PUBLISHED_SAMEAS_LOCAL = "Account.publi static const char *const CONFIG_LOCAL_PORT = "Account.localPort"; static const char *const CONFIG_PUBLISHED_PORT = "Account.publishedPort"; static const char *const CONFIG_PUBLISHED_ADDRESS = "Account.publishedAddress"; +static const char *const CONFIG_UPNP_ENABLED = "Account.upnpEnabled"; // SIP specific parameters static const char *const CONFIG_STUN_SERVER = "STUN.server"; diff --git a/gnome/src/accountlist.c b/gnome/src/accountlist.c index 772e2b7257300648fd39fe8ccbe29f1f69fd4096..3ce790fee5f09c18f4634796205b507c3ea71893 100644 --- a/gnome/src/accountlist.c +++ b/gnome/src/accountlist.c @@ -342,6 +342,11 @@ gboolean account_has_autoanswer_on(const account_t *account) return g_strcmp0(account_lookup(account, CONFIG_ACCOUNT_AUTOANSWER), "true") == 0; } +gboolean account_has_upnp_on(const account_t *account) +{ + return g_strcmp0(account_lookup(account, CONFIG_UPNP_ENABLED), "true") == 0; +} + gboolean account_is_IP2IP(const account_t *account) { g_assert(account); diff --git a/gnome/src/accountlist.h b/gnome/src/accountlist.h index 24611f2caf8611eee1879b9aee2c50f296513d12..6741302b25d25f71cb80aff57f266b514a742825 100644 --- a/gnome/src/accountlist.h +++ b/gnome/src/accountlist.h @@ -194,6 +194,7 @@ gboolean current_account_has_new_message(void); gboolean account_has_custom_user_agent(const account_t *account); gboolean account_has_autoanswer_on(const account_t *account); +gboolean account_has_upnp_on(const account_t *account); gboolean account_is_IP2IP(const account_t *account); gboolean account_is_SIP(const account_t *account); gboolean account_is_IAX(const account_t *account); diff --git a/gnome/src/config/accountconfigdialog.c b/gnome/src/config/accountconfigdialog.c index 4f53f0d49788f3a34d4a5d163e3565bdcd4a390d..df2dee9a6b8da3372d595edc1ff8b29fd21e4b7e 100644 --- a/gnome/src/config/accountconfigdialog.c +++ b/gnome/src/config/accountconfigdialog.c @@ -110,6 +110,7 @@ static GtkWidget *video_port_max_spin_box; #endif static GtkWidget *presence_check_box; static gboolean is_account_new; +static GtkWidget *upnp_enabled_check_box; typedef struct OptionsData { account_t *account; @@ -149,6 +150,14 @@ auto_answer_cb(GtkToggleButton *widget, account_t *account) gtk_toggle_button_get_active(widget) ? "true" : "false"); } +static void +upnp_cb(GtkToggleButton *widget, account_t *account) +{ + account_replace(account, CONFIG_UPNP_ENABLED, + gtk_toggle_button_get_active(widget) ? "true" : "false"); +} + + static void user_agent_checkbox_cb(GtkToggleButton *widget, account_t *account) { @@ -301,6 +310,15 @@ create_auto_answer_checkbox(const account_t *account) return checkbox; } +static GtkWidget* +create_upnp_check_box(const account_t *account) +{ + GtkWidget *checkbox = gtk_check_button_new_with_mnemonic(_("_UPnP enabled")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox), account_has_upnp_on(account)); + g_signal_connect(checkbox, "toggled", G_CALLBACK(upnp_cb), (gpointer) account); + return checkbox; +} + static GtkWidget* create_user_agent_checkbox(const account_t *account) { @@ -551,6 +569,10 @@ create_parameters_frame(account_t *account, GtkWidget* account_combo) auto_answer_checkbox = create_auto_answer_checkbox(account); gtk_grid_attach(GTK_GRID(grid), auto_answer_checkbox, 0, row, 1, 1); + row++; + upnp_enabled_check_box = create_upnp_check_box(account); + gtk_grid_attach(GTK_GRID(grid), upnp_enabled_check_box, 0, row, 1, 1); + gtk_widget_show_all(grid); return frame; } @@ -1500,6 +1522,9 @@ static GtkWidget* create_direct_ip_calls_tab(account_t *account) auto_answer_checkbox = create_auto_answer_checkbox(account); gtk_box_pack_start(GTK_BOX(vbox), auto_answer_checkbox, FALSE, FALSE, 0); + upnp_enabled_check_box = create_upnp_check_box(account); + gtk_box_pack_start(GTK_BOX(vbox), upnp_enabled_check_box, FALSE, FALSE, 0); + gtk_widget_show_all(vbox); return vbox; }