Re: [evolution-patches] 41468, default folder type when creating exchange public folder



> If the default_type can no longer be NULL there should be a
> `default_type != NULL' assertion in
> e_shell_show_folder_creation_dialog().

The default type to e_shell_show_folder_creation_dialog can be NULL, it
just passes "mail" to add_folder_types in that case.

> Also, shouldn't it initialize default_item to e.g. -1 and check against
> -1 instead of zero?

Yeah, I suppose.


? nuwiz
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1242
diff -u -r1.1242 ChangeLog
--- ChangeLog	17 Apr 2003 18:46:07 -0000	1.1242
+++ ChangeLog	17 Apr 2003 20:36:52 -0000
@@ -1,3 +1,10 @@
+2003-04-17  Dan Winship  <danw ximian com>
+
+	* e-shell-folder-creation-dialog.c (add_folder_types): If the
+	default_type is "foo/bar" and "foo" appears in the list but
+	"foo/bar" doesn't, use "foo" as the default type. [#41468] Also,
+	remove a workaround for a gtk 1.2 bug.
+
 2003-04-16  Dan Winship  <danw ximian com>
 
 	* e-corba-storage.c (async_create_folder): If the new folder's
Index: e-shell-folder-creation-dialog.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-folder-creation-dialog.c,v
retrieving revision 1.47
diff -u -r1.47 e-shell-folder-creation-dialog.c
--- e-shell-folder-creation-dialog.c	25 Mar 2003 15:48:33 -0000	1.47
+++ e-shell-folder-creation-dialog.c	17 Apr 2003 20:36:52 -0000
@@ -400,21 +400,11 @@
 	GList *types_with_display_names;
 	GList *p;
 	int default_item;
-	int i;
+	int i, len;
 
 	folder_type_option_menu = glade_xml_get_widget (gui, "folder_type_option_menu");
 
-	/* KLUDGE.  So, GtkOptionMenu is badly broken.  It calculates its size
-           in `gtk_option_menu_set_menu()' instead of using `size_request()' as
-           any sane widget would do.  So, in order to avoid the "narrow
-           GtkOptionMenu" bug, we have to destroy the existing associated menu
-           and create a new one.  Life sucks.  */
-
 	menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (folder_type_option_menu));
-	g_assert (menu != NULL);
-	gtk_widget_destroy (menu);
-
-	menu = gtk_menu_new ();
 
 	folder_type_registry = e_shell_get_folder_type_registry (shell);
 	g_assert (folder_type_registry != NULL);
@@ -438,7 +428,7 @@
 
 	/* FIXME: Add icon (I don't feel like writing an alpha-capable thingie again).  */
 
-	default_item = 0;
+	default_item = -1;
 	i = 0;
 	for (p = types_with_display_names; p != NULL; p = p->next) {
 		const TypeWithDisplayName *type;
@@ -455,11 +445,19 @@
 
 		g_object_set_data_full (G_OBJECT (menu_item), "folder_type", g_strdup (type->type), g_free);
 
-		if (strcmp (type->type, default_type ? default_type : "mail") == 0)
+		if (strcmp (type->type, default_type) == 0)
 			default_item = i;
+		else if (default_item == -1) {
+			len = strlen (type->type);
+			if (strncmp (type->type, default_type, len) == 0 &&
+			    default_type[len] == '/')
+				default_item = i;
+		}
 
 		i ++;
 	}
+	if (default_item == -1)
+		default_item = 0;
 
 	for (p = types_with_display_names; p != NULL; p = p->next)
 		g_free (p->data);


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