[Commits] callbacks.c 1.18 1.19 contactwindow.c 1.14 1.15

miras at claws-mail.org miras at claws-mail.org
Mon Mar 26 00:52:40 CEST 2012


Update of /home/claws-mail/contacts/src
In directory srv:/tmp/cvs-serv10946/src

Modified Files:
	callbacks.c contactwindow.c 
Log Message:
2012-03-25 [mir]	0.6.0cvs79

	* src/callbacks.c
	* src/contactwindow.c
	Fix key-event handler so default handling is applied
	if search entry has focus.
	Refactored advanced search dialog.

Index: callbacks.c
===================================================================
RCS file: /home/claws-mail/contacts/src/callbacks.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- callbacks.c	31 Dec 2011 10:57:59 -0000	1.18
+++ callbacks.c	25 Mar 2012 22:52:38 -0000	1.19
@@ -2262,7 +2262,12 @@
     Contact* contact;
 	
 	if (!event) return FALSE;
-	
+
+	/* if search has focus use default action */	
+	if (gtk_widget_is_focus(win->search_text)) {
+		return FALSE;
+	}
+
 	switch (event->keyval) {
 		case GDK_KEY_s:
 			view = GTK_TREE_VIEW(win->contact_list);

Index: contactwindow.c
===================================================================
RCS file: /home/claws-mail/contacts/src/contactwindow.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- contactwindow.c	21 Dec 2011 22:02:52 -0000	1.14
+++ contactwindow.c	25 Mar 2012 22:52:38 -0000	1.15
@@ -583,7 +583,7 @@
 
 		pixbuf = gdk_pixbuf_new_from_file_at_scale(
 			file, PHOTO_WIDTH, PHOTO_HEIGHT, TRUE, &err);
-		g_free(err);
+		g_clear_error(&err);
 		
 		if (pixbuf) {
 			gchar* image = base64_encode_data(file);
@@ -766,33 +766,6 @@
 	}
 }
 
-static GdkPixbuf* contact_load_image(GtkWidget* parent, gchar* photo) {
-	GdkPixbufLoader* pl;
-	GdkPixbuf* pixbuf;
-	GError *err = NULL;
-	guchar* image_buf;
-	gsize length; 
-	
-	image_buf = g_base64_decode(photo, &length);
-	
-	pl = gdk_pixbuf_loader_new();
-	gdk_pixbuf_loader_set_size(pl, PHOTO_WIDTH, PHOTO_HEIGHT); 
-	gdk_pixbuf_loader_write(pl, image_buf, length, &err); 
-	g_free(image_buf);
-
-	if (err) {
-		show_message(parent, GTK_UTIL_MESSAGE_WARNING, "%s", err->message);
-		g_clear_error(&err); 
-		return NULL; 
-	} 
-	gdk_pixbuf_loader_close(pl, NULL);
-	
-	pixbuf = gdk_pixbuf_copy(gdk_pixbuf_loader_get_pixbuf(pl)); 
-	g_object_unref(pl);
-	
-	return pixbuf;
-}
-
 static gboolean contact_reorder_emails(GtkTreeModel *model,
 								   GtkTreePath *path,
 								   GtkTreeIter *iter,
@@ -1169,8 +1142,7 @@
 	GtkTreeIter* iter;
 	AddressBook* abook;
 	Plugin* plugin;
-	GtkWidget *dialog, *row;
-	GtkBox* vbox;
+	GtkWidget *dialog, *row, *vbox, *viewport;
 	ContactEntryData** data;
 	gint i, pos;
 	gchar* key;
@@ -1204,7 +1176,14 @@
 									GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
 									GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
 									NULL);
-		vbox = GTK_BOX(GTK_DIALOG(dialog)->vbox);
+		gtk_widget_set_size_request(dialog, 500, 600);
+		
+		viewport = gtk_scrolled_window_new(NULL, NULL);
+		gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(viewport),
+			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+		gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), viewport);
+		
+		vbox = gtk_vbox_new(TRUE, 5);
 
 		GSList* attr = plugin->attrib_list();
 		contact_entry_data_size = g_slist_length(attr) + 3;
@@ -1223,24 +1202,24 @@
 			data[pos]->key = g_strdup(key);
 			row = create_entry_row(NULL, data[pos++], key, 20);
 			gtk_widget_set_tooltip_text(row, tooltip);
-			gtk_box_pack_start(vbox, row, FALSE, TRUE, 0);
+			gtk_box_pack_start(GTK_BOX(vbox), row, FALSE, TRUE, 0);
 		}				
 		gslist_free(&attr, attrib_def_free);
 
 		data[pos] = g_new0(ContactEntryData, 1);
 		data[pos]->key = g_strdup("alias");
 		row = create_entry_row(NULL, data[pos++], "email alias", 20);
-		gtk_box_pack_start(vbox, row, FALSE, TRUE, 0);
+		gtk_box_pack_start(GTK_BOX(vbox), row, FALSE, TRUE, 0);
 		
 		data[pos] = g_new0(ContactEntryData, 1);
 		data[pos]->key = g_strdup("email");
 		row = create_entry_row(NULL, data[pos++], "email address", 20);
-		gtk_box_pack_start(vbox, row, FALSE, TRUE, 0);
+		gtk_box_pack_start(GTK_BOX(vbox), row, FALSE, TRUE, 0);
 		
 		data[pos] = g_new0(ContactEntryData, 1);
 		data[pos]->key = g_strdup("remarks");
 		row = create_entry_row(NULL, data[pos], "email remarks", 20);
-		gtk_box_pack_start(vbox, row, FALSE, TRUE, 0);
+		gtk_box_pack_start(GTK_BOX(vbox), row, FALSE, TRUE, 0);
 		
 		GtkWidget* align = gtk_alignment_new(0.5, 0.5, 0, 0);
 		GtkWidget* rbox = gtk_hbox_new(TRUE, 2);
@@ -1253,10 +1232,13 @@
 				GTK_RADIO_BUTTON(radio_or), _("_And"));
 		gtk_box_pack_start(GTK_BOX(rbox), radio_or, FALSE, TRUE, 2);
    		gtk_box_pack_start(GTK_BOX(rbox), radio_and, FALSE, TRUE, 2);
-   		gtk_box_pack_start(vbox, align, FALSE, FALSE, 0);
+   		gtk_box_pack_start(GTK_BOX(vbox), align, FALSE, FALSE, 0);
 		
-		dialog_set_focus(GTK_DIALOG(dialog), GTK_STOCK_CANCEL);
-		gtk_widget_show_all(GTK_WIDGET(vbox));
+		dialog_set_focus(GTK_DIALOG(dialog), GTK_STOCK_CANCEL);	
+
+		gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(viewport), vbox);
+
+		gtk_widget_show_all(dialog);
 		
 		gint r = gtk_dialog_run(GTK_DIALOG(dialog));
 		switch (r) {



More information about the Commits mailing list