tags:

views:

40

answers:

2

Hello I have structure:

typedef struct _MainWin
{
    GtkWindow parent;
    GtkWidget* scroll;
    GtkWidget* box;
}MainWin;

I created application main window from this structure. Now i need in main window full screen. When i try to call:

gtk_window_fullscree(GTK_WINDOW(mw);

Where mw is object of MainWin i see: **gtk_window_fullscreen: assertion `GTK_IS_WINDOW (window)' fail**ed

How can i lead mw to GtkWindow ?

Thank you

A: 

This seems wrong. Your GtkWindow should be a pointer too, and created using gtk_window_new() like any other GTK+ widget. This looks like you're trying to "subclass" the GtkWindow struct, which I don't think you can do like this.

unwind
I created window with gtk_window_new() after calling gtk_window_fulscreen(...).
shk
I try to make like here: http://github.com/xsisqox/Viewnior/blob/master/src/vnr-window.h
shk
Do you have all the other stuff that goes along with subclassing a GtkWindow?Perhaps it would be a good idea to post a bit more code so we can see if you did it correctly, but if you called `gtk_window_new()` and your MainWin is declared as above then you are in fact doing several things wrong.Also there's no real reason to subclass a GtkWindow most of the time, so you may want to just not bother with that part
Spudd86
Actually, for large multi-document applications, subclassing GtkWindow is quite common.
ptomato
@ptomato: Sure, which is what "like this" is referring to.
unwind
@unwind, Sorry, I meant that in response to spudd86's comment that there's no real reason to subclass.
ptomato
@ptomato yea, but it doesn't look like this is all that complex and subclassing is probably not needed, or even really desirable here
Spudd86
+1  A: 

What they did in the Viewnior code that you posted is to make a subclass of GtkWindow. You have copied part of the code to do that properly, but not all of it. You should read the tutorial part of the GObject documentation on how to define new classes. You can find it online here.

ptomato