[gnumeric] WorkbookSel: impose URL ordering of entries.



commit a22981b00ea92ab9ed56a8f8d47ce07eac59cb44
Author: Morten Welinder <terra gnome org>
Date:   Mon Apr 9 16:00:29 2018 -0400

    WorkbookSel: impose URL ordering of entries.

 src/widgets/gnm-workbook-sel.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/widgets/gnm-workbook-sel.c b/src/widgets/gnm-workbook-sel.c
index ba9b9e2..2926ed8 100644
--- a/src/widgets/gnm-workbook-sel.c
+++ b/src/widgets/gnm-workbook-sel.c
@@ -90,6 +90,15 @@ cb_changed (GOOptionMenu *om, GnmWorkbookSel *wbs)
        gnm_workbook_sel_set_workbook (wbs, wb);
 }
 
+static gint
+doc_order (gconstpointer a_, gconstpointer b_)
+{
+       GODoc *a = (GODoc *)a_;
+       GODoc *b = (GODoc *)b_;
+
+       return go_str_compare (go_doc_get_uri (a), go_doc_get_uri (b));
+}
+
 static void
 gnm_workbook_sel_init (GnmWorkbookSel *wbs)
 {
@@ -98,7 +107,9 @@ gnm_workbook_sel_init (GnmWorkbookSel *wbs)
 
         menu = GTK_MENU (gtk_menu_new ());
 
-       wb_list = gnm_app_workbook_list ();
+       wb_list = g_list_copy (gnm_app_workbook_list ());
+       wb_list = g_list_sort (wb_list, doc_order);
+
        for (l = wb_list; l; l = l->next) {
                Workbook *wb = l->data;
                GtkWidget *item, *child;
@@ -140,6 +151,8 @@ gnm_workbook_sel_init (GnmWorkbookSel *wbs)
                g_object_set_data (G_OBJECT (item), WB_KEY, wb);
        }
 
+       g_list_free (wb_list);
+
        gtk_widget_show_all (GTK_WIDGET (menu));
        go_option_menu_set_menu (&wbs->parent, GTK_WIDGET (menu));
 


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