~ubuntu-branches/ubuntu/trusty/smuxi/trusty-proposed

« back to all changes in this revision

Viewing changes to src/Frontend-GNOME/Preferences/ServerListView.cs

  • Committer: Package Import Robot
  • Author(s): Mirco Bauer
  • Date: 2013-05-25 22:11:31 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20130525221131-nd2mc0kzubuwyx20
Tags: 0.8.11-1
* [22d13d5] Imported Upstream version 0.8.11
* [6d2b95a] Refreshed patches
* [89eb66e] Added ServiceStack libraries to smuxi-engine package
* [848ab10] Enable Campfire engine
* [c6dbdc7] Always build db4o for predictable build result
* [13ec489] Exclude OS X specific libraries from dh_clideps

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
                                           typeof(string), // protocol
75
75
                                           typeof(string) // hostname
76
76
                                           );
 
77
            _TreeStore.SetSortColumnId(0, Gtk.SortType.Ascending);
 
78
            _TreeStore.SetSortFunc(0, SortTreeStore);
77
79
            _TreeView.RowActivated += OnTreeViewRowActivated;
78
80
            _TreeView.Selection.Changed += OnTreeViewSelectionChanged;
79
81
            _TreeView.Model = _TreeStore;
191
193
                return;
192
194
            }
193
195
            
194
 
            _Controller.RemoveServer(server.Protocol, server.Hostname);
 
196
            _Controller.RemoveServer(server.Protocol, server.ServerID);
195
197
            _Controller.Save();
196
198
            
197
199
            // refresh the view
279
281
                Frontend.ShowException(ex);
280
282
            }
281
283
        }
282
 
        
 
284
 
 
285
        protected virtual int SortTreeStore(Gtk.TreeModel model,
 
286
                                            Gtk.TreeIter iter1,
 
287
                                            Gtk.TreeIter iter2)
 
288
        {
 
289
            var server1 = (ServerModel) model.GetValue(iter1, 0);
 
290
            var server2 = (ServerModel) model.GetValue(iter2, 0);
 
291
            // protocol nodes don't have a ServerModel
 
292
            if (server1 == null && server2 == null) {
 
293
                return 0;
 
294
            }
 
295
            if (server2 == null) {
 
296
                return 1;
 
297
            }
 
298
            if (server1 == null) {
 
299
                return -1;
 
300
            }
 
301
            var s1 = String.Format("{0}/{1}:{2} ({3})",
 
302
                                   server1.Protocol, server1.Hostname,
 
303
                                   server1.Port, server1.ServerID);
 
304
            var s2 = String.Format("{0}/{1}:{2} ({3})",
 
305
                                   server2.Protocol, server2.Hostname,
 
306
                                   server2.Port, server2.ServerID);
 
307
            return s1.CompareTo(s2);
 
308
        }
 
309
 
283
310
        private static string _(string msg)
284
311
        {
285
312
            return Mono.Unix.Catalog.GetString(msg);