Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntenore Gatta <antenore@simbiosi.org>2020-05-27 01:18:29 +0300
committerAntenore Gatta <antenore@simbiosi.org>2020-05-27 01:18:29 +0300
commit8b7dc32e2be13d05326a4b2870bf3ae7c64b54dc (patch)
treebe6467c0d945cfc48716ac3f3b41b9c75e6836c4
parentc0aaa389415f421abf7167f18383cdcef0009140 (diff)
Disable news at compile time, add an opt-in option. Debian #961501
Signed-off-by: Antenore Gatta <antenore@simbiosi.org>
-rw-r--r--CMakeLists.txt11
-rw-r--r--config.h.in1
-rw-r--r--data/ui/remmina_news.glade16
-rw-r--r--data/ui/remmina_preferences.glade77
-rw-r--r--src/remmina_pref.c12
-rw-r--r--src/remmina_pref.h1
-rw-r--r--src/remmina_pref_dialog.c5
-rw-r--r--src/remmina_pref_dialog.h1
-rw-r--r--src/rmnews.c59
-rw-r--r--src/rmnews.h1
10 files changed, 145 insertions, 39 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 39fbf3ccc..26f0f257c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -337,6 +337,17 @@ if(WITH_TRACE_CALLS)
add_definitions(-DWITH_TRACE_CALLS)
endif()
+option(WITH_NEWS "Disable online version checking" ON)
+if(WITH_NEWS)
+ message(STATUS "Enabling version check connecting to remmina.org")
+ add_definitions(-DWITH_NEWS)
+ set(RMNEWS_ENABLE_NEWS 1)
+else()
+ message(STATUS "Disabling version check connecting to remmina.org")
+ set(RMNEWS_ENABLE_NEWS 0)
+endif()
+
+
option(WITH_MANPAGES "Build with MANPAGES" ON)
if(WITH_MANPAGES)
message(STATUS "Enabling man pages.")
diff --git a/config.h.in b/config.h.in
index 53983c7a6..e59bf78aa 100644
--- a/config.h.in
+++ b/config.h.in
@@ -16,6 +16,7 @@
#define REMMINA_APP_ID "${REMMINA_APP_ID}"
#define VERSION "${REMMINA_VERSION}"
#define REMMINA_GIT_REVISION "${REMMINA_GIT_REVISION}"
+#define RMNEWS_ENABLE_NEWS ${RMNEWS_ENABLE_NEWS}
#define GETTEXT_PACKAGE remmina
diff --git a/data/ui/remmina_news.glade b/data/ui/remmina_news.glade
index 81250167a..987c8902f 100644
--- a/data/ui/remmina_news.glade
+++ b/data/ui/remmina_news.glade
@@ -68,16 +68,22 @@
<object class="GtkLabel" id="rmnews_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">&lt;big&gt;&lt;b&gt;The news are disabled&lt;/b&gt;&lt;/big&gt;
-
+ <property name="margin_left">18</property>
+ <property name="margin_right">18</property>
+ <property name="margin_top">18</property>
+ <property name="margin_bottom">18</property>
+ <property name="label" translatable="yes">&lt;big&gt;&lt;b&gt;The news are turned off&lt;/b&gt;&lt;/big&gt;
&lt;span&gt;
-&lt;a href="https://gitlab.com/Remmina/Remmina/-/tags/" title="&lt;i&gt;Remmina&lt;/i&gt; release notes"&gt;Read the release notes&lt;/a&gt;.
+Turning on news means the program connects to a Remmina server to download the release notes.
&lt;/span&gt;
+&lt;span&gt;
+Version checking can be activated only at compile time.
+&lt;/span&gt;
&lt;span&gt;
-Be aware that if you enable the news you agree that Remmina connects to &lt;a href="https://remmina.org/news/remmina_news.php" title="Remmina news script"&gt;our server&lt;/a&gt; in order to gather the release notes.
+&lt;a href="https://gitlab.com/Remmina/Remmina/-/tags/" title="&lt;i&gt;Remmina&lt;/i&gt; release notes"&gt;Read the release notes&lt;/a&gt;.
&lt;/span&gt;</property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
@@ -174,7 +180,7 @@ Be aware that if you enable the news you agree that Remmina connects to &lt;a hr
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
- <property name="label" translatable="yes">Allow news from &lt;a href="https://remmina.org" title="Remmina news site"&gt;remmina.org&lt;/a&gt;</property>
+ <property name="label" translatable="yes">Fetch news from &lt;a href="https://remmina.org" title="Remmina news site"&gt;remmina.org&lt;/a&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
diff --git a/data/ui/remmina_preferences.glade b/data/ui/remmina_preferences.glade
index 4baa1bddd..a59dafa5b 100644
--- a/data/ui/remmina_preferences.glade
+++ b/data/ui/remmina_preferences.glade
@@ -419,7 +419,8 @@ Author: Antenore Gatta
<property name="halign">start</property>
<property name="margin_left">18</property>
<property name="hexpand">False</property>
- <property name="label" translatable="yes">Send anonymous statistics for use on https://remmina.org/remmina-stats</property>
+ <property name="label" translatable="yes">Send anonymous statistics for use on &lt;a href="https://remmina.org/remmina-stats" title="Remmina stats site"&gt;remmina.org&lt;/a&gt;</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -441,17 +442,39 @@ Author: Antenore Gatta
</packing>
</child>
<child>
- <object class="GtkSwitch" id="switch_options_deny_screenshot_clipboard">
+ <object class="GtkLabel" id="label_options_file_name">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Set a custom filename for your Remmina connection profiles, using a formatting string.</property>
<property name="halign">start</property>
- <property name="valign">center</property>
+ <property name="margin_left">18</property>
+ <property name="hexpand">False</property>
+ <property name="label" translatable="yes">Profile filename template</property>
+ <property name="justify">right</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_options_file_name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">%G Group name (slash will be converted to - automatically)
+%P Protocol name
+%N Connection name
+%h Hostname/IP
+
+
+</property>
<property name="margin_right">18</property>
- <property name="margin_bottom">18</property>
+ <property name="width_chars">25</property>
+ <property name="placeholder_text">%G_%P_%N_%h</property>
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">12</property>
+ <property name="top_attach">1</property>
<property name="width">2</property>
</packing>
</child>
@@ -469,43 +492,51 @@ Author: Antenore Gatta
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">12</property>
+ <property name="top_attach">13</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label_options_file_name">
+ <object class="GtkSwitch" id="switch_options_deny_screenshot_clipboard">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="margin_right">18</property>
+ <property name="margin_bottom">18</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">13</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_permit_news">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Set a custom filename for your Remmina connection profiles, using a formatting string.</property>
+ <property name="tooltip_text" translatable="yes">Send anonymous statistics for use on https://remmina.org/remmina-stats</property>
<property name="halign">start</property>
<property name="margin_left">18</property>
<property name="hexpand">False</property>
- <property name="label" translatable="yes">Profile filename template</property>
- <property name="justify">right</property>
+ <property name="label" translatable="yes">Fetch news from &lt;a href="https://remmina.org" title="Remmina news site"&gt;remmina.org&lt;/a&gt;</property>
+ <property name="use_markup">True</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="top_attach">12</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="entry_options_file_name">
+ <object class="GtkSwitch" id="switch_permit_news">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">%G Group name (slash will be converted to - automatically)
-%P Protocol name
-%N Connection name
-%h Hostname/IP
-
-
-</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
<property name="margin_right">18</property>
- <property name="width_chars">25</property>
- <property name="placeholder_text">%G_%P_%N_%h</property>
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">1</property>
+ <property name="top_attach">12</property>
<property name="width">2</property>
</packing>
</child>
diff --git a/src/remmina_pref.c b/src/remmina_pref.c
index 1e55faaa0..f901ab484 100644
--- a/src/remmina_pref.c
+++ b/src/remmina_pref.c
@@ -677,6 +677,17 @@ void remmina_pref_init(void)
else
remmina_pref.periodic_usage_stats_uuid_prefix = NULL;
+ /** RMNEWS_ENABLE_NEWS is equal to 0 (FALSE) when compiled with -DWiTH_NEWS=OFF,
+ * otherwise is value is 1 (TRUE), that is the default value
+ */
+ if (RMNEWS_ENABLE_NEWS == 0)
+ remmina_pref.periodic_news_permitted = RMNEWS_ENABLE_NEWS;
+ else if (g_key_file_has_key(gkeyfile, "remmina_news", "periodic_news_permitted", NULL))
+ remmina_pref.periodic_news_permitted = g_key_file_get_boolean(gkeyfile, "remmina_news", "periodic_news_permitted", NULL);
+ else
+ remmina_pref.periodic_news_permitted = RMNEWS_ENABLE_NEWS;
+
+
if (g_key_file_has_key(gkeyfile, "remmina_news", "periodic_rmnews_last_get", NULL))
remmina_pref.periodic_rmnews_last_get = g_key_file_get_int64(gkeyfile, "remmina_news", "periodic_rmnews_last_get", NULL);
else
@@ -828,6 +839,7 @@ gboolean remmina_pref_save(void)
g_key_file_set_int64(gkeyfile, "usage_stats", "periodic_usage_stats_last_sent", remmina_pref.periodic_usage_stats_last_sent);
g_key_file_set_string(gkeyfile, "usage_stats", "periodic_usage_stats_uuid_prefix",
remmina_pref.periodic_usage_stats_uuid_prefix ? remmina_pref.periodic_usage_stats_uuid_prefix : "");
+ g_key_file_set_boolean(gkeyfile, "remmina_news", "periodic_news_permitted", remmina_pref.periodic_news_permitted);
g_key_file_set_int64(gkeyfile, "remmina_news", "periodic_rmnews_last_get", remmina_pref.periodic_rmnews_last_get);
g_key_file_set_integer(gkeyfile, "remmina_news", "periodic_rmnews_get_count", remmina_pref.periodic_rmnews_get_count);
g_key_file_set_string(gkeyfile, "remmina_news", "periodic_rmnews_uuid_prefix",
diff --git a/src/remmina_pref.h b/src/remmina_pref.h
index 8f575829a..729cf983a 100644
--- a/src/remmina_pref.h
+++ b/src/remmina_pref.h
@@ -205,6 +205,7 @@ typedef struct _RemminaPref {
gchar * last_success;
/* Remmina news */
+ gboolean periodic_news_permitted;
glong periodic_rmnews_last_get;
glong periodic_rmnews_get_count;
gchar * periodic_rmnews_uuid_prefix;
diff --git a/src/remmina_pref_dialog.c b/src/remmina_pref_dialog.c
index 52be09225..b19163272 100644
--- a/src/remmina_pref_dialog.c
+++ b/src/remmina_pref_dialog.c
@@ -220,6 +220,8 @@ void remmina_pref_on_dialog_destroy(GtkWidget *widget, gpointer user_data)
b = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_permit_send_stats));
remmina_pref.periodic_usage_stats_permitted = b;
+ b = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_permit_news));
+ remmina_pref.periodic_news_permitted = b;
remmina_pref.default_action = gtk_combo_box_get_active(remmina_pref_dialog->comboboxtext_options_double_click);
remmina_pref.default_mode = gtk_combo_box_get_active(remmina_pref_dialog->comboboxtext_appearance_view_mode);
@@ -455,6 +457,7 @@ static void remmina_pref_dialog_init(void)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_hide_searchbar), remmina_pref.hide_searchbar);
gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_permit_send_stats), remmina_pref.periodic_usage_stats_permitted);
+ gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_permit_news), remmina_pref.periodic_news_permitted);
g_snprintf(buf, sizeof(buf), "%i", remmina_pref.sshtunnel_port);
gtk_entry_set_text(remmina_pref_dialog->entry_options_ssh_port, buf);
@@ -643,6 +646,8 @@ GtkDialog* remmina_pref_dialog_new(gint default_tab, GtkWindow *parent)
remmina_pref_dialog->checkbutton_appearance_hide_toolbar = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_hide_toolbar"));
remmina_pref_dialog->checkbutton_appearance_hide_searchbar = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_hide_searchbar"));
remmina_pref_dialog->switch_permit_send_stats = GTK_SWITCH(GET_OBJECT("switch_permit_send_stats"));
+ remmina_pref_dialog->switch_permit_news = GTK_SWITCH(GET_OBJECT("switch_permit_news"));
+ gtk_widget_set_sensitive (GTK_WIDGET(remmina_pref_dialog->switch_permit_news), RMNEWS_ENABLE_NEWS);
remmina_pref_dialog->comboboxtext_options_double_click = GTK_COMBO_BOX(GET_OBJECT("comboboxtext_options_double_click"));
remmina_pref_dialog->comboboxtext_appearance_view_mode = GTK_COMBO_BOX(GET_OBJECT("comboboxtext_appearance_view_mode"));
remmina_pref_dialog->comboboxtext_appearance_tab_interface = GTK_COMBO_BOX(GET_OBJECT("comboboxtext_appearance_tab_interface"));
diff --git a/src/remmina_pref_dialog.h b/src/remmina_pref_dialog.h
index e29fd79d5..233713b29 100644
--- a/src/remmina_pref_dialog.h
+++ b/src/remmina_pref_dialog.h
@@ -64,6 +64,7 @@ typedef struct _RemminaPrefDialog {
GtkCheckButton * checkbutton_appearance_hide_toolbar;
GtkCheckButton * checkbutton_appearance_hide_searchbar;
GtkSwitch * switch_permit_send_stats;
+ GtkSwitch * switch_permit_news;
GtkComboBox * comboboxtext_options_double_click;
GtkComboBox * comboboxtext_appearance_view_mode;
GtkComboBox * comboboxtext_appearance_tab_interface;
diff --git a/src/rmnews.c b/src/rmnews.c
index cd980d02d..7cf08e03a 100644
--- a/src/rmnews.c
+++ b/src/rmnews.c
@@ -99,10 +99,27 @@ gint eweekdays[7] = {
604800
};
+void rmnews_news_switch_state_set_cb()
+{
+ TRACE_CALL(__func__);
+ if (rmnews_news_dialog->rmnews_news_switch && \
+ gtk_switch_get_active(rmnews_news_dialog->rmnews_news_switch)) {
+ remmina_pref.periodic_news_permitted = TRUE;
+ if (remmina_pref_save()) {
+ remmina_stats_sender_schedule();
+ }
+ } else {
+ remmina_pref.periodic_news_permitted = FALSE;
+ remmina_pref_save();
+ }
+
+}
+
void rmnews_stats_switch_state_set_cb()
{
TRACE_CALL(__func__);
- if (gtk_switch_get_active(rmnews_news_dialog->rmnews_stats_switch)) {
+ if (rmnews_news_dialog->rmnews_stats_switch \
+ && gtk_switch_get_active(rmnews_news_dialog->rmnews_stats_switch)) {
remmina_pref.periodic_usage_stats_permitted = TRUE;
if (remmina_pref_save()) {
remmina_stats_sender_schedule();
@@ -159,7 +176,8 @@ static gchar *rmnews_get_file_contents(gchar *path)
static void rmnews_close_clicked(GtkButton *btn, gpointer user_data)
{
TRACE_CALL(__func__);
- gtk_widget_destroy(GTK_WIDGET(rmnews_news_dialog->dialog));
+ if (rmnews_news_dialog->dialog)
+ gtk_widget_destroy(GTK_WIDGET(rmnews_news_dialog->dialog));
rmnews_news_dialog->dialog = NULL;
g_free(rmnews_news_dialog);
rmnews_news_dialog = NULL;
@@ -191,19 +209,28 @@ void rmnews_show_news(GtkWindow *parent)
rmnews_news_dialog->rmnews_label = GTK_LABEL(GET_OBJ("rmnews_label"));
//rmnews_news_dialog->rmnews_stats_label = GTK_LABEL(GET_OBJ("rmnews_stats_label"));
rmnews_news_dialog->rmnews_stats_switch = GTK_SWITCH(GET_OBJ("rmnews_stats_switch"));
- if (remmina_pref.periodic_usage_stats_permitted == TRUE) {
+ if (remmina_pref.periodic_usage_stats_permitted == 1) {
gtk_switch_set_active(rmnews_news_dialog->rmnews_stats_switch, TRUE);
}
rmnews_news_dialog->rmnews_defaultcl_label = GTK_LABEL(GET_OBJ("rmnews_defaultcl_label"));
rmnews_news_dialog->rmnews_defaultcl_button = GTK_BUTTON(GET_OBJ("rmnews_defaultcl_switch"));
+ rmnews_news_dialog->rmnews_news_switch = GTK_SWITCH(GET_OBJ("rmnews_news_switch"));
+ if (remmina_pref.periodic_news_permitted == 1) {
+ gtk_switch_set_active(rmnews_news_dialog->rmnews_news_switch, TRUE);
+ } else
+ gtk_switch_set_active(rmnews_news_dialog->rmnews_news_switch, FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET(rmnews_news_dialog->rmnews_news_switch), RMNEWS_ENABLE_NEWS);
+
rmnews_news_dialog->rmnews_button_close = GTK_BUTTON(GET_OBJ("rmnews_button_close"));
gtk_widget_set_can_default(GTK_WIDGET(rmnews_news_dialog->rmnews_button_close), TRUE);
gtk_widget_grab_default(GTK_WIDGET(rmnews_news_dialog->rmnews_button_close));
- gchar *contents = rmnews_get_file_contents(g_strdup(output_file_path));
- if (contents) {
- gtk_label_set_markup(rmnews_news_dialog->rmnews_label, contents);
- g_free(contents);
+ if (remmina_pref.periodic_news_permitted == 1) {
+ gchar *contents = rmnews_get_file_contents(g_strdup(output_file_path));
+ if (contents) {
+ gtk_label_set_markup(rmnews_news_dialog->rmnews_label, contents);
+ g_free(contents);
+ }
}
g_signal_connect(rmnews_news_dialog->rmnews_button_close, "clicked",
@@ -222,8 +249,6 @@ void rmnews_show_news(GtkWindow *parent)
if (parent)
gtk_window_set_transient_for(GTK_WINDOW(rmnews_news_dialog->dialog), parent);
gtk_window_set_modal (GTK_WINDOW(rmnews_news_dialog->dialog), TRUE);
-
-
}
static void rmnews_get_url_cb(SoupSession *session, SoupMessage *msg, gpointer data)
@@ -520,9 +545,21 @@ static gboolean rmnews_periodic_check(gpointer user_data)
}
REMMINA_DEBUG ("periodic_rmnews_last_get is %ld", remmina_pref.periodic_rmnews_last_get);
+ if (remmina_pref.periodic_news_permitted == 0 && remmina_pref.periodic_rmnews_get_count < 1) {
+ remmina_pref.periodic_rmnews_last_get = 0;
+ remmina_pref_save();
+ }
next = remmina_pref.periodic_rmnews_last_get + RMNEWS_INTERVAL_SEC;
- if (unixts > next || (unixts < remmina_pref.periodic_rmnews_last_get && unixts > 1514764800))
- rmnews_get_news();
+ if (unixts > next || (unixts < remmina_pref.periodic_rmnews_last_get && unixts > 1514764800)) {
+ REMMINA_DEBUG("remmina_pref.periodic_news_permitted is %d", remmina_pref.periodic_news_permitted);
+ if (remmina_pref.periodic_news_permitted == 1)
+ rmnews_get_news();
+ else if (remmina_pref.periodic_rmnews_get_count == 0) {
+ rmnews_show_news(remmina_main_get_window());
+ remmina_pref.periodic_rmnews_get_count = 1;
+ remmina_pref_save();
+ }
+ }
return G_SOURCE_CONTINUE;
}
diff --git a/src/rmnews.h b/src/rmnews.h
index 715409190..214dd834a 100644
--- a/src/rmnews.h
+++ b/src/rmnews.h
@@ -43,6 +43,7 @@ typedef struct _RemminaNewsDialog {
GtkSwitch * rmnews_stats_switch;
GtkLabel * rmnews_defaultcl_label;
GtkButton * rmnews_defaultcl_button;
+ GtkSwitch * rmnews_news_switch;
gint retval;
} RemminaNewsDialog;