/* * Creates a new GtkWidget of class GnomeDruid, performing any specialized * initialization needed for the widget to work correctly in this environment. * If a dialog box is used to initialize the widget, return NULL from this * function, and call data->callback with your new widget when it is done. */ static GtkWidget* gb_gnome_druid_new (GbWidgetNewData *data) { GtkWidget *new_widget; if (data->action == GB_LOADING) { new_widget = gnome_druid_new (); return new_widget; } else { show_druid_dialog (data); return NULL; } }
static void on_druid_dialog_ok (GtkWidget * widget, GbWidgetNewData * data) { GtkWidget *new_widget, *spinbutton, *window, *page; gint pages, i; window = gtk_widget_get_toplevel (widget); /* Only call callback if placeholder/fixed widget is still there */ if (gb_widget_can_finish_new (data)) { spinbutton = gtk_object_get_data (GTK_OBJECT (window), "pages"); g_return_if_fail (spinbutton != NULL); pages = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinbutton)); new_widget = gnome_druid_new (); page = gnome_druid_page_edge_new_aa (GNOME_EDGE_START); gb_widget_create_from (page, "GnomeDruidPageStart"); gnome_druid_append_page (GNOME_DRUID (new_widget), GNOME_DRUID_PAGE (page)); gnome_druid_set_page (GNOME_DRUID (new_widget), GNOME_DRUID_PAGE (page)); for (i = 0; i < pages - 2; i++) { page = gb_widget_new ("GnomeDruidPageStandard", new_widget); gnome_druid_append_page (GNOME_DRUID (new_widget), GNOME_DRUID_PAGE (page)); } if (pages >= 2) { page = gnome_druid_page_edge_new_aa (GNOME_EDGE_FINISH); gb_widget_create_from (page, "GnomeDruidPageFinish"); gnome_druid_append_page (GNOME_DRUID (new_widget), GNOME_DRUID_PAGE (page)); } gtk_widget_show_all (new_widget); gb_widget_initialize (new_widget, data); (*data->callback) (new_widget, data); } gtk_widget_destroy (window); }
/*--------------------------------------------------------------------------*/ void gb_update_druid (void) { GdkPixbuf *logo; gb_debug (DEBUG_UPDATE, "START"); if ( update_window == NULL ) { remote_dir_handle = NULL; remote_file_handle = NULL; update_cancel_flag = FALSE; logo = gdk_pixbuf_new_from_file (ICON_PIXMAP, NULL); update_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW(update_window), DRUID_WIDTH, DRUID_HEIGHT); update_druid = gnome_druid_new(); gtk_container_add( GTK_CONTAINER(update_window), update_druid ); add_start_page( GNOME_DRUID(update_druid), logo ); add_select_download_page( GNOME_DRUID(update_druid), logo ); add_downloading_page( GNOME_DRUID(update_druid), logo ); add_finish_page( GNOME_DRUID(update_druid), logo ); g_signal_connect( G_OBJECT(update_druid), "cancel", G_CALLBACK(cancel_cb), NULL ); g_signal_connect( G_OBJECT(update_window), "destroy", G_CALLBACK(destroy_cb), NULL ); gtk_widget_show_all( update_window ); } gb_debug (DEBUG_UPDATE, "END"); }