Merge lp:~ivaldi/midori/tabby-title-changed into lp:midori

Proposed by André Stösel
Status: Merged
Approved by: Paweł Forysiuk
Approved revision: 6412
Merged at revision: 6412
Proposed branch: lp:~ivaldi/midori/tabby-title-changed
Merge into: lp:midori
Diff against target: 47 lines (+18/-1)
1 file modified
extensions/tabby.vala (+18/-1)
To merge this branch: bzr merge lp:~ivaldi/midori/tabby-title-changed
Reviewer Review Type Date Requested Status
Paweł Forysiuk Approve
Review via email: mp+187723@code.launchpad.net

Commit message

use a separate signal to store the tab title

To post a comment you must log in.
Revision history for this message
André Stösel (ivaldi) wrote :

use a separate signal to store the tab title

Revision history for this message
Paweł Forysiuk (tuxator) wrote :

Looks sensible

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 2013-09-13 21:24:57 +0000
3+++ extensions/tabby.vala 2013-09-26 11:12:21 +0000
4@@ -67,6 +67,7 @@
5 public abstract class Session : GLib.Object, ISession {
6 public abstract void add_item (Katze.Item item);
7 public abstract void uri_changed (Midori.View view, string uri);
8+ public abstract void data_changed (Midori.View view);
9 public abstract void tab_added (Midori.Browser browser, Midori.View view);
10 public abstract void tab_removed (Midori.Browser browser, Midori.View view);
11 public abstract void close ();
12@@ -129,6 +130,9 @@
13 view.web_view.notify["uri"].connect ( () => {
14 this.uri_changed (view, view.web_view.uri);
15 });
16+ view.web_view.notify["title"].connect ( () => {
17+ this.data_changed (view);
18+ });
19 }
20 }
21 }
22@@ -160,11 +164,24 @@
23 protected override void uri_changed (Midori.View view, string uri) {
24 unowned Katze.Item item = view.get_proxy_item ();
25 int64 tab_id = item.get_meta_integer ("tabby-id");
26- string sqlcmd = "UPDATE `tabs` SET uri = :uri, title = :title WHERE session_id = :session_id AND id = :tab_id;";
27+ string sqlcmd = "UPDATE `tabs` SET uri = :uri WHERE session_id = :session_id AND id = :tab_id;";
28 Sqlite.Statement stmt;
29 if (this.db.prepare_v2 (sqlcmd, -1, out stmt, null) != Sqlite.OK)
30 critical (_("Failed to update database: %s"), db.errmsg ());
31 stmt.bind_text (stmt.bind_parameter_index (":uri"), uri);
32+ stmt.bind_int64 (stmt.bind_parameter_index (":session_id"), this.id);
33+ stmt.bind_int64 (stmt.bind_parameter_index (":tab_id"), tab_id);
34+ if (stmt.step () != Sqlite.DONE)
35+ critical (_("Failed to update database: %s"), db.errmsg ());
36+ }
37+
38+ protected override void data_changed (Midori.View view) {
39+ unowned Katze.Item item = view.get_proxy_item ();
40+ int64 tab_id = item.get_meta_integer ("tabby-id");
41+ string sqlcmd = "UPDATE `tabs` SET title = :title WHERE session_id = :session_id AND id = :tab_id;";
42+ Sqlite.Statement stmt;
43+ if (this.db.prepare_v2 (sqlcmd, -1, out stmt, null) != Sqlite.OK)
44+ critical (_("Failed to update database: %s"), db.errmsg ());
45 stmt.bind_text (stmt.bind_parameter_index (":title"), view.get_display_title ());
46 stmt.bind_int64 (stmt.bind_parameter_index (":session_id"), this.id);
47 stmt.bind_int64 (stmt.bind_parameter_index (":tab_id"), tab_id);

Subscribers

People subscribed via source and target branches

to all changes: