Merge lp:~ivaldi/midori/tabby-fix-tab-tstamp into lp:midori

Proposed by André Stösel
Status: Merged
Approved by: gue5t gue5t
Approved revision: 6626
Merged at revision: 6627
Proposed branch: lp:~ivaldi/midori/tabby-fix-tab-tstamp
Merge into: lp:midori
Diff against target: 39 lines (+11/-3)
1 file modified
extensions/tabby.vala (+11/-3)
To merge this branch: bzr merge lp:~ivaldi/midori/tabby-fix-tab-tstamp
Reviewer Review Type Date Requested Status
gue5t gue5t Approve
Review via email: mp+212724@code.launchpad.net

Commit message

Fix for incorrect tstamp for background tabs

Description of the change

To reproduce the bug:
- open a new session
- open new tabs in background
- don't change tabs
- restart midori

To post a comment you must log in.
Revision history for this message
gue5t gue5t (gue5t) wrote :

Looks good, compiles, and seems to fix the bug.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'extensions/tabby.vala'
2--- extensions/tabby.vala 2014-03-16 22:53:49 +0000
3+++ extensions/tabby.vala 2014-03-25 20:53:51 +0000
4@@ -357,11 +357,17 @@
5 public override void add_item (Katze.Item item) {
6 GLib.DateTime time = new DateTime.now_local ();
7 string? sorting = item.get_meta_string ("sorting") ?? "1";
8- string sqlcmd = "INSERT INTO `tabs` (`crdate`, `tstamp`, `session_id`, `uri`, `title`, `sorting`) VALUES (:tstamp, :tstamp, :session_id, :uri, :title, :sorting);";
9+ string sqlcmd = "INSERT INTO `tabs` (`crdate`, `tstamp`, `session_id`, `uri`, `title`, `sorting`) VALUES (:crdate, :tstamp, :session_id, :uri, :title, :sorting);";
10+
11+ int64 tstamp = item.get_meta_integer ("tabby-tstamp");
12+ if (tstamp < 0) { // new tab without focus
13+ tstamp = 0;
14+ }
15
16 try {
17 var statement = database.prepare (sqlcmd,
18- ":tstamp", typeof (int64), time.to_unix (),
19+ ":crdate", typeof (int64), time.to_unix (),
20+ ":tstamp", typeof (int64), tstamp,
21 ":session_id", typeof (int64), this.id,
22 ":uri", typeof (string), item.uri,
23 ":title", typeof (string), item.name,
24@@ -430,12 +436,14 @@
25 GLib.DateTime time = new DateTime.now_local ();
26 unowned Katze.Item item = new_view.get_proxy_item ();
27 int64 tab_id = item.get_meta_integer ("tabby-id");
28+ int64 tstamp = time.to_unix();
29+ item.set_meta_integer ("tabby-tstamp", tstamp);
30 string sqlcmd = "UPDATE `tabs` SET tstamp = :tstamp WHERE session_id = :session_id AND id = :tab_id;";
31 try {
32 database.prepare (sqlcmd,
33 ":session_id", typeof (int64), this.id,
34 ":tab_id", typeof (int64), tab_id,
35- ":tstamp", typeof (int64), time.to_unix ()).exec ();
36+ ":tstamp", typeof (int64), tstamp).exec ();
37 } catch (Error error) {
38 critical (_("Failed to update database: %s"), error.message);
39 }

Subscribers

People subscribed via source and target branches

to all changes: