[Commits] [SCM] claws branch, master, updated. 3.9.3-147-g0257b73

colin at claws-mail.org colin at claws-mail.org
Fri May 2 10:04:19 CEST 2014


The branch master of project "claws" (Claws Mail) has been updated
       via  0257b732c63d28f205e397a639b87f075b1e5a54 (commit)
       via  5ff93b4877c019777f08921feecae38e6c7fbd62 (commit)
       via  591039ff016826e9a8a7e5ecf04f7b4a64aef382 (commit)
       via  4137e86e2eb847015dfe9e4f93bc14bc6f8b3ab7 (commit)
       via  46a3424081c65b08527f6fa46d4ed50a33644b88 (commit)
       via  7cea752b768a7ab014148e84232a870adb56aedd (commit)
      from  aa42c515798b4c2eae901853cd629a80a5eb92fa (commit)


- Log -----------------------------------------------------------------
commit 0257b732c63d28f205e397a639b87f075b1e5a54
Author: Colin Leroy <colin at colino.net>
Date:   Fri May 2 10:04:17 2014 +0200

    Fix libravatar depending on auto_configure_service in a synchronous manner.

diff --git a/src/gtk/gtkutils.c b/src/gtk/gtkutils.c
index e2c0a71..4b227e7 100644
--- a/src/gtk/gtkutils.c
+++ b/src/gtk/gtkutils.c
@@ -1984,4 +1984,44 @@ void auto_configure_service(AutoConfigureData *data)
 					data->cancel, resolve_done, data);
 	}
 }
+
+gboolean auto_configure_service_sync(const gchar *service, const gchar *domain, gchar **srvhost, guint16 *srvport)
+{
+	GResolver *resolver;
+	GList *answers, *cur;
+	GError *error = NULL;
+	gboolean result = FALSE;
+
+	cm_return_val_if_fail(service != NULL, FALSE);
+	cm_return_val_if_fail(domain != NULL, FALSE);
+
+	resolver = g_resolver_get_default();
+	if (resolver == NULL)
+		return FALSE;
+
+	answers = g_resolver_lookup_service(resolver, service, "tcp", domain, NULL, &error);
+
+	*srvhost = NULL;
+	*srvport = 0;
+
+	if (answers) {
+		for (cur = g_srv_target_list_sort(answers); cur; cur = cur->next) {
+			GSrvTarget *target = (GSrvTarget *)cur->data;
+			const gchar *hostname = g_srv_target_get_hostname(target);
+			guint16 port = g_srv_target_get_port(target);
+			if (hostname && strcmp(hostname,"") && port > 0) {
+				result = TRUE;
+				*srvhost = g_strdup(hostname);
+				*srvport = port;
+				break;
+			}
+		}
+		g_resolver_free_targets(answers);
+	} else if (error) {
+		g_error_free(error);
+	}
+
+	g_object_unref(resolver);
+	return result;
+}
 #endif
\ No newline at end of file
diff --git a/src/gtk/gtkutils.h b/src/gtk/gtkutils.h
index 8c3849f..39a8a32 100644
--- a/src/gtk/gtkutils.h
+++ b/src/gtk/gtkutils.h
@@ -231,6 +231,7 @@ typedef struct _AutoConfigureData {
 } AutoConfigureData;
 
 void auto_configure_service(AutoConfigureData *data);
+gboolean auto_configure_service_sync(const gchar *service, const gchar *domain, gchar **srvhost, guint16 *srvport);
 #endif
 
 
diff --git a/src/plugins/libravatar/libravatar_federation.c b/src/plugins/libravatar/libravatar_federation.c
index 106fdfb..aee618e 100644
--- a/src/plugins/libravatar/libravatar_federation.c
+++ b/src/plugins/libravatar/libravatar_federation.c
@@ -111,14 +111,14 @@ gchar *federated_url_for_address(const gchar *address)
 	}
 
 	/* not cached, try secure service first */
-	if (auto_configure_service("avatars-sec", domain, &host, &port)) {
+	if (auto_configure_service_sync("avatars-sec", domain, &host, &port)) {
 		if (port != 443) {
 			url = g_strdup_printf("https://%s:%d/avatar", host, port);
 		} else {
 			url = g_strdup_printf("https://%s/avatar", host);
 		}
 	} else { /* try standard one if no secure service available */
-		if (auto_configure_service("avatars", domain, &host, &port)) {
+		if (auto_configure_service_sync("avatars", domain, &host, &port)) {
 			if (port != 80) {
 				url = g_strdup_printf("http://%s:%d/avatar", host, port);
 			} else {

commit 5ff93b4877c019777f08921feecae38e6c7fbd62
Author: Colin Leroy <colin at colino.net>
Date:   Fri May 2 10:03:18 2014 +0200

    Fix typo

diff --git a/src/compose.c b/src/compose.c
index 5b7a58e..b23d091 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -183,7 +183,7 @@ typedef enum {
 #define MAX_REFERENCES_LEN	999
 
 #define COMPOSE_DRAFT_TIMEOUT_UNSET -1
-#define COMPOSE_DRAFT_TIMEOUT_FORBIDEN -2
+#define COMPOSE_DRAFT_TIMEOUT_FORBIDDEN -2
 
 static GList *compose_list = NULL;
 static GSList *extra_headers = NULL;

commit 591039ff016826e9a8a7e5ecf04f7b4a64aef382
Author: Colin Leroy <colin at colino.net>
Date:   Fri May 2 10:02:44 2014 +0200

    Fix warning

diff --git a/src/headerview.c b/src/headerview.c
index 7880d25..d4db9bb 100644
--- a/src/headerview.c
+++ b/src/headerview.c
@@ -226,7 +226,6 @@ static gint headerview_show_avatar (HeaderView *headerview, MsgInfo *msginfo)
 {
 	AvatarRender *avatarr = avatars_avatarrender_new(msginfo);
 	GtkWidget *hbox = headerview->hbox;
-	GtkWidget *image;
 
 	hooks_invoke(AVATAR_IMAGE_RENDER_HOOKLIST, avatarr);
 

commit 4137e86e2eb847015dfe9e4f93bc14bc6f8b3ab7
Author: Colin Leroy <colin at colino.net>
Date:   Fri May 2 10:02:18 2014 +0200

    Fix warning

diff --git a/src/gtk/combobox.c b/src/gtk/combobox.c
index b4967f5..c44858a 100644
--- a/src/gtk/combobox.c
+++ b/src/gtk/combobox.c
@@ -117,7 +117,7 @@ static gboolean _select_by_text_func(GtkTreeModel *model,	GtkTreePath *path,
 {
 	GtkComboBox *combobox = ctx->combobox;
 	const gchar *data = ctx->cdata;
-	const gchar *curdata;
+	gchar *curdata;
 
 	cm_return_val_if_fail(combobox != NULL, FALSE);
 	cm_return_val_if_fail(GTK_IS_COMBO_BOX (combobox), FALSE);

commit 46a3424081c65b08527f6fa46d4ed50a33644b88
Author: Colin Leroy <colin at colino.net>
Date:   Fri May 2 09:54:52 2014 +0200

    Fix g_timeout usage

diff --git a/src/compose.c b/src/compose.c
index 6f4c8b9..5b7a58e 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -182,6 +182,9 @@ typedef enum {
 
 #define MAX_REFERENCES_LEN	999
 
+#define COMPOSE_DRAFT_TIMEOUT_UNSET -1
+#define COMPOSE_DRAFT_TIMEOUT_FORBIDEN -2
+
 static GList *compose_list = NULL;
 static GSList *extra_headers = NULL;
 
@@ -1266,7 +1269,8 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
 	if (prefs_common.auto_exteditor)
 		compose_exec_ext_editor(compose);
 
-	compose->draft_timeout_tag = -1;
+	compose->draft_timeout_tag = COMPOSE_DRAFT_TIMEOUT_UNSET;
+
 	SCROLL_TO_CURSOR(compose);
 
 	compose->modified = FALSE;
@@ -1707,7 +1711,7 @@ static Compose *compose_generic_reply(MsgInfo *msginfo,
 	compose_set_title(compose);
 
 	compose->updating = FALSE;
-	compose->draft_timeout_tag = -1; /* desinhibit auto-drafting after loading */
+	compose->draft_timeout_tag = COMPOSE_DRAFT_TIMEOUT_UNSET; /* desinhibit auto-drafting after loading */
 	SCROLL_TO_CURSOR(compose);
 	
 	if (compose->deferred_destroy) {
@@ -1910,7 +1914,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
 	compose_set_title(compose);
 
 	compose->updating = FALSE;
-	compose->draft_timeout_tag = -1; /* desinhibit auto-drafting after loading */
+	compose->draft_timeout_tag = COMPOSE_DRAFT_TIMEOUT_UNSET; /* desinhibit auto-drafting after loading */
 	SCROLL_TO_CURSOR(compose);
 
 	if (compose->deferred_destroy) {
@@ -2058,7 +2062,7 @@ static Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_
 	compose_set_title(compose);
 
 	compose->updating = FALSE;
-	compose->draft_timeout_tag = -1; /* desinhibit auto-drafting after loading */
+	compose->draft_timeout_tag = COMPOSE_DRAFT_TIMEOUT_UNSET; /* desinhibit auto-drafting after loading */
 	SCROLL_TO_CURSOR(compose);
 
 	if (compose->deferred_destroy) {
@@ -2131,21 +2135,21 @@ static void compose_colorize_signature(Compose *compose)
 				G_CALLBACK(text_inserted),		\
 				compose);				\
 }
-#define UNBLOCK_WRAP() {						\
-	compose->autowrap = prev_autowrap;				\
-	if (compose->autowrap) {					\
-		gint old = compose->draft_timeout_tag;			\
-		compose->draft_timeout_tag = -2;			\
-		compose_wrap_all(compose);				\
-		compose->draft_timeout_tag = old;			\
-	}								\
-									\
-	g_signal_handlers_unblock_by_func(G_OBJECT(buffer),		\
-				G_CALLBACK(compose_changed_cb),		\
-				compose);				\
-	g_signal_handlers_unblock_by_func(G_OBJECT(buffer),		\
-				G_CALLBACK(text_inserted),		\
-				compose);				\
+#define UNBLOCK_WRAP() {							\
+	compose->autowrap = prev_autowrap;					\
+	if (compose->autowrap) {						\
+		gint old = compose->draft_timeout_tag;				\
+		compose->draft_timeout_tag = COMPOSE_DRAFT_TIMEOUT_FORBIDDEN;	\
+		compose_wrap_all(compose);					\
+		compose->draft_timeout_tag = old;				\
+	}									\
+										\
+	g_signal_handlers_unblock_by_func(G_OBJECT(buffer),			\
+				G_CALLBACK(compose_changed_cb),			\
+				compose);					\
+	g_signal_handlers_unblock_by_func(G_OBJECT(buffer),			\
+				G_CALLBACK(text_inserted),			\
+				compose);					\
 }
 
 Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
@@ -2408,7 +2412,7 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
 	compose_set_title(compose);
 
 	compose->updating = FALSE;
-	compose->draft_timeout_tag = -1; /* desinhibit auto-drafting after loading */
+	compose->draft_timeout_tag = COMPOSE_DRAFT_TIMEOUT_UNSET; /* desinhibit auto-drafting after loading */
 	SCROLL_TO_CURSOR(compose);
 
 	if (compose->deferred_destroy) {
@@ -2518,7 +2522,7 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo,
 	compose->modified = FALSE;
 	compose_set_title(compose);
 	compose->updating = FALSE;
-	compose->draft_timeout_tag = -1; /* desinhibit auto-drafting after loading */
+	compose->draft_timeout_tag = COMPOSE_DRAFT_TIMEOUT_UNSET; /* desinhibit auto-drafting after loading */
 	SCROLL_TO_CURSOR(compose);
 
 	if (compose->deferred_destroy) {
@@ -4312,7 +4316,7 @@ static gboolean compose_beautify_paragraph(Compose *compose, GtkTextIter *par_it
 	if (force) {
 		modified = TRUE;
 	}
-	if (compose->draft_timeout_tag == -2) {
+	if (compose->draft_timeout_tag == COMPOSE_DRAFT_TIMEOUT_FORBIDDEN) {
 		modified = TRUE;
 	}
 
@@ -4329,7 +4333,7 @@ static gboolean compose_beautify_paragraph(Compose *compose, GtkTextIter *par_it
 	}
 
 
-	if (compose->draft_timeout_tag == -2) {
+	if (compose->draft_timeout_tag == COMPOSE_DRAFT_TIMEOUT_FORBIDDEN) {
 		if (gtk_text_iter_ends_line(&iter)) {
 			while (gtk_text_iter_ends_line(&iter) &&
 			       gtk_text_iter_forward_line(&iter))
@@ -6819,7 +6823,7 @@ static void compose_create_header_entry(Compose *compose)
 	gtk_table_attach(GTK_TABLE(compose->header_table), combo, 0, 1,
 			compose->header_nextrow, compose->header_nextrow+1,
 			GTK_SHRINK, GTK_FILL, 0, 0);
-	if (compose->header_last && (compose->draft_timeout_tag != -2)) {
+	if (compose->header_last && (compose->draft_timeout_tag != COMPOSE_DRAFT_TIMEOUT_FORBIDDEN)) {
 		const gchar *last_header_entry = gtk_entry_get_text(
 				GTK_ENTRY(gtk_bin_get_child(GTK_BIN((compose->header_last->combo)))));
 		string = headers;
@@ -7886,7 +7890,7 @@ static Compose *compose_create(PrefsAccount *account,
 	compose->exteditor_file    = NULL;
 	compose->exteditor_pid     = -1;
 	compose->exteditor_tag     = -1;
-	compose->draft_timeout_tag = -2; /* inhibit auto-drafting while loading */
+	compose->draft_timeout_tag = COMPOSE_DRAFT_TIMEOUT_FORBIDDEN; /* inhibit auto-drafting while loading */
 
 #if USE_ENCHANT
 	cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Spelling", FALSE);
@@ -9631,7 +9635,7 @@ static void compose_send_cb(GtkAction *action, gpointer data)
 	
 	if (compose->draft_timeout_tag >= 0) { /* CLAWS: disable draft timeout */
 		g_source_remove(compose->draft_timeout_tag);
-		compose->draft_timeout_tag = -1;
+		compose->draft_timeout_tag = COMPOSE_DRAFT_TIMEOUT_UNSET;
 	}
 
 	compose_send(compose);
@@ -11217,7 +11221,7 @@ static void compose_headerentry_changed_cb(GtkWidget *entry,
 
 static gboolean compose_defer_auto_save_draft(Compose *compose)
 {
-	compose->draft_timeout_tag = -1;
+	compose->draft_timeout_tag = COMPOSE_DRAFT_TIMEOUT_UNSET;
 	compose_draft((gpointer)compose, COMPOSE_AUTO_SAVE);
 	return FALSE;
 }
@@ -11341,7 +11345,7 @@ static void text_inserted(GtkTextBuffer *buffer, GtkTextIter *iter,
 
 	if (compose_can_autosave(compose) && 
 	    gtk_text_buffer_get_char_count(buffer) % prefs_common.autosave_length == 0 &&
-	    compose->draft_timeout_tag != -2 /* disabled while loading */)
+	    compose->draft_timeout_tag != COMPOSE_DRAFT_TIMEOUT_FORBIDDEN /* disabled while loading */)
 		compose->draft_timeout_tag = g_timeout_add
 			(500, (GSourceFunc) compose_defer_auto_save_draft, compose);
 }
diff --git a/src/compose.h b/src/compose.h
index 2d08a3b..a475110 100644
--- a/src/compose.h
+++ b/src/compose.h
@@ -223,7 +223,7 @@ struct _Compose
 	
 	gboolean remove_references;
 
-	gint draft_timeout_tag;
+	gint64 draft_timeout_tag;
 	
 	GtkTextTag *no_wrap_tag;
 	GtkTextTag *no_join_tag;

commit 7cea752b768a7ab014148e84232a870adb56aedd
Author: Colin Leroy <colin at colino.net>
Date:   Fri May 2 09:50:46 2014 +0200

    Fix g_timeout usage

diff --git a/src/folderview.c b/src/folderview.c
index 42a0c86..94d708d 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -527,6 +527,23 @@ void folderview_set_column_order(FolderView *folderview)
 	FolderItem *sel_item = NULL, *op_item = NULL;
 	GtkWidget *scrolledwin = folderview->scrolledwin;
 
+	if (folderview->drag_timer_id != 0) {
+		g_source_remove(folderview->drag_timer_id);
+		folderview->drag_timer_id = 0;
+	}
+	if (folderview->deferred_refresh_id != 0) {
+		g_source_remove(folderview->deferred_refresh_id);
+		folderview->deferred_refresh_id = 0;
+	}
+	if (folderview->scroll_timeout_id != 0) {
+		g_source_remove(folderview->scroll_timeout_id);
+		folderview->scroll_timeout_id = 0;
+	}
+	if (folderview->postpone_select_id != 0) {
+		g_source_remove(folderview->postpone_select_id);
+		folderview->postpone_select_id = 0;
+	}
+
 	if (folderview->selected)
 		sel_item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(ctree), folderview->selected);
 	if (folderview->opened)
@@ -590,8 +607,12 @@ FolderView *folderview_create(void)
 	
 	folderview->target_list = gtk_target_list_new(folderview_drag_types, 2);
 	folderview_list = g_list_append(folderview_list, folderview);
-	folderview->deferred_refresh_id = -1;
-	folderview->scroll_timeout_id = -1;
+
+	folderview->drag_timer_id       = 0;
+	folderview->deferred_refresh_id = 0;
+	folderview->scroll_timeout_id   = 0;
+	folderview->postpone_select_id  = 0;
+
 	return folderview;
 }
 
@@ -701,7 +722,7 @@ static gboolean folderview_defer_set(gpointer data)
 	debug_print("doing deferred folderview_set now\n");
 	folderview_set(folderview);
 
-	folderview->deferred_refresh_id = -1;
+	folderview->deferred_refresh_id = 0;
 	return FALSE;
 }
 
@@ -715,7 +736,7 @@ void folderview_set(FolderView *folderview)
 		return;
 
 	if (mainwin->lock_count) {
-		if (folderview->deferred_refresh_id == -1)
+		if (folderview->deferred_refresh_id == 0)
 			folderview->deferred_refresh_id = 
 				g_timeout_add(500, folderview_defer_set, folderview);
 		debug_print("deferred folderview_set\n");
@@ -2015,6 +2036,8 @@ static gboolean postpone_select(void *data)
 {
 	PostponedSelectData *psdata = (PostponedSelectData *)data;
 	debug_print("trying again\n");
+
+	psdata->folderview->postpone_select_id = 0;
 	psdata->folderview->open_folder = TRUE;
 	main_window_cursor_normal(psdata->folderview->mainwin);
 	STATUSBAR_POP(psdata->folderview->mainwin);
@@ -2161,7 +2184,9 @@ static void folderview_selected(GtkCMCTree *ctree, GtkCMCTreeNode *row,
 			item->path ? item->path:item->name);
 		folderview->open_folder = FALSE;
 		can_select = TRUE;
-		g_timeout_add(500, postpone_select, data);
+		if (folderview->postpone_select_id != 0)
+			g_source_remove(folderview->postpone_select_id);
+		folderview->postpone_select_id = g_timeout_add(500, postpone_select, data);
 		END_TIMING();
 		return;
 	}
@@ -2640,9 +2665,9 @@ void folderview_reflect_prefs(void)
 
 static void drag_state_stop(FolderView *folderview)
 {
-	if (folderview->drag_timer)
-		g_source_remove(folderview->drag_timer);
-	folderview->drag_timer = 0;
+	if (folderview->drag_timer_id)
+		g_source_remove(folderview->drag_timer_id);
+	folderview->drag_timer_id = 0;
 	folderview->drag_node = NULL;
 }
 
@@ -2657,7 +2682,7 @@ static gboolean folderview_defer_expand(FolderView *folderview)
 		}
 	}
 	folderview->drag_item  = NULL;
-	folderview->drag_timer = 0;
+	folderview->drag_timer_id = 0;
 	return FALSE;
 }
 
@@ -2668,7 +2693,7 @@ static void drag_state_start(FolderView *folderview, GtkCMCTreeNode *node, Folde
 	 * we need to call drag_state_stop() */
 	drag_state_stop(folderview);
 	/* request expansion */
-	if (0 != (folderview->drag_timer = g_timeout_add
+	if (0 != (folderview->drag_timer_id = g_timeout_add
 			(prefs_common.hover_timeout, 
 			 (GSourceFunc)folderview_defer_expand,
 			 folderview))) {
@@ -2769,7 +2794,7 @@ static gboolean folderview_dnd_scroll_cb(gpointer data)
                (int)gtk_adjustment_get_page_size(pos);
 
 	if (folderview->scroll_value == 0) {
-		folderview->scroll_timeout_id = -1;
+		folderview->scroll_timeout_id = 0;
 		return FALSE;
 	}
 
@@ -2815,7 +2840,7 @@ static gboolean folderview_drag_motion_cb(GtkWidget      *widget,
 		} else {
 			folderview->scroll_value = 0;
 		}
-		if (folderview->scroll_value != 0 && folderview->scroll_timeout_id == -1) {
+		if (folderview->scroll_value != 0 && folderview->scroll_timeout_id == 0) {
 			folderview->scroll_timeout_id = 
 				g_timeout_add(30, folderview_dnd_scroll_cb,
 					      folderview);
diff --git a/src/folderview.h b/src/folderview.h
index c6f524e..95093ff 100644
--- a/src/folderview.h
+++ b/src/folderview.h
@@ -70,20 +70,21 @@ struct _FolderView
 	
 	/* DND states */
 	GSList *nodes_to_recollapse;
-	guint   drag_timer;		/* timer id */
+	guint   drag_timer_id;		/* timer id */
 	FolderItem *drag_item;		/* dragged item */
 	GtkCMCTreeNode *drag_node;	/* drag node */
 	
 	GtkTargetList *target_list; /* DnD */
 	FolderColumnState col_state[N_FOLDER_COLS];
 	gint col_pos[N_FOLDER_COLS];
-	gint deferred_refresh_id;
 	Folder *scanning_folder;
 	GtkUIManager *ui_manager;
 	GtkActionGroup *popup_common_action_group;
 	GtkActionGroup *popup_specific_action_group;
-	gint scroll_timeout_id;
 	gint scroll_value;
+	guint deferred_refresh_id;
+	guint scroll_timeout_id;
+	guint postpone_select_id;
 };
 
 struct _FolderViewPopup

-----------------------------------------------------------------------

Summary of changes:
 src/compose.c                                  |   60 +++++++++++++-----------
 src/compose.h                                  |    2 +-
 src/folderview.c                               |   49 ++++++++++++++-----
 src/folderview.h                               |    7 +--
 src/gtk/combobox.c                             |    2 +-
 src/gtk/gtkutils.c                             |   40 ++++++++++++++++
 src/gtk/gtkutils.h                             |    1 +
 src/headerview.c                               |    1 -
 src/plugins/libravatar/libravatar_federation.c |    4 +-
 9 files changed, 118 insertions(+), 48 deletions(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list