After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 719800 - bookmarks: Add remove_all_bookmarks function
bookmarks: Add remove_all_bookmarks function
Status: RESOLVED FIXED
Product: gedit-plugins
Classification: Other
Component: General
git master
Other All
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2013-12-03 20:03 UTC by Volker Sobek (weld)
Modified: 2019-03-23 20:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
bookmarks: Add remove_all_bookmarks function (3.05 KB, patch)
2013-12-03 20:03 UTC, Volker Sobek (weld)
reviewed Details | Review
bookmarks: Add remove_all_bookmarks function (3.00 KB, patch)
2013-12-03 20:50 UTC, Volker Sobek (weld)
none Details | Review
bookmarks: Add remove_all_bookmarks function (2.43 KB, patch)
2013-12-03 21:04 UTC, Volker Sobek (weld)
committed Details | Review

Description Volker Sobek (weld) 2013-12-03 20:03:38 UTC
And call it in on_document_loaded before loading the bookmarks, to
ensure we don't end up with an additional bookmark in the first line
after reverting a document that contained bookmarks.
Comment 1 Volker Sobek (weld) 2013-12-03 20:03:40 UTC
Created attachment 263435 [details] [review]
bookmarks: Add remove_all_bookmarks function
Comment 2 Volker Sobek (weld) 2013-12-03 20:05:43 UTC
Related to https://bugzilla.gnome.org/show_bug.cgi?id=719425
Comment 3 Volker Sobek (weld) 2013-12-03 20:20:31 UTC
Comment on attachment 263435 [details] [review]
bookmarks: Add remove_all_bookmarks function

The function should take a buffer as argument, not the view.
Comment 4 Sébastien Wilmet 2013-12-03 20:22:12 UTC
Review of attachment 263435 [details] [review]:

Looks good. Feel free to fix the small issues and push (if you have write access to the repo).

::: plugins/bookmarks/gedit-bookmarks-plugin.c
@@ +98,3 @@
 static void remove_bookmark (GtkSourceBuffer *buffer, GtkTextIter *iter);
 static void toggle_bookmark (GtkSourceBuffer *buffer, GtkTextIter *iter);
+static void remove_all_bookmarks (GeditView *view);

It's simpler to move the function above the calls when possible, so the prototype is not needed.

@@ +1073,3 @@
+remove_all_bookmarks (GeditView *view)
+{
+	GtkSourceBuffer *buf;

nitpick: I would write "buffer" entirely. A general principle is to optimize the reading time, not the writing of the code, because the code is read far more often than it is written. But here buf is comprehensible too, it's not a big problem. But with lots of one-letter variables, it becomes a problem.

@@ +1172,3 @@
 	{
+		/* Reverting can leave one bookmark at the start, remove it.
+		   https://bugzilla.gnome.org/show_bug.cgi?id=719425 */

The URL is useful for a FIXME comment. Here the bug is fixed, so it is not needed. It is better to use git blame to know the commit responsible for the code, and see the commit message with the URL.
Comment 5 Sébastien Wilmet 2013-12-03 20:24:33 UTC
The buffer as argument is good too.
Comment 6 Volker Sobek (weld) 2013-12-03 20:50:02 UTC
Created attachment 263438 [details] [review]
bookmarks: Add remove_all_bookmarks function

And call it in on_document_loaded before loading the bookmarks, to
ensure we don't end up with an additional bookmark in the first line
after reverting a document that contained bookmarks.
Comment 7 Volker Sobek (weld) 2013-12-03 21:04:25 UTC
Created attachment 263442 [details] [review]
bookmarks: Add remove_all_bookmarks function

And call it in on_document_loaded before loading the bookmarks, to
ensure we don't end up with an additional bookmark in the first line
after reverting a document that contained bookmarks.
Comment 8 Volker Sobek (weld) 2013-12-03 21:13:28 UTC
Comment on attachment 263442 [details] [review]
bookmarks: Add remove_all_bookmarks function

Attachment 263442 [details] pushed as 8ff5cff - bookmarks: Add remove_all_bookmarks function
Comment 9 Sébastien Wilmet 2013-12-03 21:15:11 UTC
Commit pushed.