Use a variable from pointer that is pointed by a struct which (that structs') pointer is sent to a function that needs to use it
<p>Welp, thats a kind of a pointerception.<br>
So.<br>
Im using gtk+<br>
In gtk I define buttons like this:<br></p>

<pre><code>GtkWidget *button1, *button2;
</code></pre>

<p>so I need a function do do something with this. So I make a struct that will hold a pointer to it<br>
Here it is:<br></p>

<pre><code>typedef struct userdata{
    GtkWidget *button1, *button2;
}userdata;
</code></pre>

<p>I point pointers from struct to pointers from main:</p>

<pre><code>userdata data;
data.button1 = button1;
data.button2 = button2;
</code></pre>

<p>Then I use this struct with gtk event:</p>

<pre><code>g_signal_connect(G_OBJECT(window), "configure-event", G_CALLBACK(resetbuttonsize), &amp;data);
</code></pre>

<p>And here comes the problem. I want to do something with these variables I just sent to function, for example resize them so I do something like this:</p>

<pre><code>void resetbuttonsize(GtkWindow *window, GdkEvent *event, gpointer data){
    GtkWidget *button1 = data-&gt;button;
}
</code></pre>

<p>So I could then do something like:</p>

<pre><code>gtk_widget_set_size_request(button1, 40, 40);
</code></pre>

<p>Sadly, I can not to this (GtkWidget *button1 = data->button;) because I get the following compiler error:<br></p>

<pre><code>/media/dysk250/pmanager/testfile/main.cpp|59|error: ‘gpointer {aka void*}’ is not a pointer-to-object type|
</code></pre>

<p>Can someone tell me what Im doing wrong?
Im newbie with pointers, maybe I could resolve single pointer pointer, but this one is just too much for my brain to understand what is happening and why code I use is wrong.</p>