Re: TreeView - set border on individual cells

2019-04-05 Thread Tilo Villwock via gtk-app-devel-list
Am Donnerstag, den 04.04.2019, 23:04 +0100 schrieb Mike Martin via gtk-
app-devel-list:
> Is this possible?
> 
> I did originally plan to have certain cells have a background colour
> to
> emphasize that there is a value to change. However as soon as the row
> is
> selected this is all wiped out by the highlight from selected row
> 
> So is it possible to set the borders on a cell by cell basis, all I
> can
> find is overall properties for the trreview
> 
> Mike

I don't have a definitive answer for you. But just as a headsup: you
can inspect every GTK component's CSS properties interactively while
running the program. You can even live edit the properties.

Here's a guide:

https://blog.gtk.org/2017/04/05/the-gtk-inspector/

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


Re: Moving from mailing lists to Discourse

2019-02-08 Thread Tilo Villwock via gtk-app-devel-list
Am Mittwoch, den 06.02.2019, 12:46 +0100 schrieb Emmanuele Bassi via
gtk-app-devel-list:
> [Cross-posted to various relevant mailing lists; please, reply to
> gtk-devel-list]
> 
> As part of an attempt at making GTK more friendly to newcomers, I and
> other
> core developers were thinking of moving the mailing lists from the
> current
> mailman installation to Discourse:
> 
>   https://discourse.org/
> 
> Possibly still hosted on GNOME infrastructure, depending on the
> requirements for our sysadmins.
> 
> The GTK project would have various sub-topics, mostly around
> development
> with and of GTK. Having a better archive search, a better moderation
> system, and a decent web UI are the major selling points for
> switching to
> Discourse. The fact that the project is also open source is neatly
> aligned
> with our values.
> 
> Are there any objections? Did somebody already try out Discourse and
> has
> opinions about it that they want to share with the community?
> 
> Ciao,
>  Emmanuele.

I'd very much welcome such a change. Being able to inline screenshots
would greatly improve discussions around certain problems IMHO.

--Tilo

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


Re: widget show() / hide() crashes application

2018-04-03 Thread Tilo Villwock
Just as a hint: in case you're trying to embed screenshots here, it's
not allowed. You need to upload it somewhere and link it in your mail.

Am Dienstag, den 03.04.2018, 02:28 -0700 schrieb stfl:
> I am writing a Python 3 GStreamer Client application.
> I receive fps measurments from fpsdisplaysink as a GStreamer Signal.
> If the fps drops too low I dissplay an overlay over the gtksink
> (which is
> connected to the fpsdisplaysink).
> 
> When I show() and hide() the overlayed Gtk.Box sometimes the entire
> application crashes.
> 
> I noticed that this happens when showing and hiding goes too close
> together.
> Also guarding it with 1.5s leads to such a crash.
> 
> After some time of trying I saw this error message which is usually
> not
> displayed.
> 
> 
> 
> 
> 
> 
> 
> --
> Sent from: http://gtk.10911.n7.nabble.com/Gtk-Apps-Dev-f3.html
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK3 - GtkExpander problem, bug ?

2018-03-06 Thread Tilo Villwock
Hello Sébastien,

attaching images isn't allowed on here. Have you created a minimal
working example that reproduces the bug? Otherwise it'll be hard to
help you.

Cheers,

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


Re: GTK3 - GtkExpander problem, bug ?

2017-12-14 Thread Tilo Villwock
Hello Sébastien,

attaching images isn't allowed on here. Have you created a minimal
working example that reproduces the bug? Otherwise it'll be hard to
help you.

Cheers,

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

Re: works inside MSYS2 but not outside ?

2017-10-12 Thread Tilo Villwock
Hello Eddie,

as a general recommendation: tone it down a little. So far we've seen
you either insult everybody or fake humbleness. Neither is really
appreciated.

As for your problem: You still haven't stated which exact GTK version
your using. And you haven't provided any output from your actual crash
either. That would be kind of helpful.

Also making a call to `gtk_native_dialog_destroy` immediately after
`gtk_native_dialog_show` will prevent the user from ever seeing the
dialog.

You should use `gtk_native_dialog_run` as described here:

https://developer.gnome.org/gtk3/stable/gtk3-GtkNativeDialog.html#gtk-n
ative-dialog-run

Good luck.

Tilo


Am Mittwoch, den 11.10.2017, 23:17 +0200 schrieb Bruggemann Eddie:
> Hi to all the Gtk team,
> 
> At first I want to excuse me for all the insanity I have written
> newly 
> on this mailing-list.
> 
> I was in hate and it's surely my fault when my program crash not the 
> fault of the Gtk maintainers.
> 
> ---
> 
> I go into my problem:
> 
> Try it out Like this:
> 
> [CODE]
> 
> #include 
> 
> static void create_win32_native_file_chooser(GtkWidget *widget,
> gpointer 
> user_data)  ;
> 
> static void create_win32_native_file_chooser(GtkWidget *widget,
> gpointer 
> user_data) {
> 
>GtkWidget *window = gtk_widget_get_toplevel(widget) ;
> 
>GtkFileChooserNative *win32_native_file_chooser = 
> gtk_file_chooser_native_new("title",
> GTK_WINDOW(window),
> GTK_FILE_CHOOSER_ACTION_SAVE,
>"accept label",
>"cancel label") ;
> 
> gtk_native_dialog_show(GTK_NATIVE_DIALOG(win32_native_file_chooser))
> ;
> 
> gtk_native_dialog_destroy(GTK_NATIVE_DIALOG(win32_native_file_chooser
> )) ;
> 
>return ;
> 
> }
> 
> 
> int main (int argc, char *argv[]) {
> 
>gtk_init(, ) ;
> 
>GtkWidget *window, *button ;
> 
>window = gtk_window_new(GTK_WINDOW_TOPLEVEL) ;
> 
>button= gtk_button_new_with_label("test") ;
> 
>g_signal_connect(button, "clicked", 
> G_CALLBACK(create_win32_native_file_chooser) , NULL);
> 
>gtk_container_add(GTK_CONTAINER(window), button) ;
> 
>gtk_main() ;
> 
>return 0 ;
> }
> 
> [/CODE]
> 
> Compile it with MSYS2.
> 
> ---
> 
> Then make a directory outside the MSYS2 environment (the $PATH must
> be 
> clean without MSYS2).
> 
> And execute this script given binary and directory:
> 
> [CODE]
> 
> #! /bin/bash
> 
> ###
> # #
> # A script for mingw distributing copying #
> # every needed *.dll to destination given #
> # as argument ($2),   #
> # from binary given as argument ($1)  #
> # #
> ###
> 
> function usage {
> 
>echo "a script to copy all required dll files from a binary to a 
> destdir."
>echo "usage: $0 pathtobin destdir"
> 
>exit 1
> 
> }
> 
> if [[ ! -f $1 ]] || [[ ! -d $2 ]] ; then
> 
>usage ;
> 
> else
> 
>ldd $1 | grep /mingw64/bin/ | cp $(gawk '{print $3}' ) $2
> 
>ldd $1 | grep /mingw64/bin/ | echo "$(gawk '{print $3}' )"
> 
># A try for cygwin:
>#
>#objdump -p $1 | grep "DLL Name" | cp $(printf "%s%s" 
> "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/" $(gawk '{print $3}'))
> $2
> 
>#objdump -p $1 | grep "DLL Name" | echo $(printf "%s%s" 
> "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/" $(gawk '{print $3}'))
> 
>echo "copy to $2"
> 
>cp $1 $2
> 
>echo "copy $1 to $2"
> 
>exit 0 ;
> 
> fi
> 
> [/CODE]
> 
> Then execute the binary at the location outside the MSYS2
> environment.
> 
> 
> It crash on my system.
> 
> Please forgiven me !
> 
> I'm a poor sinner for all the injuries I have said.
> 
> 
> If we find what bug I can package my program using inno-setup what
> would 
> be great and not hope.
> 
> Thanks to forgiven me, and for any help or comments.
> 
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How can i change background color of first column data

2017-03-24 Thread Tilo Villwock

> But i don't know how to change first column background just in the
> data.

There are two ways. If you need to have individual colors for each row
you would define a column that you use to store your background color
in for every entry of your GtkListStore. Let's say you define a column
as COLUMN_BACKGROUND like this:

enum {
...
COLUMN_BACKGROUND,
...
N_COLUMNS
};

Then you could do the following:

gtk_list_store_append(store, );
gtk_list_store_set(store, ,
...
COLUMN_BACKGROUND, "#ff00ff",
-1);

GtkTreeViewColumn *first_column;
first_column = gtk_tree_view_column_new_with_attributes(
"First Column", first_column_renderer,
...
"cell-background", COLUMN_BACKGROUND,
NULL);

The other ways is to set it directly on the cell renderer:

GtkCellRenderer* first_renderer;
first_renderer = gtk_cell_renderer_text_new();
g_object_set(first_renderer,
...
"cell-background", "#ff00ff",
NULL);

Hope that helps.

Cheers,

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


Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Tilo Villwock
Am Donnerstag, den 16.03.2017, 13:50 + schrieb Rúben Rodrigues:
> I get this error:
> 
> gtk-CRITICAL **: gtk_style_context_add_provider_for_screen:
> assertion 
> 'GDK_IS_SCREEN (screen)' failed
> 
> COde: 
> gtk_style_context_add_provider_for_screen(gtk_widget_get_style_contex
> t(GTK_WIDGET(gtk_builder_get_object(builder,"window_Main"))),
>  GTK_STYLE_PROVIDER (css_provider),
>  G_MAXUINT);

Of course you do. The first argument is meant to be a GdkScreen object.
Which makes me wonder if you even read the documentation. Anyways, you
can obtain the object by invoking

gdk_screen_get_default()

and the last argument is supposed to be a priority constant like

GTK_STYLE_PROVIDER_PRIORITY_APPLICATION

Look them up. I'd also recommend installing devhelp and gtk3-docs if
you haven't already.

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

Re: How to change GTK+3 label color dynamically

2017-03-16 Thread Tilo Villwock
Am Donnerstag, den 16.03.2017, 09:55 + schrieb Rúben Rodrigues:
> Hi,
> 
> THanks. This is dynamically? I need in c language if possible :S

Dynamic version:

...

static GtkCssProvider* provider = NULL;

static void
set_label_color(GtkWidget* label, const char* color)
{
const char* format = "label { color: %s; }";
size_t length = strlen(format) - 2 + 1;
char style[length];
sprintf(style, format, color);

if (provider == NULL) {
/* only create and add the provider the first time */
provider = gtk_css_provider_new();
gtk_style_context_add_provider(
gtk_widget_get_style_context(label),
GTK_STYLE_PROVIDER(provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref(provider);
}

gtk_css_provider_load_from_data(provider, style, -1, NULL);
}

...

This might not be ideal in all situations. Just make sure you don't
create a new provider everytime you set a new color. Hope that helps.

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

Re: does being inside a grid make an entry more editable?

2017-03-10 Thread Tilo Villwock
Hello Dan,

I don't think this issue is related to entries being placed inside a
grid. I created this minimal example and it's working fine for me:

#include 

static void activate(GApplication* app, gpointer user_data)
{
GtkWidget* window = gtk_application_window_new(
GTK_APPLICATION(app));
gtk_window_set_title(GTK_WINDOW(window), "GridTest");
gtk_container_set_border_width(GTK_CONTAINER(window), 10);

GtkWidget* entry1 = gtk_entry_new();
GtkWidget* entry2 = gtk_entry_new();
GtkWidget* entry3 = gtk_entry_new();
GtkWidget* entry4 = gtk_entry_new();

gtk_editable_set_editable(GTK_EDITABLE(entry1), FALSE);
gtk_editable_set_editable(GTK_EDITABLE(entry3), FALSE);

GtkWidget* grid = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(grid), 10);
gtk_grid_set_column_spacing(GTK_GRID(grid), 10);
gtk_grid_attach(GTK_GRID(grid), entry1, 0, 0, 1, 1);
gtk_grid_attach(GTK_GRID(grid), entry2, 0, 1, 1, 1);
gtk_grid_attach(GTK_GRID(grid), entry3, 1, 0, 1, 1);
gtk_grid_attach(GTK_GRID(grid), entry4, 1, 1, 1, 1);

gtk_container_add(GTK_CONTAINER(window), grid);
gtk_widget_show_all(window);
}

int main(int argc, char** argv)
{
GtkApplication* app = gtk_application_new(
"de.codemusings.GridTest", G_APPLICATION_FLAGS_NONE);
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
int retval = g_application_run(G_APPLICATION(app), argc, argv);
g_object_unref(app);

return retval;
}

Compiled with:

gcc -Wall -Werror -pedantic -std=c99 \
`pkg-config --cflags --libs gtk+-3.0` grid-test.c -o grid-test

The entries in the first row are not editable this way. What GTK
version are you using?

--Tilo

Am Donnerstag, den 09.03.2017, 19:43 -0800 schrieb Dan Hitt:
> I have some entries that are inside a grid (all gtk3 stuff).
> 
> I cannot seem to make them uneditable with a call to
> gtk_editable_set_editable().
> 
> I also have an entry outside the grid, which
> gtk_editable_set_editable() certainly can make uneditable.
> 
> So i think the difference between the two cases is the grid, and i'm
> wondering if putting an entry inside a grid somehow makes it more
> editable.  (Maybe this is obvious from some piece of documentation,
> and i'm just being really opaque.)
> 
> Anyhow, thanks in advance for any info, one way or another, on how
> being inside a grid would affect the editability of an entry!
> 
> dan
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Which icon for GTK_STOCK_EDIT?

2017-03-06 Thread Tilo Villwock
Hello,

I think when it comes to icons you're not supposed to use the stock
item facilities anymore. I would recommend getting the

gtk3-icon-browser

and browse through the available icons. Once you found a suitable one
you can apply one by invoking the *_from_icon_name family of function
calls, e.g.:

gtk_button_new_from_icon_name('edit-cut', GTK_ICON_SIZE_BUTTON);

You appear to be right, though. At a glance I couldn't find a 'pure'
edit icon either.

Hope that helps.

--Tilo


Am Montag, den 06.03.2017, 20:13 +0100 schrieb zahlenm...@gmx.de:
> Stock items are deprecated and the documentation mostly shows which
> named icon to use instead. Such information is missing for
> GTK_STOCK_EDIT (although I assume it is missing for a good reason).
> Now, I want to use an "edit" icon. Which one should I use? "gtk-edit"
> seems to work, but probably not everywhere. Some themes have an
> "edit"
> icon, but not all. I also thought about "accessories-text-editor"
> which
> is at least a standard freedesktop icon and fits to some degree.
> Maybe
> someone here has faced the same decision and give me a hint?
> 
> Kind regards
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Gtk-WARNING **: Could not find signal handler

2017-02-28 Thread Tilo Villwock
Well I don't know what else I could say. Either use

gtk_builder_add_callback_symbol(...)

to add all the symbols manually or make sure you can link against
gmodule-export-2.0 which on ARM probably means you have to compile and
install it yourself.

If you have installed it and your linker still can't find it then you
probably need to run ldconfig to update your cache.

--Tilo

Am Montag, den 27.02.2017, 18:46 + schrieb Rúben Rodrigues:
> Please help me...
> 
> I lost so many hours with this error.. This should work, because the 
> same code works in other machine.. But in raspberry pi don't..
> 
> Thanks
> 
> 
> Às 15:19 de 27/02/2017, Rúben Rodrigues escreveu:
> > Hi,
> > 
> > I have the same problem of this topic
> > https://mail.gnome.org/archives/gtk-app-devel-list/2013-December/ms
> > g00037.html
> > 
> > I see very similar problems, but didn't find any resolution.
> > 
> > I get this error in when i'm debuugin gtk app : Gtk-WARNING **:
> > Could
> > not find signal handler
> > 
> > I make this in my code
> > 
> > if( ! gtk_builder_add_from_file( builder, "ui.glade",  ) )
> >   {
> >   g_warning( "%s", error->message );
> >   g_free( error );
> >   return( 1 );
> >   }
> > 
> >   /* Allocate data structure */
> >   data = g_slice_new( ChData );
> > 
> >   /* Connect signals */
> >   gtk_builder_connect_signals( builder, NULL );
> > 
> > Because of this, all signals configured in glade do not work.
> > The documentation at
> > https://developer.gnome.org/gtk3/stable/GtkBuilder.html#gtk-builder
> > -connect-signals
> > suggests that i should be linking against gmodule-export-2.0, but
> > when i
> > try this, i get this error:
> >    /usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-
> > gnueabihf/bin/ld: cannot find -lgmodule-export-2.0
> > 
> > Thanks
> > 
> > ---
> > Este e-mail foi verificado em termos de vírus pelo software
> > antivírus Avast.
> > https://www.avast.com/antivirus
> > 
> > ___
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 
> 
> ---
> Este e-mail foi verificado em termos de vírus pelo software antivírus
> Avast.
> https://www.avast.com/antivirus
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Gtk-WARNING **: Could not find signal handler

2017-02-27 Thread Tilo Villwock
It tells you to link GModule because you're apparently not adding your
signal handler symbols before calling

gtk_builder_connect_signals(...)

and thus tries to use introspection to look up the symbols. Unless it's
hundreds of symbols I would suggest you simply call

gtk_builder_add_callback_symbol(...)

to add all symbols that are referenced in your Glade file.

Also are you actually working on an ARM machine? Otherwise your
toolchain seems messed up.

--Tilo

Am Montag, den 27.02.2017, 15:19 + schrieb Rúben Rodrigues:
> Hi,
> 
> I have the same problem of this topic 
> https://mail.gnome.org/archives/gtk-app-devel-list/2013-December/msg0
> 0037.html
> 
> I see very similar problems, but didn't find any resolution.
> 
> I get this error in when i'm debuugin gtk app : Gtk-WARNING **:
> Could 
> not find signal handler
> 
> I make this in my code
> 
> if( ! gtk_builder_add_from_file( builder, "ui.glade",  ) )
>  {
>  g_warning( "%s", error->message );
>  g_free( error );
>  return( 1 );
>  }
> 
>  /* Allocate data structure */
>  data = g_slice_new( ChData );
> 
>  /* Connect signals */
>  gtk_builder_connect_signals( builder, NULL );
> 
> Because of this, all signals configured in glade do not work.
> The documentation at 
> https://developer.gnome.org/gtk3/stable/GtkBuilder.html#gtk-builder-c
> onnect-signals
> suggests that i should be linking against gmodule-export-2.0, but
> when i 
> try this, i get this error:
>   /usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-
> gnueabihf/bin/ld: cannot find -lgmodule-export-2.0
> 
> Thanks
> 
> ---
> Este e-mail foi verificado em termos de vírus pelo software antivírus
> Avast.
> https://www.avast.com/antivirus
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GTK3 Glade and rendering in Windows/Linux]

2017-01-31 Thread Tilo Villwock
Well for one: The appearance on Ubuntu deviates from the default GTK
theme, so I'm not really sure if the comparison makes sense.

Also, did you actually verify that this is a problem, that pertains to
Glade only?

Either way, if it bothers you too much, you have to start tweaking the
css style context.

--Tilo

Am Dienstag, den 31.01.2017, 20:54 +0800 schrieb Happy:
> Thanks for the note. Hope the following links work. As you can see
> the
> windows are much different in size as well as the spacing.
> 
> Ubuntu:
> https://drive.google.com/file/d/0BxjwKUaYdW_zYnUydWExX2NNdE0/view?usp
> =s
> haring
> 
> Windows:
> https://drive.google.com/file/d/0BxjwKUaYdW_zeFhZdFYtelViUGM/view?usp
> =s
> haring
> 
> Glade.glade file:
> https://drive.google.com/file/d/0BxjwKUaYdW_zYWY4UnZweDhRbGc/view?usp
> =s
> haring
> 
> Thanks
> 
> 
> On Tue, 2017-01-31 at 20:09 +1100, Daniel Kasak wrote:
> > Neither of your messages had any attachments. Probably they're
> > stripped out by the mailing list server. If you're trying to point
> > people to files, screenshots, etc, try  chucking them on a blog or
> > pastebin or something.
> > 
> > Dan
> > 
> > On Sun, Jan 29, 2017 at 12:44 PM, Happy 
> > wrote:
> > > 
> > > Attached is a glade file. These render as seen in the attachments
> > > in
> > > Windows and Ubuntu(16.10). In Windows(10) the window is far
> > > larger
> > > as
> > > well as is for the spacing. It there a away to get the spacing
> > > and
> > > size
> > > down alike the rendering in Windows ? I guess this is not so much
> > > related to glade but more towards GTK, but if this assumption is
> > > wrong,
> > > then apologies for posting.
> > > 
> > > ___
> > > gtk-app-devel-list mailing list
> > > gtk-app-devel-list@gnome.org
> > > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Custom GtkCellRenderer for Buttons

2017-01-25 Thread Tilo Villwock
Hello,

I would like to implement a custom cell renderer for buttons but can't
figure out how. I looked at the source code for GtkCellRendererToggle
and the only code that might even be remotely connected to rendering a
checkbox or radio button in a cell seems to use a class that is called
GtkSnapshot.

I couldn't find any info on that class so I'm assuming this is
something internal and not meant for outside use?

I tried to render a button using the render vfunc but I keep getting
failing assertions about the the size of the button not having been
allocated prior to the call to gtk_widget_draw. This is the code I've
got so far:

static void
render(GtkCellRenderer* r, cairo_t* cr, GtkWidget* w,
   const GdkRectangle* background_area,
   const GdkRectangle* cell_area,
   GtkCellRendererState state)
{
GtkWidget* button = gtk_button_new_with_label("Click me!");
gtk_widget_set_allocation(button, cell_area);
gtk_widget_draw(button, cr);
gtk_widget_destroy(button);
}

This obviously doesn't allow for handling any click events anyway so
I'm probably going about this the wrong way. Any pointers in the right
direction would be appreciated.

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