Commit Graph

49 Commits

Author SHA1 Message Date
Sebastian Ramacher
34b5c556fe GObject references should be unref'd in dispose
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-01-19 21:03:40 +01:00
Sebastian Ramacher
71ef7c7eed Fix some memory leaks and a use after free
Also return proper D-Bus errors

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-01-19 17:09:33 +01:00
Moritz Lipp
0fc5b80121 Replace glib memory functions with try version 2014-01-19 16:47:08 +01:00
Sebastian Ramacher
dbe5f7429a One more check
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-01-10 16:11:43 +01:00
Sebastian Ramacher
c575fe5f83 Use strtok_r instead of strtok
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-01-10 16:07:03 +01:00
Sebastian Ramacher
2c02dd97e6 Use g_key_file_* to set/get doubles
And use locale-independent functions everywhere else.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2014-01-10 15:49:24 +01:00
Moritz Lipp
9e85c2f7c8 Reduce the scope of val_list 2013-10-31 16:43:44 +01:00
Marwan Tanager
99b32ae109 Make the jumplist persistent on a per-file basis
This patch implements two new ZathuraDatabaseInterface functions, save_jumplist
and load_jumplist, for both the plain and sqlite backends (along with some
cleanups).

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-29 11:35:29 +02:00
Marwan Tanager
ae59da30c8 Bookmark the exact position, not just the page number (along with a number of fixes).
This patch adds some enhancements/fixes to the bookmarking feature of Zathura:

    - Bookmark the exact vertical and horizontal adjustments values, along with
      the page number. This is done in a backward-compatible way for both the
      plain and sqlite database backends, so that bookmarks that was taken
      previously (bookmarking only the page number) will still work as expected
      and won't be lost.

    - Fix the issue of not being able to remove bookmarks from the plain
      database; removing a bookmark in plain_remove_bookmark using
      g_key_file_remove_key corrupts the bookmarks file.  This is due to not
      truncating the entire bookmarks file in zathura_db_write_key_file_to_file
      prior to overriding it with a new one not containing the removed line.
      This is why, I guess, plain_remove_bookmark hadn't been implemented as
      expected using g_key_file_remove_key, because apparently, someone thought
      that the problem is caused by this API.

    - Fix not being able to update existing bookmarks persistently; updating a
      bookmark works only during the current session, but after the file is
      closed and reopened, the updated bookmark still has it's old value. This
      is due to changing only the bookmark structure in memory; the proper way
      to do it, is to call zathura_db_remove_bookmark on the old bookmark, then
      follow that by a call to zathura_db_add_bookmark on a bookmark structure
      containing the new position and the same old ID.

    - Make zathura_bookmark_add updates the bookmark if it already exists,
      rather than doing this externally in cmd_bookmark_create. This allows us
      to have all the relevant girara_notify messages in cmd_bookmark_create.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-21 09:45:36 +02:00
Marwan Tanager
88bff5dfd2 Include backward-search commands in the history plain database
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-06-10 14:38:34 +02:00
Sebastian Ramacher
cd3314b490 Save some string copies
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-25 02:58:37 +01:00
Sebastian Ramacher
92f8784605 Implement input history IO in plain database
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
2013-03-17 16:19:10 +01:00
Moritz Lipp
89e7832047 Update style 2012-10-09 01:12:18 +02:00
Sebastian Ramacher
6d462f4732 Implement first-page-column.
Thanks to J. Commelin for the patch.
2012-06-27 22:34:16 +02:00
Moritz Lipp
02582692f9 Fix two memory leaks 2012-05-08 17:02:18 +02:00
Moritz Lipp
adc9f41264 Introduce new link types 2012-04-22 10:04:46 +02:00
Moritz Lipp
b84abf30c1 Make compatible to old history files 2012-04-21 17:09:38 +02:00
Moritz Lipp
370deafb92 Save pages-per-row/position_x/position_y in database 2012-04-20 23:35:48 +02:00
Moritz Lipp
798c97f4a6 Introduce zathura_fileinfo_t and update database interface 2012-04-20 21:15:03 +02:00
Moritz Lipp
25320f5265 Resolve memory leak in db_watch_file 2012-04-01 22:57:34 +02:00
Sebastian Ramacher
c1834500b1 It was to late. 2012-03-27 11:56:42 +02:00
Sebastian Ramacher
87ef40e399 On GNU Hurd use flock instead of fcntl.
Furthermore we need to open the file for writing if we want to lock it for writing.
2012-03-27 00:24:58 +02:00
Moritz Lipp
90796b5b5c Added :offset command and some style updates 2012-03-24 18:27:10 +01:00
Sebastian Ramacher
b56a7fa73d If a filename contains [ or ] store the filename Base-64 encoded. (Closes: #148) 2012-03-14 13:36:51 +01:00
Moritz Lipp
7271166b20 Update style 2012-03-09 08:05:48 +01:00
Sebastian Ramacher
9d9eea8451 Fix some mem leaks. 2012-03-05 20:46:00 +01:00
Sebastian Ramacher
667c821600 Merge branch 'develop-database' into develop
Conflicts:
	database-plain.c
2012-03-04 18:52:31 +01:00
Sebastian Ramacher
6d9ca62c07 Add a missing return. 2012-03-04 15:59:08 +01:00
Sebastian Ramacher
4b559e585b Implement support to use both database backends. 2012-03-04 15:56:54 +01:00
Moritz Lipp
95239039e2 Free keys in db_load_bookmarks 2012-03-04 01:12:53 +01:00
Moritz Lipp
749559f7f5 Resolve memory leak in db_get_fileinfo 2012-03-04 01:02:14 +01:00
Moritz Lipp
625db90579 Removed some obsolete checks 2012-02-20 20:54:21 +01:00
Sebastian Ramacher
e513cb5579 store rotation in history 2012-02-08 22:23:45 +01:00
Sebastian Ramacher
d613fd41ac don't use _from_fd variants 2011-11-21 16:40:26 +01:00
Sebastian Ramacher
911d84c908 update includes due to girara restructuring 2011-10-23 17:01:15 +02:00
Pavel Borzenkov
8608823613 Get file info earlier
We need to know the document's 'scale' value earlier (before cairo
surfaces are created). Otherwise, cairo surfaces will be re-created and
wrong page will be rendered (since zoom doesn't preserve page number).

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Signed-off-by: Sebastian Ramacher <s.ramacher@gmx.at>
2011-10-20 18:28:12 +02:00
Pavel Borzenkov
88be07272f There is no need to check return value of g_malloc()
It never returns NULL. If this function fails, the application is
terminated.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Signed-off-by: Sebastian Ramacher <s.ramacher@gmx.at>
2011-10-20 18:27:56 +02:00
Sebastian Ramacher
bcfa016097 stupid me, I really did want to copy the string here 2011-10-17 09:37:22 +02:00
Sebastian Ramacher
942ebfde36 call g_key_file_load_from_data with dummy content if the file is empty 2011-10-16 20:28:58 +02:00
Sebastian Ramacher
712e4bd408 use the correct sorting function 2011-10-15 18:42:30 +02:00
Moritz Lipp
554e6eb70c database-plain: Lock file when reading 2011-10-14 01:24:42 +02:00
Moritz Lipp
b0007bf2de Use fcntl instead of socket to lock files 2011-10-14 01:04:06 +02:00
Moritz Lipp
094262c524 database-plain: Use GKeyFile for history as well 2011-10-12 12:43:36 +02:00
Moritz Lipp
2d4390f6d5 database-plain: Save and read bookmarks 2011-10-12 12:32:31 +02:00
Moritz Lipp
0bdbd6fa3b Immediately write history file 2011-10-12 11:45:10 +02:00
Moritz Lipp
186353111e Implement cb_zathura_db_watch_file 2011-10-11 23:43:30 +02:00
Moritz Lipp
a0aa0d44b7 Write and read file history 2011-10-11 23:18:21 +02:00
Moritz Lipp
b1144d9351 database-plain: File locking with unix sockets 2011-10-11 22:39:55 +02:00
Moritz Lipp
5ac40104a4 Add database-plain.c 2011-10-11 15:59:36 +02:00