[Commits] [SCM] claws branch, master, updated. 3.14.0-97-g878fcae
mones at claws-mail.org
mones at claws-mail.org
Thu Sep 29 00:24:09 CEST 2016
The branch, master has been updated
via 878fcaeb00a9044d13fc19d7658cd680880531f9 (commit)
from af113911d30229e62f4f7de94081dd7cf59b9fef (commit)
Summary of changes:
src/plugins/clamd/clamav_plugin.c | 11 ++++++++---
src/plugins/clamd/clamav_plugin_gtk.c | 12 ++++--------
2 files changed, 12 insertions(+), 11 deletions(-)
- Log -----------------------------------------------------------------
commit 878fcaeb00a9044d13fc19d7658cd680880531f9
Author: Ricardo Mones <ricardo at mones.org>
Date: Thu Sep 29 00:23:20 2016 +0200
Use a spinbutton for port number also in clamd
Default value is now 0 instead of an empty string.
diff --git a/src/plugins/clamd/clamav_plugin.c b/src/plugins/clamd/clamav_plugin.c
index 751d3ca..43dff0b 100644
--- a/src/plugins/clamd/clamav_plugin.c
+++ b/src/plugins/clamd/clamav_plugin.c
@@ -68,7 +68,7 @@ static PrefParam param[] = {
NULL, NULL, NULL},
{"clamd_host", NULL, &config.clamd_host, P_STRING,
NULL, NULL, NULL},
- {"clamd_port", NULL, &config.clamd_port, P_INT,
+ {"clamd_port", "0", &config.clamd_port, P_INT,
NULL, NULL, NULL},
{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
@@ -200,8 +200,13 @@ static gboolean mail_filtering_hook(gpointer source, gpointer data)
Clamd_Stat clamd_prepare(void) {
debug_print("Creating socket\n");
- if (!config.clamd_config_type || (config.clamd_host != NULL && config.clamd_port > 0)) {
- if (config.clamd_host == NULL || config.clamd_port < 1) {
+ if (!config.clamd_config_type
+ || (config.clamd_host != NULL
+ && *(config.clamd_host) != '\0'
+ && config.clamd_port > 0)) {
+ if (config.clamd_host == NULL
+ || *(config.clamd_host) == '\0'
+ || config.clamd_port == 0) {
/* error */
return NO_SOCKET;
}
diff --git a/src/plugins/clamd/clamav_plugin_gtk.c b/src/plugins/clamd/clamav_plugin_gtk.c
index c2b29f5..77d5d8f 100644
--- a/src/plugins/clamd/clamav_plugin_gtk.c
+++ b/src/plugins/clamd/clamav_plugin_gtk.c
@@ -163,7 +163,7 @@ static void setting_type_cb(GtkWidget *widget, gpointer data) {
debug_print("Resetting configuration\n");
gtk_editable_delete_text(GTK_EDITABLE(page->config_folder), 0, -1);
gtk_editable_delete_text(GTK_EDITABLE(page->config_host), 0, -1);
- gtk_editable_delete_text(GTK_EDITABLE(page->config_port), 0, -1);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(page->config_port), (gdouble) 0);
clamav_save_config();
c = clamd_get_config();
@@ -390,9 +390,7 @@ static void clamav_create_widget_func(PrefsPage * _page, GtkWindow *window, gpoi
gtk_widget_show (port_label);
gtk_box_pack_start (GTK_BOX (hbox_manual2), port_label, FALSE, FALSE, 0);
- config_port = gtk_entry_new ();
- gtk_entry_set_width_chars(GTK_ENTRY(config_port), 5);
- gtk_entry_set_max_length(GTK_ENTRY(config_port), 5);
+ config_port = gtk_spin_button_new_with_range(0, 65535, 1);
gtk_widget_show (config_port);
gtk_box_pack_start (GTK_BOX (hbox_manual2), config_port, FALSE, FALSE, 0);
gtk_tooltips_set_tip(tooltips, config_port,
@@ -429,9 +427,7 @@ static void clamav_create_widget_func(PrefsPage * _page, GtkWindow *window, gpoi
if (!config->clamd_config_type) {
/*if (config->clamd_host && strlen(config->clamd_host) > 0 && config->clamd_port > 0) {*/
gtk_entry_set_text(GTK_ENTRY(config_host), config->clamd_host);
- gchar* s = int2char(config->clamd_port);
- gtk_entry_set_text(GTK_ENTRY(config_port), s);
- g_free(s);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(config_port), (gdouble) config->clamd_port);
/* activate manual checkbox and blind folder */
debug_print("Showing manual configuration and hiding automatic configuration\n");
if (! clamd_config) {
@@ -518,7 +514,7 @@ static void clamav_save_func(PrefsPage *_page)
config->clamd_config_folder = gtk_editable_get_chars(GTK_EDITABLE(page->config_folder), 0, -1);
g_free(config->clamd_host);
config->clamd_host = gtk_editable_get_chars(GTK_EDITABLE(page->config_host), 0, -1);
- config->clamd_port = atoi(gtk_entry_get_text(GTK_ENTRY(page->config_port)));
+ config->clamd_port = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(page->config_port));
if (config->clamav_enable) {
Clamd_Stat status = clamd_prepare();
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list