Re: Template Widgets inside another GtkBuilder file

2015-10-07 Thread Victor Aurélio Santos
So the really question becomes, how to get `g_type_ensure` generated
in output code when subclassing Widgets in Vala ?

2015-10-05 17:54 GMT-03:00 Victor Aurélio Santos :
> Emmanuele,
>
>> In order to do that, you should use `g_type_ensure()` inside the
> instance initialization function of the parent's widget class
>
> Since using Vala, from what I can see in case of using [GtkTemplate]
> the g_type_ensure is generated, but when just subclassing a GtkWidget
> it doesn't exists in the generated .c, am I right ?
>
> And what I can do to g_type_ensure be present in generated .c in the
> second case ?
>
> Thanks.
>
> 2015-10-04 10:40 GMT-03:00 Emmanuele Bassi :
>> Hi;
>>
>> On 3 October 2015 at 02:14, Victor Aurélio Santos
>>  wrote:
>>> How can I do that ?
>>> Just build all together results in this warning:
>>>
 (ajami:3475): Gtk-CRITICAL **: Error building template class 
 'AjamiMainWindow' for an instance of type 'AjamiMainWindow': Invalid 
 object type 'HVMeter' on line 2
>>>
>>> I've asked on SO[1] and got only one answer.
>>>
>>> I stick at "_get_type" workaround/hack but I didn't like it and I
>>> can't do the same thing in Vala (I've not found how to do the same
>>> thing).
>>>
>>> More details can be found on SO question.
>>>
>>> So, what I really want to know is what is the best option to
>>> accomplish this in Vala and in C too.
>>>
>>> [1]: 
>>> http://stackoverflow.com/questions/24235937/custom-gtk-widget-with-template-ui
>>
>> If you have an internal, private widget that you use as a child in a
>> template, you'll need to ensure that the type system knows about the
>> child widget's type before initializing the template that references
>> it.
>>
>> In order to do that, you should use `g_type_ensure()` inside the
>> instance initialization function of the parent's widget class, right
>> before calling `gtk_widget_init_template()`; for instance:
>>
>>   g_type_ensure (hv_meter_get_type ());
>>
>> This is also what GTK+ itself does:
>> https://git.gnome.org/browse/gtk+/tree/gtk/gtkfilechooserwidget.c#n8598
>>
>> Ciao,
>>  Emmanuele.
>>
>> --
>> https://www.bassi.io
>> [@] ebassi [@gmail.com]
>
>
>
> --
> Victor Aurélio Santos



-- 
Victor Aurélio Santos
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Filechooserbuttons and gtk_widget_set_sensitive

2015-10-07 Thread Roger Matthews
To someone willing to help,
 
 1) Following the example Listing 4.10 of the GTK+ Development book 
filechooserbuttons.c I have created a filechooser button and label, which are 
attached to a grid rather than a box. When clicked a "dialogue" appears, I can 
then navigate directories to the filtered files, highlight the selected files, 
but when double-clicked or press 'open', nothing happens. That is, the 
path/filename is displayed in the label and the selected filename is displayed 
in the button but the file is not opened. How do I open the file?
 
2) I would like to activate/de-activate spinbuttons depending on whether 
certain other selections have been made (with other integer spinbuttons). I 
have tried using gtk_widget_set_sensitive ( GtkWidget *widget, gboolean 
sensitive) but get compilation warning: unknown type name 'gtk_widget_set'. I'm 
using GTK3. Any clues? 
 
3) I've built a GUI coded in C without using a builder.ui file and would like 
to make it into a stand-alone application, preferably all 'hand' coded, how do 
I do this? I'm having difficulty following the example in the documentation 
because it uses a buider.ui file, I am unsure of the form of the main() format, 
and I can't locate 
https://git.gnome.org/browse/gtk+/tree/examples/application2/exampleappwin.c 
 
Thanks,
Roger Matthews
  
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Trigger a GtkEntryCompletion's popup

2015-10-07 Thread Daniel Kasak
Hi all. I have some GtkEntry widgets with a GtkEntryCompletion attached.
I've set the minimum key length to 0, hoping this would make the
completion's popup appear on focus in, but it doesn't. I have noticed that
if I type something, then hit backspace, the popup appears. So I guess I
can hook up some code on focus-in to simulate this - ie insert some text
and delete it. Is there a cleaner way of doing it?

Thanks.

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


gtk_text_buffer_delete ?

2015-10-07 Thread Pierre Wieser
Hello, 

On the application I'm currently working on [1], I want limit the size of the
text entered in a GtkTextBuffer to those saved in the DBMS, so 4096 chars.

I so connected to the 'changed' signal of the GtkTextBuffer, and the handler
is :

static void
on_notes_changed( GtkTextBuffer *buffer, void *empty )
{
static const gchar *thisfn = "my_utils_on_notes_changed";
static const gint MAX_LENGTH = 4096;
static gboolean in = FALSE;
gint count;
GtkTextIter start, end;

/* prevent an infinite recursion */
if( !in ){
count = gtk_text_buffer_get_char_count( buffer );
if( count >= MAX_LENGTH ){
/*
 * this code works, but emit the following Gtk-Warning:
 *
 * Invalid text buffer iterator: either the iterator is
 * uninitialized, or the characters/pixbufs/widgets in 
the
 * buffer have been modified since the iterator was 
created.
 * You must use marks, character numbers, or line 
numbers to
 * preserve a position across buffer modifications.
 * You can apply tags and insert marks without 
invalidating
 * your iterators, but any mutation that affects 
'indexable'
 * buffer contents (contents that can be referred to by 
character
 * offset) will invalidate all outstanding iterators
 */
gtk_text_buffer_get_iter_at_offset( buffer, , 
MAX_LENGTH-1 );
/*gtk_text_iter_backward_char(  );*/
/*gtk_text_buffer_get_iter_at_offset( buffer, , 
count );*/
gtk_text_buffer_get_end_iter( buffer,  );
/*gtk_text_iter_backward_char(  );*/
in = TRUE;
g_debug( "%s: count=%d, start=%d, end=%d",
thisfn, count, 
gtk_text_iter_get_offset(  ), gtk_text_iter_get_offset(  ));
gtk_text_buffer_delete( buffer, ,  );
in = FALSE;
}
}
}

As stated in the comment, the code works (the size if actually limited to 4095 
chars),
but each execution of gtk_text_buffer_delete() triggers the well-known warning
"Invalid text buffer iterator".

I am a bit stucked here, because I do not understand why this happens, as the 
buffer
is not modified between taking the iters and deleting the content...

Can anyone help me in this matter ?

Thanks in advance.
Regards
Pierre
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk_text_buffer_delete ?

2015-10-07 Thread Pierre Wieser

> On the application I'm currently working on [1], I want limit the size of the
> [...]

I omit the application link, for reference ;)

[1] https://github.com/trychlos/openbook/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk_text_buffer_delete ?

2015-10-07 Thread Jim Charlton

On 15-10-07 04:14 AM, Pierre Wieser wrote:

Hello,

On the application I'm currently working on [1], I want limit the size of the
text entered in a GtkTextBuffer to those saved in the DBMS, so 4096 chars.

I so connected to the 'changed' signal of the GtkTextBuffer, and the handler
is :

static void
on_notes_changed( GtkTextBuffer *buffer, void *empty )
{
static const gchar *thisfn = "my_utils_on_notes_changed";
static const gint MAX_LENGTH = 4096;
static gboolean in = FALSE;
gint count;
GtkTextIter start, end;

/* prevent an infinite recursion */
if( !in ){
count = gtk_text_buffer_get_char_count( buffer );
if( count >= MAX_LENGTH ){
/*
 * this code works, but emit the following Gtk-Warning:
 *
 * Invalid text buffer iterator: either the iterator is
 * uninitialized, or the characters/pixbufs/widgets in 
the
 * buffer have been modified since the iterator was 
created.
 * You must use marks, character numbers, or line 
numbers to
 * preserve a position across buffer modifications.
 * You can apply tags and insert marks without 
invalidating
 * your iterators, but any mutation that affects 
'indexable'
 * buffer contents (contents that can be referred to by 
character
 * offset) will invalidate all outstanding iterators
 */
gtk_text_buffer_get_iter_at_offset( buffer, , 
MAX_LENGTH-1 );
/*gtk_text_iter_backward_char(  );*/
/*gtk_text_buffer_get_iter_at_offset( buffer, , 
count );*/
gtk_text_buffer_get_end_iter( buffer,  );
/*gtk_text_iter_backward_char(  );*/
in = TRUE;
g_debug( "%s: count=%d, start=%d, end=%d",
thisfn, count, gtk_text_iter_get_offset( 
 ), gtk_text_iter_get_offset(  ));
gtk_text_buffer_delete( buffer, ,  );
in = FALSE;
}
}
}

As stated in the comment, the code works (the size if actually limited to 4095 
chars),
but each execution of gtk_text_buffer_delete() triggers the well-known warning
"Invalid text buffer iterator".

I am a bit stucked here, because I do not understand why this happens, as the 
buffer
is not modified between taking the iters and deleting the content...

Can anyone help me in this matter ?

Thanks in advance.
Regards
Pierre
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
I do not have an answer to the problem as stated, but I have written 
code that achieves the overall purpose of pruning the text buffer.

I work in Gtkmm rather than in GTK3.  Here is a snippet of code.
*
start = tb1_ptr->begin();
end = tb1_ptr->end();
if (end.get_offset() > 254) end.set_offset(254);
text = tb1_ptr->get_text(start, end, FALSE);

where
tb1_ptr = Gtk::TextBuffer::create();
Gtk::TextIter start;
Gtk::TextIter end;
Glib::ustring text;

In your case, rather than using gtk_text_buffer_delete, you would use
gtk_text_iter_get_offset (/|const GtkTextIter 
 *iter|/);

and
gtk_text_iter_set_offset (/|GtkTextIter 
 *iter|/, 
/|gint 
 
char_offset|/);


to limit the text buffer to your desired length.

Hope this helps...   Jim...




text = tb1_ptr->get_text(start, end, FALSE);
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Broadway backend fails with ”can't write to client”

2015-10-07 Thread Jay Jay Billings
Everyone,

I am playing with the Broadway backend on Fedora 21 and I am getting a
”can't write to client” error. It works fine with simple applications like
gedit, but it hangs and prints this error on more complicated applications
like Eclipse. Specifically, I get one good click or tooltip access in
Eclipse before it fails and, after a bit, disconnects and prints a wall of
these errors in the broadwayd shell.

Fedora 22 makes it three clicks before crashing. On that machine I'm
running gtk3.16.7.

As far as I could tell from the Broadway source code, this is a generic
error printed whenever the output stream can't be written. Could anyone
give me some more suggestions on how to fix this? I'm willing to jump into
the code too if you have some developer "getting started" docs.

Thanks for your help and sorry if this is the wrong list.

Best,
Jay



-- 
Jay Jay Billings
Oak Ridge National Laboratory
Twitter Handle: @jayjaybillings
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: gtk_text_buffer_delete ?

2015-10-07 Thread Stefan Salewski
On Wed, 2015-10-07 at 13:14 +0200, Pierre Wieser wrote:
> Hello, 
> 
> On the application I'm currently working on [1], I want limit the size
> of the
> text entered in a GtkTextBuffer to those saved in the DBMS, so 4096
> chars.

Seen that:

http://www.gtkforums.com/viewtopic.php?t=1012

Very similar to your solution, but I think that was GTK2, and your is
GTK3.

No other idea, sorry.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk_text_buffer_delete ?

2015-10-07 Thread Stefan Salewski
On Wed, 2015-10-07 at 13:14 +0200, Pierre Wieser wrote:
> I so connected to the 'changed' signal of the GtkTextBuffer,

Maybe try connecting to insert-text signal -- changed signal may be
emitted again when you delete. See

http://stackoverflow.com/questions/2791035/how-do-i-set-buffer-limit-for
-gtk-text-view-in-c
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk_text_buffer_delete ?

2015-10-07 Thread Pierre Wieser

On Wed, 2015-10-07 at 15:05 +0200, Stefan Salewski wrote:

> On Wed, 2015-10-07 at 13:14 +0200, Pierre Wieser wrote:
>> Hello, 
>> 
>> On the application I'm currently working on [1], I want limit the size
>> of the
>> text entered in a GtkTextBuffer to those saved in the DBMS, so 4096
>> chars.
>
> Seen that:
>
> http://www.gtkforums.com/viewtopic.php?t=1012
>
> Very similar to your solution, but I think that was GTK2, and your is
> GTK3.

Hi Stefan,

Thanks for your interest, but the thread you point to is actually the one
on which I based my own code.
I do not think that GTK2 vs GTK3 is a point in this matter, do you ?

> No other idea, sorry.

And Google has not been my friend further...
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Fwd: RE: Pthread lock on g_once_init_enter (_define_type_id__volatile) **Important Information**

2015-10-07 Thread Gonzalo Aguilar Delgado

Please remove this spam address
no_re...@2020mobile.com 



Or the one subscribed to the list.


 Mensaje reenviado 
Asunto: 	RE: Pthread lock on g_once_init_enter 
(_define_type_id__volatile) **Important Information**

Fecha:  6 Oct 2015 09:36:48 +0100
De: no_re...@2020mobile.com 
Para:   Gonzalo Aguilar Delgado 



Thank you for your email.

You are receiving this automatic reply because you sent a message 
to gtk-list@gnome.org


*_Please be aware that all @2020mobile.com email addresses have now been 
replaced with the @brightstar.com email domain suffix._*


Your original email has been automatically forwarded to the correct 
Brightstar email address.  To ensure all future emails to this recipient 
are delivered please update your address book to reflect the recipients 
brightstar.com email address.


If you are unsure of the recipient's Brightstar email address please 
contact the recipient for details of the correct address.


Be aware that as of 31^st October 2015, the above referenced forwarding 
action will be turned off and non-deliverable messages will be issued.


For any concerns or queries please contact the servicedesk 
atservicedesk...@brightstar.com .


Thank you





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


Embedding GSettings schema in binary

2015-10-07 Thread George Barrett
Hi, I was curious about the possibility of adding a gschema to an 
application's GResources (or something similar). I'm using the 
GSettings API for a small command-line application that uses the 
keyfile GSettingsBackend, no (intentional) interaction with dconf, and 
feel that the need to add the app's gschema to the system's store is a 
bit of an onerous un-necessity. Does anyone have any tips they can 
offer me?


Thanks

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


Re: Embedding GSettings schema in binary

2015-10-07 Thread Emmanuele Bassi
Hi;

On 3 October 2015 at 20:45, George Barrett  wrote:
> Hi, I was curious about the possibility of adding a gschema to an
> application's GResources (or something similar). I'm using the GSettings API
> for a small command-line application that uses the keyfile GSettingsBackend,
> no (intentional) interaction with dconf, and feel that the need to add the
> app's gschema to the system's store is a bit of an onerous un-necessity.
> Does anyone have any tips they can offer me?

No, currently it's not possible to include schemas inside a gresource.

There's some discussion on allowing creating a GSettingsSchemaSource
from a GResource on this bug:
https://bugzilla.gnome.org/show_bug.cgi?id=667937

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
___
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list