--- e-categories-dialog1.c	2008-07-28 11:13:05.000000000 +0530
+++ e-categories-dialog.c	2008-07-28 05:36:12.000000000 +0530
@@ -231,6 +231,32 @@
 	return p;
 }
 
+void get_order(char *name,int *order)
+{
+	GList *cat_list;
+	int newpos=0,oldpos=0,temp;
+	cat_list = e_categories_get_list ();
+	while (cat_list != NULL) {
+		/* only add categories that are user-visible */
+		if (e_categories_is_searchable ((const char *) cat_list->data)) 
+		{		
+			if (strcmp((const char *)cat_list->data,name)==0) {
+				temp=newpos;
+				newpos++;
+			}
+			else
+			{
+				order[newpos]=oldpos;
+				newpos++;
+				oldpos++;
+			}					
+		}
+		cat_list = g_list_remove (cat_list, cat_list->data);
+	}
+	order[temp]=oldpos;
+}
+
+
 static void
 new_button_clicked_cb (GtkButton *button, gpointer user_data)
 {
@@ -267,6 +293,7 @@
 			} else {
 				gchar *category_icon;
 				GdkPixbuf *icon = NULL;
+				int *order[100];
 				GtkListStore *list_store = GTK_LIST_STORE (
 								gtk_tree_view_get_model (GTK_TREE_VIEW (prop_dialog->parent->priv->categories_list)));
 
@@ -282,7 +309,8 @@
 						    COLUMN_ICON, icon,
 						    COLUMN_CATEGORY,correct_category_name,
 						    -1);
-
+				get_order(correct_category_name,order);
+				gtk_list_store_reorder(list_store,order);
 				if (icon)
 					g_object_unref (icon);
 				if (category_icon)
