Re: GtkAssistant vs. GtkFileChooserWidget



Date: Sun, 12 Jul 2009 13:56:57 +0200 (CEST)
From: Pierre Wieser <pwieser trychlos org>
Subject: GtkAssistant vs. GtkFileChooserWidget
To: gtk-app-devel-list gnome org

Hi all,

I'm building a GtkAssistant which embeds a GtkFileChooserWidget
in one of the content pages.

My problem is when I run the assistant for the second times, the
GtkfileChooserWidget doesn't display at all. Below the sample code
which reproduces the problem :

enum {
      ASSIST_PAGE_INTRO = 0,
      ASSIST_PAGE_FILES_SELECTION,
      ASSIST_PAGE_DONE
};

static void
on_cancel( GtkAssistant *assistant, gpointer user_data )
{
      gtk_widget_hide_all( GTK_WIDGET( assistant ));
      gtk_main_quit();
}

/**
 * Run the assistant.
 */
void
nact_assist_import_run( void )
{
      static GtkBuilder *xml = NULL;
      if( !xml ){
              xml = gtk_builder_new();
              gtk_builder_add_from_file( xml, GLADEDIR
"/nautilus-actions-config.ui", NULL );
      }
      GtkAssistant *assistant = GTK_ASSISTANT( gtk_builder_get_object( xml,
"ImportAssistant" ));

      GtkWidget *intro = gtk_assistant_get_nth_page( assistant,
ASSIST_PAGE_INTRO );
      gtk_assistant_set_page_complete( assistant, intro, TRUE );

      GtkWidget *selector = gtk_assistant_get_nth_page( assistant,
ASSIST_PAGE_INTRO );
      gtk_assistant_set_page_complete( assistant, selector, TRUE );

      g_signal_connect( G_OBJECT( assistant ), "cancel", G_CALLBACK(
on_cancel ), NULL );
      gtk_widget_show_all( GTK_WIDGET( assistant ));
      gtk_main();
}

Note that if I initialize a new GtkBuilder _each time_ I run the
assistant, then all works fine. But I feel this work-around as a
waste of resources...

Note also that embedding other widgets (combobox or so) is fine,
and doesn't show the same problem.

Could someone be kind enough to explain me what is wrong in the code
?
Or what is wrong in embedding a GtkFileChooserWidget in a GtkAssistant
?

Thanks in advance
Regards
Pierre

------------------------------

I have just filled up a bugzilla report :
http://bugzilla.gnome.org/show_bug.cgi?id=589746

Regards
Pierre



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