~ubuntu-branches/debian/experimental/gtk+2.0/experimental

« back to all changes in this revision

Viewing changes to gtk/gtkassistant.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2010-06-11 12:19:30 UTC
  • mfrom: (1.10.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20100611121930-n4pklvkoqdsg12vm
Tags: 2.21.2-1
* New upstream development release:
  + debian/rules,
    debian/libgtk2.0-0.symbols:
    - Update for new API symbols.
  + debian/patches/070_mandatory-relibtoolize.patch:
    - Regenerated for the new version.
  + debian/control.in:
    - Update GLib (build-) dependency to >= 2.25.8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
  GtkAssistantPageFunc forward_function;
104
104
  gpointer forward_function_data;
105
105
  GDestroyNotify forward_data_destroy;
 
106
 
 
107
  guint committed : 1;
106
108
};
107
109
 
108
110
static void     gtk_assistant_class_init         (GtkAssistantClass *class);
267
269
   *
268
270
   * A handler for the ::apply signal should carry out the actions for which
269
271
   * the wizard has collected data. If the action takes a long time to complete,
270
 
   * you might consider to put a page of type %GTK_ASSISTANT_PAGE_PROGRESS
 
272
   * you might consider putting a page of type %GTK_ASSISTANT_PAGE_PROGRESS
271
273
   * after the confirmation page and handle this operation within the
272
274
   * #GtkAssistant::prepare signal of the progress page.
273
275
   *
473
475
}
474
476
 
475
477
static void
 
478
compute_progress_state (GtkAssistant *assistant)
 
479
{
 
480
  GtkAssistantPrivate *priv = assistant->priv;
 
481
  gint page_num, n_pages;
 
482
 
 
483
  n_pages = gtk_assistant_get_n_pages (assistant);
 
484
  page_num = gtk_assistant_get_current_page (assistant);
 
485
 
 
486
  page_num = (priv->forward_function) (page_num, priv->forward_function_data);
 
487
 
 
488
  if (page_num >= 0 && page_num < n_pages)
 
489
    gtk_widget_show (assistant->forward);
 
490
  else
 
491
    gtk_widget_hide (assistant->forward);
 
492
}
 
493
 
 
494
static void
476
495
set_assistant_header_image (GtkAssistant *assistant)
477
496
{
478
497
  GtkAssistantPrivate *priv = assistant->priv;
509
528
      gtk_widget_set_sensitive (assistant->cancel, TRUE);
510
529
      gtk_widget_set_sensitive (assistant->forward, priv->current_page->complete);
511
530
      gtk_widget_grab_default (assistant->forward);
512
 
      gtk_widget_show (assistant->cancel);
513
531
      gtk_widget_show (assistant->forward);
514
532
      gtk_widget_hide (assistant->back);
515
533
      gtk_widget_hide (assistant->apply);
521
539
      gtk_widget_set_sensitive (assistant->back, TRUE);
522
540
      gtk_widget_set_sensitive (assistant->apply, priv->current_page->complete);
523
541
      gtk_widget_grab_default (assistant->apply);
524
 
      gtk_widget_show (assistant->cancel);
525
542
      gtk_widget_show (assistant->back);
526
543
      gtk_widget_show (assistant->apply);
527
544
      gtk_widget_hide (assistant->forward);
533
550
      gtk_widget_set_sensitive (assistant->back, TRUE);
534
551
      gtk_widget_set_sensitive (assistant->forward, priv->current_page->complete);
535
552
      gtk_widget_grab_default (assistant->forward);
536
 
      gtk_widget_show (assistant->cancel);
537
553
      gtk_widget_show (assistant->back);
538
554
      gtk_widget_show (assistant->forward);
539
555
      gtk_widget_hide (assistant->apply);
544
560
      gtk_widget_set_sensitive (assistant->close, priv->current_page->complete);
545
561
      gtk_widget_grab_default (assistant->close);
546
562
      gtk_widget_show (assistant->close);
547
 
      gtk_widget_hide (assistant->cancel);
548
563
      gtk_widget_hide (assistant->back);
549
564
      gtk_widget_hide (assistant->forward);
550
565
      gtk_widget_hide (assistant->apply);
555
570
      gtk_widget_set_sensitive (assistant->back, priv->current_page->complete);
556
571
      gtk_widget_set_sensitive (assistant->forward, priv->current_page->complete);
557
572
      gtk_widget_grab_default (assistant->forward);
558
 
      gtk_widget_show (assistant->cancel);
559
573
      gtk_widget_show (assistant->back);
560
 
      gtk_widget_show (assistant->forward);
561
574
      gtk_widget_hide (assistant->apply);
562
575
      gtk_widget_hide (assistant->close);
563
576
      gtk_widget_hide (assistant->last);
 
577
      compute_progress_state (assistant);
564
578
      break;
565
579
    default:
566
580
      g_assert_not_reached ();
567
581
    }
568
582
 
 
583
  if (priv->committed)
 
584
    gtk_widget_hide (assistant->cancel);
 
585
  else if (priv->current_page->type == GTK_ASSISTANT_PAGE_SUMMARY)
 
586
    gtk_widget_hide (assistant->cancel);
 
587
  else
 
588
    gtk_widget_show (assistant->cancel);
 
589
 
569
590
  /* this is quite general, we don't want to
570
591
   * go back if it's the first page */
571
592
  if (!priv->visited_pages)
2259
2280
  set_assistant_buttons_state (assistant);
2260
2281
}
2261
2282
 
 
2283
/**
 
2284
 * gtk_assistant_commit:
 
2285
 * @assistant: a #GtkAssistant
 
2286
 *
 
2287
 * Erases the visited page history so the back button is not
 
2288
 * shown on the current page, and removes the cancel button
 
2289
 * from subsequent pages.
 
2290
 *
 
2291
 * Use this when the information provided up to the current
 
2292
 * page is hereafter deemed permanent and cannot be modified
 
2293
 * or undone.  For example, showing a progress page to track
 
2294
 * a long-running, unreversible operation after the user has
 
2295
 * clicked apply on a confirmation page.
 
2296
 *
 
2297
 * Since: 2.22
 
2298
 **/
 
2299
void
 
2300
gtk_assistant_commit (GtkAssistant *assistant)
 
2301
{
 
2302
  g_return_if_fail (GTK_IS_ASSISTANT (assistant));
 
2303
 
 
2304
  g_slist_free (assistant->priv->visited_pages);
 
2305
  assistant->priv->visited_pages = NULL;
 
2306
 
 
2307
  assistant->priv->committed = TRUE;
 
2308
 
 
2309
  set_assistant_buttons_state (assistant);
 
2310
}
 
2311
 
2262
2312
 
2263
2313
 
2264
2314
/* accessible implementation */