Skip to content
Snippets Groups Projects
Commit 61bc0db0 authored by Stepan Salenikovich's avatar Stepan Salenikovich Committed by Guillaume Roguez
Browse files

gnome: add enable upnp option

Refs #64943

Change-Id: I2779c3d35647d91d422a7886a681b402b2011270
parent 2d028550
No related branches found
No related tags found
No related merge requests found
...@@ -75,6 +75,7 @@ static const char *const CONFIG_PUBLISHED_SAMEAS_LOCAL = "Account.publi ...@@ -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_LOCAL_PORT = "Account.localPort";
static const char *const CONFIG_PUBLISHED_PORT = "Account.publishedPort"; static const char *const CONFIG_PUBLISHED_PORT = "Account.publishedPort";
static const char *const CONFIG_PUBLISHED_ADDRESS = "Account.publishedAddress"; static const char *const CONFIG_PUBLISHED_ADDRESS = "Account.publishedAddress";
static const char *const CONFIG_UPNP_ENABLED = "Account.upnpEnabled";
// SIP specific parameters // SIP specific parameters
static const char *const CONFIG_STUN_SERVER = "STUN.server"; static const char *const CONFIG_STUN_SERVER = "STUN.server";
......
...@@ -342,6 +342,11 @@ gboolean account_has_autoanswer_on(const account_t *account) ...@@ -342,6 +342,11 @@ gboolean account_has_autoanswer_on(const account_t *account)
return g_strcmp0(account_lookup(account, CONFIG_ACCOUNT_AUTOANSWER), "true") == 0; 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) gboolean account_is_IP2IP(const account_t *account)
{ {
g_assert(account); g_assert(account);
......
...@@ -194,6 +194,7 @@ gboolean current_account_has_new_message(void); ...@@ -194,6 +194,7 @@ gboolean current_account_has_new_message(void);
gboolean account_has_custom_user_agent(const account_t *account); gboolean account_has_custom_user_agent(const account_t *account);
gboolean account_has_autoanswer_on(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_IP2IP(const account_t *account);
gboolean account_is_SIP(const account_t *account); gboolean account_is_SIP(const account_t *account);
gboolean account_is_IAX(const account_t *account); gboolean account_is_IAX(const account_t *account);
......
...@@ -110,6 +110,7 @@ static GtkWidget *video_port_max_spin_box; ...@@ -110,6 +110,7 @@ static GtkWidget *video_port_max_spin_box;
#endif #endif
static GtkWidget *presence_check_box; static GtkWidget *presence_check_box;
static gboolean is_account_new; static gboolean is_account_new;
static GtkWidget *upnp_enabled_check_box;
typedef struct OptionsData { typedef struct OptionsData {
account_t *account; account_t *account;
...@@ -149,6 +150,14 @@ auto_answer_cb(GtkToggleButton *widget, account_t *account) ...@@ -149,6 +150,14 @@ auto_answer_cb(GtkToggleButton *widget, account_t *account)
gtk_toggle_button_get_active(widget) ? "true" : "false"); 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 static void
user_agent_checkbox_cb(GtkToggleButton *widget, account_t *account) user_agent_checkbox_cb(GtkToggleButton *widget, account_t *account)
{ {
...@@ -301,6 +310,15 @@ create_auto_answer_checkbox(const account_t *account) ...@@ -301,6 +310,15 @@ create_auto_answer_checkbox(const account_t *account)
return checkbox; 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* static GtkWidget*
create_user_agent_checkbox(const account_t *account) create_user_agent_checkbox(const account_t *account)
{ {
...@@ -551,6 +569,10 @@ create_parameters_frame(account_t *account, GtkWidget* account_combo) ...@@ -551,6 +569,10 @@ create_parameters_frame(account_t *account, GtkWidget* account_combo)
auto_answer_checkbox = create_auto_answer_checkbox(account); auto_answer_checkbox = create_auto_answer_checkbox(account);
gtk_grid_attach(GTK_GRID(grid), auto_answer_checkbox, 0, row, 1, 1); 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); gtk_widget_show_all(grid);
return frame; return frame;
} }
...@@ -1500,6 +1522,9 @@ static GtkWidget* create_direct_ip_calls_tab(account_t *account) ...@@ -1500,6 +1522,9 @@ static GtkWidget* create_direct_ip_calls_tab(account_t *account)
auto_answer_checkbox = create_auto_answer_checkbox(account); auto_answer_checkbox = create_auto_answer_checkbox(account);
gtk_box_pack_start(GTK_BOX(vbox), auto_answer_checkbox, FALSE, FALSE, 0); 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); gtk_widget_show_all(vbox);
return vbox; return vbox;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment