Gentoo Archives: gentoo-commits

From: "Bernard Cafarelli (voyageur)" <voyageur@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-gfx/geeqie/files: geeqie-1.1-fix_comment_update.patch
Date: Tue, 28 Aug 2012 13:45:49
Message-Id: 20120828134537.2F93720A29@flycatcher.gentoo.org
1 voyageur 12/08/28 13:45:37
2
3 Added: geeqie-1.1-fix_comment_update.patch
4 Log:
5 Version bump, support for stereoscopic images, custom tiff loader, rewritten file grouping, and merged bugfixes. Reported by Andrew Savchenko in bug #432892. Remove some 1.0 revisions
6
7 (Portage version: 2.2.0_alpha123/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 media-gfx/geeqie/files/geeqie-1.1-fix_comment_update.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-gfx/geeqie/files/geeqie-1.1-fix_comment_update.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-gfx/geeqie/files/geeqie-1.1-fix_comment_update.patch?rev=1.1&content-type=text/plain
14
15 Index: geeqie-1.1-fix_comment_update.patch
16 ===================================================================
17 From 085be43cb79e04341102a9922e0e0f531454089a Mon Sep 17 00:00:00 2001
18 From: Vladimir Nadvornik <nadvornik@××××.cz>
19 Date: Tue, 21 Aug 2012 20:39:03 +0200
20 Subject: [PATCH] fixed updating of comment and keyword pane
21
22 - temporary disabling of notifications does no longer work because
23 the notification is called later, in idle cb.
24 - regression introduced in 78cde6934008f79fe498e4adc64d187b0ed47417
25 - now the update function checks if the new value is really different
26 ---
27 src/bar_comment.c | 20 ++++++++++++--------
28 src/bar_keywords.c | 37 +++++++++++++++++++++++--------------
29 2 files changed, 35 insertions(+), 22 deletions(-)
30
31 diff --git a/src/bar_comment.c b/src/bar_comment.c
32 index e63695b..156ab6e 100644
33 --- a/src/bar_comment.c
34 +++ b/src/bar_comment.c
35 @@ -60,16 +60,22 @@ static void bar_pane_comment_write(PaneCommentData *pcd)
36 static void bar_pane_comment_update(PaneCommentData *pcd)
37 {
38 gchar *comment = NULL;
39 + gchar *orig_comment = NULL;
40 + gchar *comment_not_null;
41 GtkTextBuffer *comment_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(pcd->comment_view));
42
43 - g_signal_handlers_block_by_func(comment_buffer, bar_pane_comment_changed, pcd);
44 -
45 + orig_comment = text_widget_text_pull(pcd->comment_view);
46 comment = metadata_read_string(pcd->fd, pcd->key, METADATA_PLAIN);
47 - gtk_text_buffer_set_text(comment_buffer,
48 - (comment) ? comment : "", -1);
49 - g_free(comment);
50 + comment_not_null = (comment) ? comment : "";
51
52 - g_signal_handlers_unblock_by_func(comment_buffer, bar_pane_comment_changed, pcd);
53 + if (strcmp(orig_comment, comment_not_null) != 0)
54 + {
55 + g_signal_handlers_block_by_func(comment_buffer, bar_pane_comment_changed, pcd);
56 + gtk_text_buffer_set_text(comment_buffer, comment_not_null, -1);
57 + g_signal_handlers_unblock_by_func(comment_buffer, bar_pane_comment_changed, pcd);
58 + }
59 + g_free(comment);
60 + g_free(orig_comment);
61
62 gtk_widget_set_sensitive(pcd->comment_view, (pcd->fd != NULL));
63 }
64 @@ -177,9 +183,7 @@ static void bar_pane_comment_changed(GtkTextBuffer *buffer, gpointer data)
65 {
66 PaneCommentData *pcd = data;
67
68 - file_data_unregister_notify_func(bar_pane_comment_notify_cb, pcd);
69 bar_pane_comment_write(pcd);
70 - file_data_register_notify_func(bar_pane_comment_notify_cb, pcd, NOTIFY_PRIORITY_LOW);
71 }
72
73
74 diff --git a/src/bar_keywords.c b/src/bar_keywords.c
75 index df70fda..257915e 100644
76 --- a/src/bar_keywords.c
77 +++ b/src/bar_keywords.c
78 @@ -216,17 +216,33 @@ static void bar_pane_keywords_keyword_update_all(void)
79 static void bar_pane_keywords_update(PaneKeywordsData *pkd)
80 {
81 GList *keywords = NULL;
82 + GList *orig_keywords = NULL;
83 + GList *work1, *work2;
84 GtkTextBuffer *keyword_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(pkd->keyword_view));
85
86 - g_signal_handlers_block_by_func(keyword_buffer, bar_pane_keywords_changed, pkd);
87 -
88 keywords = metadata_read_list(pkd->fd, KEYWORD_KEY, METADATA_PLAIN);
89 - keyword_list_push(pkd->keyword_view, keywords);
90 - bar_keyword_tree_sync(pkd);
91 - string_list_free(keywords);
92 -
93 - g_signal_handlers_unblock_by_func(keyword_buffer, bar_pane_keywords_changed, pkd);
94 + orig_keywords = keyword_list_pull(pkd->keyword_view);
95
96 + /* compare the lists */
97 + work1 = keywords;
98 + work2 = orig_keywords;
99 +
100 + while (work1 && work2)
101 + {
102 + if (strcmp(work1->data, work2->data) != 0) break;
103 + work1 = work1->next;
104 + work2 = work2->next;
105 + }
106 +
107 + if (work1 || work2) /* lists differs */
108 + {
109 + g_signal_handlers_block_by_func(keyword_buffer, bar_pane_keywords_changed, pkd);
110 + keyword_list_push(pkd->keyword_view, keywords);
111 + bar_keyword_tree_sync(pkd);
112 + g_signal_handlers_unblock_by_func(keyword_buffer, bar_pane_keywords_changed, pkd);
113 + }
114 + string_list_free(keywords);
115 + string_list_free(orig_keywords);
116 }
117
118 void bar_pane_keywords_set_fd(GtkWidget *pane, FileData *fd)
119 @@ -426,10 +442,8 @@ static gboolean bar_pane_keywords_changed_idle_cb(gpointer data)
120 {
121 PaneKeywordsData *pkd = data;
122
123 - file_data_unregister_notify_func(bar_pane_keywords_notify_cb, pkd);
124 bar_pane_keywords_write(pkd);
125 bar_keyword_tree_sync(pkd);
126 - file_data_register_notify_func(bar_pane_keywords_notify_cb, pkd, NOTIFY_PRIORITY_LOW);
127 pkd->idle_id = 0;
128 return FALSE;
129 }
130 @@ -962,12 +976,7 @@ static void bar_pane_keywords_connect_mark_cb(GtkWidget *menu_widget, gpointer d
131
132 gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(model), &kw_iter, &iter);
133
134 - file_data_unregister_notify_func(bar_pane_keywords_notify_cb, pkd);
135 -
136 meta_data_connect_mark_with_keyword(keyword_tree, &kw_iter, mark);
137 -
138 - file_data_register_notify_func(bar_pane_keywords_notify_cb, pkd, NOTIFY_PRIORITY_LOW);
139 -// bar_pane_keywords_update(pkd);
140 }
141
142
143 --
144 1.7.10