evolution r34880 - in trunk: calendar calendar/gui mail widgets/misc



Author: mcrha
Date: Thu Jan 24 11:33:01 2008
New Revision: 34880
URL: http://svn.gnome.org/viewvc/evolution?rev=34880&view=rev

Log:
2008-01-24  Milan Crha  <mcrha redhat com>

	** Fix for bug #402487

	* calendar/gui/cal-search-bar.c: (notify_e_cal_view_contains):
	* mail/em-folder-browser.c: (emfb_search_search_activated), (generate_viewoption_menu):
	* widgets/misc/e-search-bar.c: (search_now_verb_cb), (scopeoption_changed_cb):
	Memory leak fix.



Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/gui/cal-search-bar.c
   trunk/mail/ChangeLog
   trunk/mail/em-folder-browser.c
   trunk/widgets/misc/ChangeLog
   trunk/widgets/misc/e-search-bar.c

Modified: trunk/calendar/gui/cal-search-bar.c
==============================================================================
--- trunk/calendar/gui/cal-search-bar.c	(original)
+++ trunk/calendar/gui/cal-search-bar.c	Thu Jan 24 11:33:01 2008
@@ -412,12 +412,12 @@
 	if (!text)
 		return; /* This is an error in the UTF8 conversion, not an empty string! */
 
-	if (text && *text) {
+	if (text && *text)
 	    sexp = g_strdup_printf ("(contains? \"%s\" \"%s\")", field, text);
-	    g_free (text);
-	} else
+	else
 	    sexp = g_strdup ("(contains? \"summary\" \"\")"); /* Show all */
 
+	g_free (text);
 
 	/* Apply the selected view on search */
 	if (view && *view){

Modified: trunk/mail/em-folder-browser.c
==============================================================================
--- trunk/mail/em-folder-browser.c	(original)
+++ trunk/mail/em-folder-browser.c	Thu Jan 24 11:33:01 2008
@@ -336,8 +336,9 @@
 			g_object_set_data (G_OBJECT (menu_item), "EsbItemId",
 					   GINT_TO_POINTER (VIEW_LABEL + (VIEW_ITEMS_MASK + 1) * i));
 
-			g_object_set_data (G_OBJECT (menu_item), "LabelTag",
-					   g_strdup (strncmp (label->tag, "$Label", 6) == 0 ? label->tag + 6 : label->tag));
+			g_object_set_data_full (G_OBJECT (menu_item), "LabelTag",
+						g_strdup (strncmp (label->tag, "$Label", 6) == 0 ? label->tag + 6 : label->tag),
+						g_free);
 		}
 
 		gtk_widget_show (menu_item);
@@ -1033,7 +1034,7 @@
 {
 	EMFolderView *emfv = (EMFolderView *) emfb;
 	EFilterBar *efb = (EFilterBar *)esb;
-	char *search_state, *view_sexp, *folder_uri=NULL;
+	char *search_state = NULL, *view_sexp, *folder_uri=NULL;
 	char *word = NULL, *storeuri = NULL, *search_word = NULL;
 	gint id, i;
 	CamelFolder *folder;
@@ -1058,6 +1059,7 @@
 		    } else {
 			    em_format_html_display_search_close (emfb->view.preview);
 		    }
+		    g_free (word);
 		    return;
 		    break;
 
@@ -1075,9 +1077,13 @@
 			    }
 			    g_signal_emit (emfb, folder_browser_signals [ACCOUNT_SEARCH_CLEARED], 0);
 			    gtk_widget_set_sensitive (esb->scopeoption, TRUE);
+			    g_free (word);
+			    word = NULL;
 			    break;
 		    }
 
+		    g_free (word);
+		    word = NULL;
 		    g_object_get (esb, "query", &search_word, NULL);
 		    if (efb->account_search_vf && !strcmp (search_word, ((CamelVeeFolder *) efb->account_search_vf)->expression) ) {
 			    break;
@@ -1127,9 +1133,14 @@
 			    }
 			    g_signal_emit (emfb, folder_browser_signals [ACCOUNT_SEARCH_CLEARED], 0);
 			    gtk_widget_set_sensitive (esb->scopeoption, TRUE);
+			    g_free (word);
+			    word = NULL;
 			    break;
 		    }
 
+		    g_free (word);
+		    word = NULL;
+
 		    g_object_get (esb, "query", &search_word, NULL);
 
 		    if (search_word && efb->all_account_search_vf && !strcmp (search_word, ((CamelVeeFolder *) efb->all_account_search_vf)->expression) )  {
@@ -1192,11 +1203,19 @@
 	g_object_get (esb, "state", &search_state, NULL);
 	camel_object_meta_set (emfv->folder, "evolution:search_state", search_state);
 	camel_object_state_write (emfv->folder);
+	g_free (search_state);
+
+	if (search_word) {
+		g_free (search_word);
+		search_word = NULL;
+	}
 
 	/* Merge the view and search expresion*/
 	view_sexp = get_view_query (esb, emfv->folder, emfv->folder_uri);
 	g_object_get (esb, "query", &search_word, NULL);
 
+	word = search_word;
+
 	if (search_word && *search_word)
 		search_word = g_strconcat ("(and ", view_sexp, search_word, " )", NULL);
 	else
@@ -1204,6 +1223,7 @@
 
 	message_list_set_search(emfb->view.list, search_word);
 
+	g_free (word);
 	g_free (search_word);
 	g_free (view_sexp);
 

Modified: trunk/widgets/misc/e-search-bar.c
==============================================================================
--- trunk/widgets/misc/e-search-bar.c	(original)
+++ trunk/widgets/misc/e-search-bar.c	Thu Jan 24 11:33:01 2008
@@ -205,7 +205,7 @@
 {
 	ESearchBar *esb;
 	GtkStyle *style = gtk_widget_get_default_style ();
-	const char *text;
+	char *text;
 
 	esb = E_SEARCH_BAR (data);
 	text = e_search_bar_get_text (esb);
@@ -222,6 +222,7 @@
 		gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, NULL);
 	}
 
+	g_free (text);
 	emit_search_activated (esb);
 }
 
@@ -530,7 +531,7 @@
 static void
 scopeoption_changed_cb (GtkWidget *option_menu, ESearchBar *search_bar)
 {
-	const gchar *text = NULL;
+	char *text = NULL;
 
 	text = e_search_bar_get_text (search_bar);
 	if (!(text && *text))
@@ -538,6 +539,8 @@
 
 	if(!search_bar->block_search)
 		emit_query_changed (search_bar);
+
+	g_free (text);
 }
 #endif
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]