Re: [Vala] Retrieve Row ID from Gtk.TreeView

2013-10-31 Thread Daniel Brendle

> 
>   [CCode (instance_pos = -1)]
> public void selected_request(Gtk.TreeView source){
> Gtk.TreeSelection sel = source.get_selection();
> Gtk.TreeIter selected;
> Gtk.TreeModel model;
> sel.get_selected(out model, out selected);
> model = source.get_model();
> GLib.Value val;
> model.get(selected, 1, out val);
> this.id_currently_displayed = val.get_int();
> this.render();
> }
> 

Problem solved. I mistook model.get() for model.get_value()


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Async call GLib.IOStream.splice_async failed!

2013-10-31 Thread Heiher
https://bugzilla.gnome.org/show_bug.cgi?id=710103

On Mon, Oct 14, 2013 at 3:30 PM, Luca Bruno  wrote:
> On 14/10/2013 06:59, Heiher wrote:
>>
>> Hello,
>>
>> vala codes:
>> public static int main (string args[]) {
>>  GLib.IOStream? is0 = null;
>>  GLib.IOStream? is1 = null;
>>
>>  is0.splice_async.begin (is1, GLib.IOStreamSpliceFlags.NONE,
>>  GLib.Priority.DEFAULT, null, (obj, res)
>> => {
>>  try {
>>  is0.splice_async.end (res);
>>  } catch (GLib.Error e) {
>>  }
>>  });
>>
>>  return 0;
>> }
>>
>> compile errors:
>> $ valac -X -w -o test test.vala --pkg gio-2.0
>> /home/heiher/work/test.vala.c: In function ‘__lambda2_’:
>> /home/heiher/work/test.vala.c:51:3: error: too many arguments to
>> function ‘g_io_stream_splice_finish’
>> g_io_stream_splice_finish (_data1_->is0, _tmp0_, &_inner_error_);
>> ^
>> In file included from /usr/include/glib-2.0/gio/gfileiostream.h:30:0,
>>   from /usr/include/glib-2.0/gio/gio.h:71,
>>   from /home/heiher/work/test.vala.c:9:
>> /usr/include/glib-2.0/gio/giostream.h:104:16: note: declared here
>>   gboolean   g_io_stream_splice_finish (GAsyncResult
>> *result,
>>  ^
>> error: cc exited with status 256
>> Compilation failed: 1 error(s), 0 warning(s)
>>
> Can you please report a bug?
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-10-31 Thread Daniel Brendle
On Thu, 2013-10-31 at 20:03 +0100, Luca Bruno wrote:
> Keep the session alive here: Soup.SessionSync session = new
> Soup.SessionSync ();
> Add that as a server instance. Also, keep the server itself alive
> somewhere.
> 
Acutally this worked. Now i think i understand. The lifetime of the
SessionAsync ended, when it left the scope of the closure, this triggers
the real_cancel_message-method on all queued messages through some kind
of destructor.

Thank you for this hint!

Regards, grindhold


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-10-31 Thread Luca Bruno
Keep the session alive here: Soup.SessionSync session = new Soup.SessionSync
();
Add that as a server instance. Also, keep the server itself alive somewhere.


On Thu, Oct 31, 2013 at 6:21 PM, Daniel Brendle wrote:

>
> > Of course it won't be reentrant anymore, and multiple
> > requests to the proxy will trample each other. But the
> > point is that libsoup works and the handler should is
> > correctly written; the fault is with vala. But as I said,
> > I cannot locate the fault. Perhaps its vala+libsoup
> > interaction because I rarely have problems with closure.
>
> I'm afraid, but this means to me that i am not able to develop my tool
> in Vala anymore until this issue is fixed. A blocking proxy is no option
> for a tool that me or anyone wants to use in production.
> Of course i would like to help the Vala community by reporting this bug.
> But i don't know what to write, since this is a pretty special issue and
> we basically have no clue what could possibly cause it. How should i
> write my bug-report?
>
> As both Gtk and Soup are GObject-based libraries, I will try to write an
> as-exact-as-possible replica of my Vala code in Python3 with
> GObject-introspection and see if the same problems occur there.
>
> Regards
>
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>
>


-- 
www.debian.org - The Universal Operating System
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-10-31 Thread Daniel Brendle

> Of course it won't be reentrant anymore, and multiple
> requests to the proxy will trample each other. But the
> point is that libsoup works and the handler should is
> correctly written; the fault is with vala. But as I said,
> I cannot locate the fault. Perhaps its vala+libsoup
> interaction because I rarely have problems with closure.

I'm afraid, but this means to me that i am not able to develop my tool
in Vala anymore until this issue is fixed. A blocking proxy is no option
for a tool that me or anyone wants to use in production.
Of course i would like to help the Vala community by reporting this bug.
But i don't know what to write, since this is a pretty special issue and
we basically have no clue what could possibly cause it. How should i
write my bug-report?

As both Gtk and Soup are GObject-based libraries, I will try to write an
as-exact-as-possible replica of my Vala code in Python3 with
GObject-introspection and see if the same problems occur there.

Regards


signature.asc
Description: This is a digitally signed message part
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Finally first release of my tool "Network Packet Cleaner" ^__^

2013-10-31 Thread Tarnyko
r...@no-log.org writes: 

Hello, 


I'm proud to present my "Packet Cleaner" tool ! (ehm no imagination for a
good name so it's Network Packet Cleaner" :-/) 



Congratulations !
I just tested it on Win7 x64 and it works fine. I especially like the 
interactivity of the "Circle" panel. Will keep it in my vault ! 

As you plan to work on future versions, I've put a few enhancement 
suggestions at the end of my mail. 


I've asked a lot of questions about how to handle files, how to use GTK,
etc... and I wanted to show you the conclusion. 

I'm not sure I've the right to include tshark in my binary package... :-? 



I think you better ask the upstream devs directly ;-). 


Linux binary certainly at the end of day... For source code, I need to
clean and document them ;) 

https://sourceforge.net/projects/netpackclean/ 


It was'nt so complicated to create this tools and I'll see to add a "DEC"
view of sessions... 

Regards 

Raum 


___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Suggestions :
- Double-clicking on a file in the "Open" dialog should open it directly. 
You can filter files by extensions or MIME types using Gtk.Filter.pattern ;

- "Save" dialog should suggest a default file name ;
- NPC should recognize malformed or .cap files which it cannot handle, and 
close them gracefully (example : "dhcp.cap" from 
"http://wiki.wireshark.org/SampleCaptures";). 


Regards,
Tarnyko
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] General tree walking question

2013-10-31 Thread Donn Ingle
Hi,
Apologies if this is OT. I am trying to do this in Vala.

This is a general tree walking question. I'm a bit thick and trees
really kill my brain. Here's the situation:

I have a "Thing" class that contains an ArrayList of (potentially)
many other Things. This all results in a tree where Things can have
many children and siblings.

I want to walk through this tree (from the root node) and create a
list that represents the tree.

Example tree:
ROOT has children A1, A2
A1 has children B1, B2
A2 has children C1, C2

Walk result in a stack:
ROOT (starts)
A1 (starts)
B1 (starts)
B1 (ends)
B2 (starts)
B2 (ends)
A1 (ends)
A2 (starts)
C1 (starts)
C1 (ends)
C2 (starts)
C2 (ends)
A2 (ends)
ROOT (ends)

I need those start/end markers and the whole stack kind of looks like
a flattened tree. You can imagine it with tabs showing the structure.

Questions:
Should one do this kind of thing with recursion, or is making lists
and iterating better?
(I worry that recursion might hit stack limits because my tree could
get quite large.)

I have been trying an iterative solution, but it's not really working
and I'm stuck. Code below.
Any suggestions?

Thanks,
\d

--
/*
Compile with:
valac --pkg gee-1.0 -X -lm -X -w $SRCNAME -o test
*/

using Gee;

public class Thing : Object {
  public string id;
  public ArrayList w_children;

  public Thing(string id) {
this.id = id;
this.w_children = new ArrayList();
  }
}


public ArrayList walk( Thing o ) {
  var nodes = new ArrayList();
  nodes.add(o);

  Thing lastnode = null;

  //This list is going to be returned.
  var results = new ArrayList();

  ArrayList newnodes;

  while (true) {
//Make a NEW newnodes list: equiv of Python newnodes=[]
newnodes = new ArrayList();

if (nodes.size == 0) break;

foreach ( weak Thing node in nodes) { //siblings

  stdout.printf( "Pushing sibling node %s to results.\n", node.id);
  results.add(node);

  if (node.w_children.size >0) {
foreach( weak Thing child in node.w_children ){ //children
  newnodes.add(child);
  stdout.printf("Visiting child %s of node:%s\n",child.id, node.id);
}
  } else {
stdout.printf("No kids for %s\n",node.id);
//Trying to keep a record of where we came from.
lastnode = node;
stdout.printf( "lastnode set to:%s\n", lastnode.id);
  } //Children

stdout.printf("CLOSE %s NOW.\n", node.id); //Not the right solution...
} //siblings

stdout.printf( "About to swap nodes and newnodes. Newnodes is:\n");
foreach (weak Thing nn in newnodes) stdout.printf("%s,",nn.id);
stdout.printf("\n\n");
nodes = newnodes;
  }
  stdout.printf("inside func walk:\n");
  foreach( weak Thing n in results )
stdout.printf( "Thing ID %s. Thing rc:%u\n", n.id, n.ref_count );
  return results;
}

int main() {
  var bag = new ArrayList(); //bag will be main owner of Thing instances.
  {
  var o1 = new Thing("ROOT");
  var o2 = new Thing("A1");
  var o3 = new Thing("A2");
  var o4 = new Thing("B1");
  var o5 = new Thing("B2");
  var o6 = new Thing("C1");
  var o7 = new Thing("C2");

  bag.add(o1); //0 ROOT
  bag.add(o2); //1 A1
  bag.add(o3); //2 A2
  bag.add(o4); //3 B1
  bag.add(o5); //4 B2
  bag.add(o6); //5 C1
  bag.add(o7); //6 C2
  }

  //Assign some children to nodes
  bag[0].w_children.add( bag[1] ); //root -> A1 + A2
  bag[0].w_children.add( bag[2] );
  bag[1].w_children.add( bag[3] ); //A1 -> B1
  bag[1].w_children.add( bag[4] ); //A1 -> B2
  bag[2].w_children.add( bag[5] ); //A2 -> C1
  bag[2].w_children.add( bag[6] ); //A2 -> C2

  var results = walk( bag[0] );

  return 0;
}


--
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Finally first release of my tool "Network Packet Cleaner" ^__^

2013-10-31 Thread raum
Hello,

I'm proud to present my "Packet Cleaner" tool ! (ehm no imagination for a
good name so it's Network Packet Cleaner" :-/)

I've asked a lot of questions about how to handle files, how to use GTK,
etc... and I wanted to show you the conclusion.

I'm not sure I've the right to include tshark in my binary package... :-?

Linux binary certainly at the end of day... For source code, I need to
clean and document them ;)

https://sourceforge.net/projects/netpackclean/

It was'nt so complicated to create this tools and I'll see to add a "DEC"
view of sessions...

Regards

Raum

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-10-31 Thread Nor Jaidi Tuah
On Thu, 2013-10-31 at 16:56 +0800, Nor Jaidi Tuah wrote:
> Perhaps this is a manifestation of the async+closure
> bug: https://bugzilla.gnome.org/show_bug.cgi?id=653143

Please ignore my previous remark. That bug report
was about vala async. I don't think that is relevant here.

The strange thing about the Session.Async bug is that,
as noted by the original post, the example in valadoc
works!


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-10-31 Thread Nor Jaidi Tuah
Perhaps this is a manifestation of the async+closure
bug: https://bugzilla.gnome.org/show_bug.cgi?id=653143


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Gdk event handler cast mystery

2013-10-31 Thread Donn Ingle
On 30 October 2013 18:45, Evan Nemerson  wrote:
>  Use the relevant Gdk.Event member instead:
> Gdk.EventButton eb = event.button;

Ah! Super thanks.
\d
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list