dee

Merge lp:~mhr3/dee/vala-tags into lp:dee

Proposed by Michal Hruby on 2012-01-04
Status: Merged
Approved by: Mikkel Kamstrup Erlandsen on 2012-01-04
Approved revision: 331
Merged at revision: 331
Proposed branch: lp:~mhr3/dee/vala-tags
Merge into: lp:dee
Diff against target: 107 lines (+34/-12)
3 files modified
vapi/Dee-1.0-custom.vala (+20/-6)
vapi/Dee-1.0.metadata (+4/-0)
vapi/dee-1.0.vapi (+10/-6)
To merge this branch: bzr merge lp:~mhr3/dee/vala-tags
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) 2012-01-04 Approve on 2012-01-04
Review via email: mp+87439@code.launchpad.net

Description of the change

Makes ModelTag fully usable from Vala.

To post a comment you must log in.
Michal Hruby (mhr3) wrote :

The new way to use ModelTag is now:

var tag = new Dee.ModelTag<string> (model);
tag[model, iter] = "weeeee";
debug ("%s", tag[model, iter]);
tag.clear (model, iter);

Note that this will now properly duplicate the string.

Nice! :-)

But - This will break libunity, no? If so please have a branch ready for libunity before we merge.

review: Needs Information
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'vapi/Dee-1.0-custom.vala'
2--- vapi/Dee-1.0-custom.vala 2011-12-15 11:28:16 +0000
3+++ vapi/Dee-1.0-custom.vala 2012-01-04 08:44:24 +0000
4@@ -1,14 +1,28 @@
5 namespace Dee {
6-
7- public struct Filter {
8- [CCode (cname = "destroy")]
9- public GLib.DestroyNotify destroy_notify;
10- }
11-
12+
13+ public struct Filter {
14+ [CCode (cname = "destroy")]
15+ public GLib.DestroyNotify destroy_notify;
16+ }
17+
18 [CCode (ref_function = "", unref_function = "")]
19 [Compact]
20 public class ModelIter {
21 }
22+
23+ [CCode (cheader_filename = "dee.h", ref_function = "", unref_function = "")]
24+ [Compact]
25+ public class ModelTag<G> {
26+ [CCode (cname = "dee_model_register_tag", simple_generics = true)]
27+ public ModelTag (Dee.Model model);
28+ [CCode (cname = "dee_model_set_tag", instance_pos = 2.1)]
29+ public void @set (Dee.Model model, Dee.ModelIter iter, owned G value);
30+ [CCode (cname = "dee_model_get_tag", instance_pos = 2.1)]
31+ public unowned G @get (Dee.Model model, Dee.ModelIter iter);
32+ [CCode (cname = "dee_model_clear_tag", instance_pos = 2.1)]
33+ public void clear (Dee.Model model, Dee.ModelIter iter);
34+ }
35+
36 public interface ResultSet {
37 [CCode (cname = "_vala_dee_result_set_iterator")]
38 public Dee.ResultSet iterator ();
39
40=== modified file 'vapi/Dee-1.0.metadata'
41--- vapi/Dee-1.0.metadata 2011-12-19 10:25:16 +0000
42+++ vapi/Dee-1.0.metadata 2012-01-04 08:44:24 +0000
43@@ -12,6 +12,10 @@
44 .prepend skip=false
45 .set skip=false
46 .set_schema skip=false
47+ .register_tag skip
48+ .get_tag skip
49+ .set_tag skip
50+ .clear_tag skip
51
52 SerializableParseFunc skip=false
53 Serializable
54
55=== modified file 'vapi/dee-1.0.vapi'
56--- vapi/dee-1.0.vapi 2012-01-02 15:46:25 +0000
57+++ vapi/dee-1.0.vapi 2012-01-04 08:44:24 +0000
58@@ -70,9 +70,17 @@
59 [Compact]
60 public class ModelIter {
61 }
62- [CCode (cheader_filename = "dee.h")]
63+ [CCode (cheader_filename = "dee.h", ref_function = "", unref_function = "")]
64 [Compact]
65- public class ModelTag {
66+ public class ModelTag<G> {
67+ [CCode (cname = "dee_model_register_tag", simple_generics = true)]
68+ public ModelTag (Dee.Model model);
69+ [CCode (cname = "dee_model_clear_tag", instance_pos = 2.1)]
70+ public void clear (Dee.Model model, Dee.ModelIter iter);
71+ [CCode (cname = "dee_model_get_tag", instance_pos = 2.1)]
72+ public unowned G @get (Dee.Model model, Dee.ModelIter iter);
73+ [CCode (cname = "dee_model_set_tag", instance_pos = 2.1)]
74+ public void @set (Dee.Model model, Dee.ModelIter iter, owned G value);
75 }
76 [CCode (cheader_filename = "dee.h", type_id = "dee_peer_get_type ()")]
77 public class Peer : GLib.Object {
78@@ -178,7 +186,6 @@
79 public unowned Dee.ModelIter append (...);
80 public abstract unowned Dee.ModelIter append_row ([CCode (array_length = false, array_null_terminated = true)] GLib.Variant[] row_members);
81 public abstract void clear ();
82- public void clear_tag (Dee.ModelIter iter, Dee.ModelTag tag);
83 public void @get (Dee.ModelIter iter, ...);
84 public abstract bool get_bool (Dee.ModelIter iter, uint column);
85 public abstract unowned string get_column_schema (uint column);
86@@ -196,7 +203,6 @@
87 [CCode (array_length_pos = 0.1, array_length_type = "guint")]
88 public abstract unowned string[] get_schema ();
89 public abstract unowned string get_string (Dee.ModelIter iter, uint column);
90- public abstract void* get_tag (Dee.ModelIter iter, Dee.ModelTag tag);
91 public abstract uint8 get_uchar (Dee.ModelIter iter, uint column);
92 public abstract uint32 get_uint32 (Dee.ModelIter iter, uint column);
93 public abstract uint64 get_uint64 (Dee.ModelIter iter, uint column);
94@@ -211,13 +217,11 @@
95 public unowned Dee.ModelIter prepend (...);
96 public abstract unowned Dee.ModelIter prepend_row ([CCode (array_length = false, array_null_terminated = true)] GLib.Variant[] row_members);
97 public abstract unowned Dee.ModelIter prev (Dee.ModelIter iter);
98- public abstract unowned Dee.ModelTag register_tag (GLib.DestroyNotify tag_destroy);
99 public abstract void remove (Dee.ModelIter iter);
100 public void @set (Dee.ModelIter iter, ...);
101 public abstract void set_row (Dee.ModelIter iter, [CCode (array_length = false)] GLib.Variant[] row_members);
102 public void set_schema (...);
103 public abstract void set_schema_full ([CCode (array_length_cname = "num_columns", array_length_pos = 1.1, array_length_type = "guint", array_null_terminated = true)] string[] column_schemas);
104- public abstract void set_tag (Dee.ModelIter iter, Dee.ModelTag tag, void* value);
105 public abstract void set_value (Dee.ModelIter iter, uint column, GLib.Variant value);
106 public virtual signal void row_added (Dee.ModelIter iter);
107 public virtual signal void row_changed (Dee.ModelIter iter);

Subscribers

People subscribed via source and target branches

to all changes: