[evolution-patches] UI patch for addressbook bug #41211



split this out into two patches, one for e-util for a reusable function,
since i think we do this elsewhere in the code, and the other in the
addressbook to make use of the function.

Chris
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1389
diff -u -r1.1389 ChangeLog
--- ChangeLog	23 Apr 2003 20:34:35 -0000	1.1389
+++ ChangeLog	25 Apr 2003 01:12:57 -0000
@@ -1,3 +1,11 @@
+2003-04-24  Chris Toshok  <toshok ximian com>
+
+	[ fixes bug #41211 ]
+	
+	* gui/component/e-address-popup.c (e_address_popup_no_matches):
+	call e_button_new_with_stock_icon to create our button and give it
+	the right icon.
+	
 2003-04-23  Chris Toshok  <toshok ximian com>
 
 	[ fixes bug #37351 ]
Index: gui/component/e-address-popup.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/e-address-popup.c,v
retrieving revision 1.29
diff -u -r1.29 e-address-popup.c
--- gui/component/e-address-popup.c	7 Apr 2003 17:42:48 -0000	1.29
+++ gui/component/e-address-popup.c	25 Apr 2003 01:12:58 -0000
@@ -42,6 +42,7 @@
 #include <addressbook/gui/contact-editor/e-contact-quick-add.h>
 #include <addressbook/gui/widgets/e-minicard-widget.h>
 #include <addressbook/gui/widgets/e-addressbook-util.h>
+#include "e-util/e-gui-utils.h"
 
 /*
  * Some general scaffolding for our widgets.  Think of this as a really, really
@@ -73,7 +74,6 @@
 		GtkWidget *oldw = (GtkWidget *) iter->data;
 		iter = g_list_next (iter);
 		gtk_container_remove (GTK_CONTAINER (wiz->vbox), oldw);
-		gtk_widget_destroy (oldw);
 	}
 	gtk_container_add (GTK_CONTAINER (wiz->vbox), w);
 }
@@ -1025,7 +1025,8 @@
 
 	g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
 
-	b = gtk_button_new_with_label (_("Add to Contacts"));
+	b = e_button_new_with_stock_icon (_("Add to Contacts"), "gtk-add");
+
 	gtk_box_pack_start (GTK_BOX (pop->main_vbox), b, TRUE, TRUE, 0);
 	g_signal_connect (b,
 			  "clicked",
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.382
diff -u -r1.382 ChangeLog
--- ChangeLog	22 Apr 2003 16:00:38 -0000	1.382
+++ ChangeLog	25 Apr 2003 01:13:24 -0000
@@ -1,3 +1,12 @@
+2003-04-24  Chris Toshok  <toshok ximian com>
+
+	[ for bug #41211 ]
+	
+	* e-gui-utils.h (e_button_new_with_stock_icon): add prototype.
+
+	* e-gui-utils.c (e_button_new_with_stock_icon): new function,
+	allow us to create a custom labeled button with a stock icon.
+
 2003-04-18  Anna Marie Dirks  <anna ximian com>
 
 	* e-request.c (e_request_string): Added appropriate spacing/padding 
Index: e-gui-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-gui-utils.c,v
retrieving revision 1.14
diff -u -r1.14 e-gui-utils.c
--- e-gui-utils.c	5 Feb 2003 21:58:38 -0000	1.14
+++ e-gui-utils.c	25 Apr 2003 01:13:24 -0000
@@ -2,11 +2,12 @@
 /*
  * GUI utility functions
  *
- * Author:
+ * Authors:
  *   Miguel de Icaza (miguel ximian com)
+ *   Chris Toshok (toshok ximian com)
  *
- * (C) 1999 Miguel de Icaza
- * (C) 2000 Ximian, Inc.
+ * Copyright (C) 1999 Miguel de Icaza
+ * Copyright (C) 2000-2003 Ximian, Inc.
  */
 #include <config.h>
 
@@ -15,6 +16,9 @@
 #include <glib.h>
 #include <gtk/gtkalignment.h>
 #include <gtk/gtkimage.h>
+#include <gtk/gtkbutton.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkhbox.h>
 
 GtkWidget *e_create_image_widget(gchar *name,
 				 gchar *string1, gchar *string2,
@@ -46,3 +50,30 @@
 
 	return alignment;
 }
+
+GtkWidget *
+e_button_new_with_stock_icon (const char *label_str, const char *stockid)
+{
+	GtkWidget *button, *hbox, *label, *align, *image;
+
+	button = gtk_button_new ();
+
+	label = gtk_label_new_with_mnemonic (label_str);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
+
+	image = gtk_image_new_from_stock (stockid, GTK_ICON_SIZE_BUTTON);
+	hbox = gtk_hbox_new (FALSE, 2);
+
+	align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+      
+	gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+	gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+      
+	gtk_container_add (GTK_CONTAINER (button), align);
+	gtk_container_add (GTK_CONTAINER (align), hbox);
+	gtk_widget_show_all (align);
+
+	return button;
+}
+
Index: e-gui-utils.h
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-gui-utils.h,v
retrieving revision 1.9
diff -u -r1.9 e-gui-utils.h
--- e-gui-utils.h	27 May 2001 18:00:25 -0000	1.9
+++ e-gui-utils.h	25 Apr 2003 01:13:24 -0000
@@ -2,7 +2,11 @@
 #define E_GUI_UTILS_H
 
 #include <gtk/gtkwidget.h>
+#include <bonobo/bonobo-ui-util.h>
+#include <bonobo/bonobo-control.h>
 
-GtkWidget *e_create_image_widget     (gchar *name, gchar *string1, gchar *string2, gint int1, gint int2);
+GtkWidget *e_create_image_widget         (gchar *name, gchar *string1, gchar *string2, gint int1, gint int2);
+
+GtkWidget *e_button_new_with_stock_icon  (const char *label_str, const char *stockid);
 
 #endif /* E_GUI_UTILS_H */


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