GNOME Bugzilla – Bug 742280
open-document selector: add sources and behaviours
Last modified: 2015-01-05 20:56:41 UTC
Created attachment 293680 [details] [review] selector-add-sources-and-behaviours Like in Gedit's quickopen plugin, in addition to recent files, some sources for searching files are added : - home's directory - desktop's directory - local bookmark directories - Gedit file browser directory - Gedit's active document directory - currently opened documents in the corresponding Gedit's window The file list shown is always sorted by he most recently used files at top. By default, ie with no text in the search entry, the recent files list is shown, limited in size by the Gedit's gsetting: path: org.gnome.gedit.preferences.ui and key: max-recents With text in the search entry, the filtering is done with no limit amongst all the sources ( ie the recent files's source is not limited ) Searches are only done in local/native directories, except with the recent file list if you have opened distant files. The treeview is also limited in height by the same max-recents settings: the treeview show max-recents entries but no more than ten, the scrollbar taking the relay. You can directly hit enter to validate a file name / uri in the search entry. The recognized cases are: - an uri - a local file name: the prefix ~/ is replaced by your home's dir if present. All file's queries for lists's computation are done asynchronously. You can print debug and timing by setting #if 1 in place of #if 0 in gedit-open-document-selector-helper.h, then rebuild. You can get more informations at the top of this file: gedit-open-document-selector-store.c
Review of attachment 293680 [details] [review]: See the comments. I guess you can fix those and then feel free to push it. ::: gedit/gedit-open-document-selector-helper.c @@ +22,3 @@ + +void +debug_print_list (gchar *title, use const gchar * @@ +33,3 @@ + g_print ("%s\n", title); + + for (l = fileitem_list; l != NULL; l = l->next) use l = g_list_next (l) @@ +65,3 @@ +copy_file_items_list (const GList *file_items_list) +{ + return g_list_copy_deep ((GList *)file_items_list, (GCopyFunc)copy_fileitem_item, NULL); split in 2 lines ::: gedit/gedit-open-document-selector-helper.h @@ +44,3 @@ + CURRENT_DOCS_LIST, + LIST_TYPE_NUM_OF_LISTS +} ListType; the usual convention for "public" or internal enums is to have a namespace @@ +82,3 @@ +} PushMessage; + +void debug_print_list (gchar *title, I'd say add the name space to the methods even if they are private ::: gedit/gedit-open-document-selector-store.c @@ +78,3 @@ + +GQuark +gedit_open_document_selector_store_error_quark (void) use G_DEFINE_QUARK @@ +102,3 @@ + + docs = gedit_window_get_documents (selector->window); + for (l = docs; l != NULL; l = l->next) g_list_next @@ +295,3 @@ + return file_items_list; + } + else remove the else and just use g_clear_object @@ +320,3 @@ + for (i = 0; lines[i]; i++) + { + if (!*lines[i]) I'd rather a check with == '\0' since it is more consistent with other parts of gedit @@ +363,3 @@ + g_object_unref (bookmarks_file); + + for (l = bookmarks_uri_list; l != NULL; l = l->next) g_list_next @@ +464,3 @@ + GList *fileitem_list = NULL; + + for (l = uri_list; l != NULL; l = l->next) same here g_list_next @@ +580,3 @@ + +static void +gedit_open_document_selector_store_finalize (GObject *object) remove finalize? ::: gedit/gedit-open-document-selector.c @@ +738,3 @@ + if (recent_limit > 0 ) + { + limit_capped = MIN (recent_limit, OPEN_DOCUMENT_SELECTOR_MAX_VISIBLE_ROWS); limit_capped = (recent_limit > 0) ? MIN... : ... ? ::: gedit/gedit-open-document-selector.h @@ +60,3 @@ /* Signals */ + void (* selector_file_activated) (GeditOpenDocumentSelector *selector, + gchar *uri); wrong alignment?
Created attachment 293875 [details] [review] selector add sources and behaviours commited as aa7c9af