tags:

views:

19

answers:

2

Hello,

I want to change titlie of main window of my C/gtk+ application. I have code:

void update_title(const char *filename, MainWin* mw )
{
    GtkButton* btn = gtk_button_new();
    static int wid, hei;
    static char fname[50];
    char buf[100];

    if(filename != NULL)
    {
      strncpy(fname, filename, 49);
      wid = gdk_pixbuf_get_width(  gtk_image_view_get_pixbuf (GTK_IMAGE_VIEW(aview)) );
      hei = gdk_pixbuf_get_height( gtk_image_view_get_pixbuf ( GTK_IMAGE_VIEW(aview)) );
      fname[49] = '\0';
    }

    snprintf(buf, 100, "%s (%dx%d) %d%%", fname, wid, hei, (int)(mw->scale * 100));
    gtk_window_set_title(mw, buf);
}

When i try to call this function i see error: Gtk-CRITICAL **: gtk_window_set_title: assertion `GTK_IS_WINDOW (window)' failed

What's wrong?

Thank you.

+1  A: 

mw is of MainWin type, gtk_window_set-title() expect a GtkWindow type.

foo
A: 

You are repeatidly asking the same question and you'll repeatedly receive the same answer. These are your options:

  1. Learn how to properly subclass a GObject
  2. Write a proper question, such as I'm trying to subclass a GtkWindow with this code but...
  3. Goto 1.
ntd