[Glade-users] Checking if a window exists



Alef T Veld wrote:

I'm trying to check if a window is visible on the screen. This because i'm using one function
for both the main screen buttons and the buttons in the window that displays once one pushes
the buttons on the main screen.

You can check mapped flag of widget (window or button or any other GTK+ 
widget):
http://developer.gnome.org/doc/API/gtk/GtkWidget.html#GTK-WIDGET-MAPPED-CAPS

I thought of something like this:

Window w;

       /* Check if the window already exists. If it does, we
       skip this and parse the data, else we realize the widget */
       if((w=GDK_WINDOW_XWINDOW(GTK_WIDGET(app1)->window1))==NULL) {

In this line you can check whether app1 is realized (realized widget may 
be hidden by gtk_widget_hide() function, so you'll not see it on 
screen). The same check (but more portable) you can do with:
http://developer.gnome.org/doc/API/gtk/GtkWidget.html#GTK-WIDGET-REALIZED-CAPS

but it doesn't work. What would be a good way to do this. Also, if one wants to change
the property set in the xml file, for example, Visible=True, how does one change that
in the code?
 

gtk_widget_show() call:
http://developer.gnome.org/doc/API/gtk/GtkWidget.html#gtk-widget-show

    Olexiy





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]