12 #include <yui/Libyui_config.h> 13 #include "ygtkwizard.h" 16 #include <gdk/gdkkeysyms.h> 18 #include "ygtkhtmlwrap.h" 19 #include "ygtksteps.h" 20 #include "ygtklinklabel.h" 27 extern char *ygutils_mapKBAccel (
const char *src);
28 extern void ygutils_setWidgetFont (GtkWidget *widget, PangoStyle style,
29 PangoWeight weight,
double scale);
30 extern void ygutils_setPaneRelPosition (GtkWidget *paned, gdouble rel);
31 extern const char *ygutils_setStockIcon (GtkWidget *button,
const char *label,
32 const char *fallbackIcon);
33 extern GdkPixbuf *ygutils_setOpacity (
const GdkPixbuf *src,
int opacity, gboolean alpha);
34 extern void ygdialog_setTitle (
const gchar *title, gboolean sticky);
35 extern gchar *ygutils_headerize_help (
const char *help_text, gboolean *cut);
44 const gchar *text = gtk_entry_get_text (GTK_ENTRY (dialog->search_entry));
45 ygtk_html_wrap_search_next (dialog->help_text, text);
48 static void search_entry_changed_cb (GtkEditable *editable,
YGtkHelpDialog *dialog)
50 static GdkRGBA red = { 1.0, 0.4, 0.4, 1.0 };
51 static GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 };
52 static GdkRGBA yellow = { 0.9686, 0.9686, 0.7411 };
53 static GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
55 GtkWidget *widget = GTK_WIDGET (editable);
56 GtkEntry *entry = GTK_ENTRY (editable);
57 const gchar *text = gtk_entry_get_text (entry);
58 gboolean found = ygtk_html_wrap_search (dialog->help_text, text);
61 gtk_widget_override_background_color (widget, GTK_STATE_NORMAL, &yellow);
62 gtk_widget_override_color (widget, GTK_STATE_NORMAL, &black);
65 gtk_widget_override_background_color (widget, GTK_STATE_NORMAL, NULL);
66 gtk_widget_override_color (widget, GTK_STATE_NORMAL, NULL);
69 gtk_widget_override_background_color (widget, GTK_STATE_NORMAL, &red);
70 gtk_widget_override_color (widget, GTK_STATE_NORMAL, &white);
71 gtk_widget_error_bell (widget);
74 gboolean showIcon = *text;
75 if (showIcon != gtk_entry_get_icon_activatable (entry, GTK_ENTRY_ICON_SECONDARY)) {
76 gtk_entry_set_icon_activatable (entry,
77 GTK_ENTRY_ICON_SECONDARY, showIcon);
78 gtk_entry_set_icon_from_icon_name( entry,
79 GTK_ENTRY_ICON_SECONDARY, showIcon ?
"edit-clear" : NULL);
82 gtk_entry_set_icon_tooltip_text (entry,
83 GTK_ENTRY_ICON_SECONDARY, _(
"Clear"));
87 static void search_entry_icon_press_cb (GtkEntry *entry, GtkEntryIconPosition pos,
90 if (pos == GTK_ENTRY_ICON_PRIMARY)
91 gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
93 gtk_entry_set_text (entry,
"");
94 gtk_widget_grab_focus (GTK_WIDGET (entry));
97 static void search_entry_activated_cb (GtkEntry *entry,
YGtkHelpDialog *dialog)
98 { ygtk_help_dialog_find_next (dialog); }
100 static void close_button_clicked_cb (GtkButton *button,
YGtkHelpDialog *dialog)
101 { gtk_widget_hide (GTK_WIDGET (dialog)); }
105 gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
106 gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
107 gtk_window_set_title (GTK_WINDOW (dialog), _(
"Help"));
109 GdkPixbuf *icon = gtk_icon_theme_load_icon (gtk_icon_theme_get_default(),
110 "help-contents", GTK_ICON_SIZE_MENU, 0, NULL);
111 gtk_window_set_icon (GTK_WINDOW (dialog), icon);
112 g_object_unref (G_OBJECT (icon));
113 gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 450);
116 dialog->help_box = gtk_scrolled_window_new (NULL, NULL);
117 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (dialog->help_box),
118 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
119 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (dialog->help_box),
121 dialog->help_text = ygtk_html_wrap_new();
122 gtk_container_add (GTK_CONTAINER (dialog->help_box), dialog->help_text);
124 #if 0 // show a nice background image 125 GtkIconTheme *theme = gtk_icon_theme_get_default();
126 GtkIconInfo *info = gtk_icon_theme_lookup_icon (theme, HELP_IMG_BG, 192, 0);
128 GdkPixbuf *pixbuf = gtk_icon_info_load_icon (info, NULL);
130 const gchar *filename = gtk_icon_info_get_filename (info);
131 GdkPixbuf *transparent = ygutils_setOpacity (pixbuf, 60, FALSE);
132 ygtk_html_wrap_set_background (dialog->help_text, transparent, filename);
133 g_object_unref (pixbuf);
134 g_object_unref (transparent);
136 gtk_icon_info_free (info);
141 dialog->search_entry = gtk_entry_new();
142 gtk_widget_set_size_request (dialog->search_entry, 140, -1);
143 gtk_entry_set_icon_from_icon_name( GTK_ENTRY (dialog->search_entry),
144 GTK_ENTRY_ICON_PRIMARY,
"edit-find");
146 gtk_entry_set_icon_activatable (GTK_ENTRY (dialog->search_entry),
147 GTK_ENTRY_ICON_PRIMARY, TRUE);
148 g_signal_connect (G_OBJECT (dialog->search_entry),
"icon-press",
149 G_CALLBACK (search_entry_icon_press_cb), dialog);
150 g_signal_connect (G_OBJECT (dialog->search_entry),
"changed",
151 G_CALLBACK (search_entry_changed_cb), dialog);
152 g_signal_connect (G_OBJECT (dialog->search_entry),
"activate",
153 G_CALLBACK (search_entry_activated_cb), dialog);
155 dialog->close_button = gtk_button_new_with_label(_(
"Close"));
156 gtk_widget_set_can_default(dialog->close_button, TRUE);
158 GtkWidget *close_box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
159 gtk_container_add (GTK_CONTAINER (close_box), dialog->close_button);
161 char *label_str = ygutils_mapKBAccel (_(
"&Find:"));
162 GtkWidget *bottom_box, *label = gtk_label_new_with_mnemonic (label_str);
164 gtk_misc_set_alignment (GTK_MISC (label), 0, .5);
165 gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->search_entry);
167 bottom_box = YGTK_HBOX_NEW(2);
168 gtk_box_set_homogeneous (GTK_BOX (bottom_box), FALSE);
170 gtk_box_pack_start (GTK_BOX (bottom_box), label, FALSE, FALSE, 0);
171 gtk_box_pack_start (GTK_BOX (bottom_box), dialog->search_entry, FALSE, FALSE, 0);
172 gtk_box_pack_end (GTK_BOX (bottom_box), close_box, FALSE, FALSE, 0);
174 #ifdef SET_HELP_HISTORY 175 dialog->history_combo = gtk_combo_box_new_text();
176 GList *cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (dialog->history_combo));
177 g_object_set (G_OBJECT (cells->data),
"ellipsize", PANGO_ELLIPSIZE_END, NULL);
182 dialog->vbox = YGTK_VBOX_NEW(6);
183 gtk_box_set_homogeneous (GTK_BOX (dialog->vbox), FALSE);
185 #ifdef SET_HELP_HISTORY 186 GtkWidget *hbox = YGTK_HBOX_NEW(6);
187 gtk_box_set_homogeneous (GTK_BOX (bottom_box), FALSE);
189 gtk_box_pack_start (GTK_BOX (hbox), gtk_image_new_from_stock (GTK_STOCK_HELP, GTK_ICON_SIZE_BUTTON), FALSE, TRUE, 0);
190 gtk_box_pack_start (GTK_BOX (hbox), dialog->history_combo, TRUE, TRUE, 0);
191 gtk_box_pack_start (GTK_BOX (dialog->vbox), hbox, FALSE, TRUE, 0);
193 gtk_box_pack_start (GTK_BOX (dialog->vbox), dialog->help_box, TRUE, TRUE, 0);
194 gtk_box_pack_start (GTK_BOX (dialog->vbox), bottom_box, FALSE, TRUE, 0);
195 gtk_container_add (GTK_CONTAINER (dialog), dialog->vbox);
196 gtk_widget_show_all (dialog->vbox);
198 g_signal_connect (G_OBJECT (dialog->close_button),
"clicked",
199 G_CALLBACK (close_button_clicked_cb), dialog);
200 g_signal_connect (G_OBJECT (dialog),
"delete-event",
201 G_CALLBACK (gtk_widget_hide_on_delete), NULL);
204 static void ygtk_help_dialog_realize (GtkWidget *widget)
206 GTK_WIDGET_CLASS (ygtk_help_dialog_parent_class)->realize (widget);
210 gtk_widget_grab_default (dialog->close_button);
214 { gtk_widget_hide (GTK_WIDGET (dialog)); }
216 GtkWidget *ygtk_help_dialog_new (GtkWindow *parent)
218 GtkWidget *dialog = g_object_new (YGTK_TYPE_HELP_DIALOG, NULL);
220 gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
224 void ygtk_help_dialog_set_text (
YGtkHelpDialog *dialog,
const gchar *text)
226 gtk_editable_delete_text (GTK_EDITABLE (dialog->search_entry), 0, -1);
227 ygtk_html_wrap_set_text (dialog->help_text, text, FALSE);
228 ygtk_html_wrap_scroll (dialog->help_text, TRUE);
233 klass->find_next = ygtk_help_dialog_find_next;
234 klass->close = ygtk_help_dialog_close;
236 GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
237 widget_class->realize = ygtk_help_dialog_realize;
240 g_signal_new (
"find_next", G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)),
241 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
243 NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
244 g_signal_new (
"close", G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)),
245 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
247 NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
249 GtkBindingSet *binding_set = gtk_binding_set_by_class (klass);
250 gtk_binding_entry_add_signal (binding_set, GDK_KEY_F3, 0,
"find_next", 0);
251 gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0,
"close", 0);
254 #ifdef SET_HELP_HISTORY 255 typedef struct TitleTextPair {
265 #ifdef SET_HELP_HISTORY 268 for (i = help->history; i; i = i->next) {
269 TitleTextPair *pair = i->data;
270 g_free (pair->title);
274 g_list_free (help->history);
284 gtk_widget_destroy (help->dialog);
289 #ifdef SET_HELP_HISTORY 290 static gint compare_links (gconstpointer pa, gconstpointer pb)
292 const TitleTextPair *a = pa, *b = pb;
293 return strcmp (a->text, b->text);
297 void ygtk_help_text_set (
YGtkHelpText *help,
const gchar *title,
const gchar *text)
300 #ifdef SET_HELP_HISTORY 301 TitleTextPair *pair = g_new (TitleTextPair, 1);
303 pair->title = g_strdup (title);
305 gboolean in_tag = FALSE;
306 GString *str = g_string_new (
"");
308 for (i = text; *i; i++) {
313 else if (*i ==
'\n') {
318 str = g_string_append_c (str, *i);
320 pair->title = g_string_free (str, FALSE);
322 pair->text = g_strdup (text);
324 GList *i = g_list_find_custom (help->history, pair, (GCompareFunc) compare_links);
326 TitleTextPair *p = i->data;
330 help->history = g_list_delete_link (help->history, i);
332 help->history = g_list_prepend (help->history, pair);
336 help->text = g_strdup (text);
339 ygtk_help_text_sync (help, NULL);
342 const gchar *ygtk_help_text_get (
YGtkHelpText *help, gint n)
344 #ifdef SET_HELP_HISTORY 345 TitleTextPair *pair = g_list_nth_data (help->history, n);
354 #ifdef SET_HELP_HISTORY 355 static void history_changed_cb (GtkComboBox *combo,
YGtkHelpText *text)
358 gint active = gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->history_combo));
359 ygtk_help_dialog_set_text (dialog, ygtk_help_text_get (text, active));
363 void ygtk_help_text_sync (
YGtkHelpText *help, GtkWidget *widget)
369 #ifdef SET_HELP_HISTORY 370 dialog = YGTK_HELP_DIALOG (widget);
371 g_signal_connect (G_OBJECT (dialog->history_combo),
"changed",
372 G_CALLBACK (history_changed_cb), help);
374 help->dialog = widget;
376 dialog = YGTK_HELP_DIALOG (help->dialog);
377 ygtk_help_dialog_set_text (dialog, ygtk_help_text_get (help, 0));
379 #ifdef SET_HELP_HISTORY 380 g_signal_handlers_block_by_func (dialog->history_combo, history_changed_cb, help);
381 GtkListStore *store = GTK_LIST_STORE (gtk_combo_box_get_model (
382 GTK_COMBO_BOX (dialog->history_combo)));
383 gtk_list_store_clear (store);
385 for (i = help->history; i; i = i->next) {
386 TitleTextPair *pair = i->data;
387 gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->history_combo), pair->title);
389 gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->history_combo), 0);
390 g_signal_handlers_unblock_by_func (dialog->history_combo, history_changed_cb, help);
400 GtkWidget *title, *description, *icon, *description_more;
401 gint press_x, press_y;
406 GtkEventBoxClass parent_class;
411 static guint more_clicked_signal;
413 #define YGTK_TYPE_WIZARD_HEADER (ygtk_wizard_header_get_type ()) 414 #define YGTK_WIZARD_HEADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ 415 YGTK_TYPE_WIZARD_HEADER, YGtkWizardHeader)) 416 #define YGTK_WIZARD_HEADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \ 417 YGTK_TYPE_WIZARD_HEADER, YGtkWizardHeaderClass)) 418 #define YGTK_IS_WIZARD_HEADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ 419 YGTK_TYPE_WIZARD_HEADER)) 420 #define YGTK_IS_WIZARD_HEADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ 421 YGTK_TYPE_WIZARD_HEADER)) 422 #define YGTK_WIZARD_HEADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ 423 YGTK_TYPE_WIZARD_HEADER, YGtkWizardHeaderClass)) 425 static GtkWidget *ygtk_wizard_header_new (
void);
426 static GType ygtk_wizard_header_get_type (
void) G_GNUC_CONST;
432 g_signal_emit (header, more_clicked_signal, 0, NULL);
437 GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 };
438 gtk_widget_override_background_color (GTK_WIDGET (header), GTK_STATE_NORMAL, &white);
440 header->title = gtk_label_new (
"");
441 gtk_label_set_ellipsize (GTK_LABEL (header->title), PANGO_ELLIPSIZE_END);
442 gtk_misc_set_alignment (GTK_MISC (header->title), 0, 0.5);
443 ygutils_setWidgetFont (header->title, PANGO_STYLE_NORMAL, PANGO_WEIGHT_BOLD,
444 PANGO_SCALE_X_LARGE);
445 GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
446 gtk_widget_override_color (header->title, GTK_STATE_NORMAL, &black);
448 header->description = ygtk_link_label_new (
"", _(
"more"));
449 g_signal_connect (G_OBJECT (header->description),
"link-clicked",
450 G_CALLBACK (description_link_clicked_cb), header);
451 gtk_widget_override_color (header->description, GTK_STATE_NORMAL, &black);
453 header->icon = gtk_image_new();
455 GtkWidget *text_box = YGTK_VBOX_NEW(0);
456 gtk_box_set_homogeneous (GTK_BOX (text_box), FALSE);
458 gtk_box_pack_start (GTK_BOX (text_box), header->title, TRUE, TRUE, 0);
459 gtk_box_pack_start (GTK_BOX (text_box), header->description, FALSE, TRUE, 0);
461 GtkWidget *title_box = YGTK_HBOX_NEW(10);
462 gtk_box_set_homogeneous (GTK_BOX (title_box), FALSE);
464 gtk_box_pack_start (GTK_BOX (title_box), header->icon, FALSE, TRUE, 4);
465 gtk_box_pack_start (GTK_BOX (title_box), text_box, TRUE, TRUE, 0);
466 gtk_container_set_border_width (GTK_CONTAINER (title_box), 6);
468 GtkWidget *box = YGTK_VBOX_NEW(0);
469 gtk_box_set_homogeneous (GTK_BOX (box), FALSE);
471 gtk_box_pack_start (GTK_BOX (box), title_box, TRUE, TRUE, 0);
472 gtk_box_pack_start (GTK_BOX (box), gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), FALSE, TRUE, 0);
473 gtk_widget_show_all (box);
474 gtk_container_add (GTK_CONTAINER (header), box);
477 static gboolean ygtk_wizard_header_button_press_event (GtkWidget *widget, GdkEventButton *event)
479 if (event->button == 1) {
480 GdkCursor *cursor = gdk_cursor_new (GDK_FLEUR);
481 gdk_window_set_cursor (event->window, cursor);
482 g_object_unref (cursor);
485 header->press_x =
event->x;
486 header->press_y =
event->y;
491 static gboolean ygtk_wizard_header_button_release_event (GtkWidget *widget, GdkEventButton *event)
493 if (event->button == 1)
494 gdk_window_set_cursor (event->window, NULL);
498 static gboolean ygtk_wizard_header_motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
500 if (event->state & GDK_BUTTON1_MASK) {
502 gint root_x, root_y, pointer_x, pointer_y;
503 gdk_window_get_root_origin (event->window, &root_x, &root_y);
505 GdkDisplay *display = gdk_window_get_display (event->window);
506 GdkDeviceManager *device_manager = gdk_display_get_device_manager (display);
507 GdkDevice *pointer = gdk_device_manager_get_client_pointer (device_manager);
508 gdk_window_get_device_position (event->window, pointer, &pointer_x, &pointer_y, NULL);
510 gint x = pointer_x + root_x - header->press_x;
511 gint y = pointer_y + root_y - header->press_y;
513 GtkWidget *top_window = gtk_widget_get_toplevel (widget);
514 gtk_window_move (GTK_WINDOW (top_window), x, y);
519 GtkWidget *ygtk_wizard_header_new()
520 {
return g_object_new (YGTK_TYPE_WIZARD_HEADER, NULL); }
524 ygtk_wizard_header_parent_class = g_type_class_peek_parent (klass);
526 GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
527 widget_class->button_press_event = ygtk_wizard_header_button_press_event;
528 widget_class->button_release_event = ygtk_wizard_header_button_release_event;
529 widget_class->motion_notify_event = ygtk_wizard_header_motion_notify_event;
531 more_clicked_signal = g_signal_new (
"more-clicked",
532 G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)), G_SIGNAL_RUN_LAST,
534 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
537 static void ygtk_wizard_header_set_title (
YGtkWizardHeader *header,
const gchar *text)
538 { gtk_label_set_text (GTK_LABEL (header->title), text); }
541 {
return gtk_label_get_text (GTK_LABEL (header->title)); }
543 static void ygtk_wizard_header_set_description (
YGtkWizardHeader *header,
const gchar *text)
545 gboolean cut = FALSE;
546 gchar *desc = ygutils_headerize_help (text, &cut);
547 ygtk_link_label_set_text (YGTK_LINK_LABEL (header->description), desc, NULL, cut);
551 static void ygtk_wizard_header_set_icon (
YGtkWizardHeader *header, GdkPixbuf *pixbuf)
552 { gtk_image_set_from_pixbuf (GTK_IMAGE (header->icon), pixbuf); }
557 static void destroy_tree_path (gpointer data)
559 GtkTreePath *path = data;
560 gtk_tree_path_free (path);
564 static guint action_triggered_signal;
566 static void ygtk_marshal_VOID__POINTER_INT (GClosure *closure,
567 GValue *return_value, guint n_param_values,
const GValue *param_values,
568 gpointer invocation_hint, gpointer marshal_data)
570 typedef void (*GMarshalFunc_VOID__POINTER_INT) (gpointer data1, gpointer arg_1,
571 gint arg_2, gpointer data2);
572 register GMarshalFunc_VOID__POINTER_INT callback;
573 register GCClosure *cc = (GCClosure*) closure;
574 register gpointer data1, data2;
576 g_return_if_fail (n_param_values == 3);
578 if (G_CCLOSURE_SWAP_DATA (closure)) {
579 data1 = closure->data;
580 data2 = g_value_peek_pointer (param_values + 0);
583 data1 = g_value_peek_pointer (param_values + 0);
584 data2 = closure->data;
586 callback = (GMarshalFunc_VOID__POINTER_INT)
587 (marshal_data ? marshal_data : cc->callback);
589 callback (data1, g_value_get_pointer (param_values + 1),
590 g_value_get_int (param_values + 2), data2);
593 static void button_clicked_cb (GtkButton *button,
YGtkWizard *wizard)
596 id = g_object_get_data (G_OBJECT (button),
"ptr-id");
598 g_signal_emit (wizard, action_triggered_signal, 0,
id, G_TYPE_POINTER);
599 id = g_object_get_data (G_OBJECT (button),
"str-id");
601 g_signal_emit (wizard, action_triggered_signal, 0,
id, G_TYPE_STRING);
604 static GtkWidget *button_new (
YGtkWizard *wizard)
606 GtkWidget *button = gtk_button_new_with_mnemonic (
"");
607 gtk_widget_set_can_default(button, TRUE);
608 g_signal_connect (G_OBJECT (button),
"clicked",
609 G_CALLBACK (button_clicked_cb), wizard);
613 static GtkWidget *create_help_button()
615 GtkWidget *button, *image;
616 button = gtk_toggle_button_new();
617 gtk_button_set_label (GTK_BUTTON (button), _(
"Help"));
618 gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
619 image = gtk_image_new_from_icon_name (
"help-contents", GTK_ICON_SIZE_BUTTON);
620 gtk_button_set_always_show_image(GTK_BUTTON (button), 1);
621 gtk_button_set_image (GTK_BUTTON (button), image);
625 static void ygtk_wizard_popup_help (
YGtkWizard *wizard);
626 static void help_button_toggled_cb (GtkToggleButton *button,
YGtkWizard *wizard)
628 if (gtk_toggle_button_get_active (button))
629 ygtk_wizard_popup_help (wizard);
630 else if (wizard->m_help->dialog)
631 gtk_widget_hide (wizard->m_help->dialog);
633 static void help_button_silent_set_active (
YGtkWizard *wizard, gboolean active)
635 if (!wizard->help_button)
return;
636 GtkToggleButton *button = GTK_TOGGLE_BUTTON (wizard->help_button);
637 g_signal_handlers_block_by_func (button,
638 (gpointer) help_button_toggled_cb, wizard);
639 gtk_toggle_button_set_active (button, active);
640 g_signal_handlers_unblock_by_func (button,
641 (gpointer) help_button_toggled_cb, wizard);
643 static void help_dialog_unmap_cb (GtkWidget *dialog,
YGtkWizard *wizard)
644 { help_button_silent_set_active (wizard, FALSE); }
646 static void ygtk_wizard_popup_help (
YGtkWizard *wizard)
648 if (!wizard->m_help->dialog) {
649 GtkWindow *window = (GtkWindow *) gtk_widget_get_ancestor (
650 GTK_WIDGET (wizard), GTK_TYPE_WINDOW);
651 GtkWidget *dialog = ygtk_help_dialog_new (window);
652 g_signal_connect (G_OBJECT (dialog),
"unmap",
653 G_CALLBACK (help_dialog_unmap_cb), wizard);
654 ygtk_help_text_sync (wizard->m_help, dialog);
656 help_button_silent_set_active (wizard, TRUE);
657 gtk_window_present (GTK_WINDOW (wizard->m_help->dialog));
661 { ygtk_wizard_popup_help (wizard); }
665 static void buttons_size_allocate_cb (GtkWidget *box, GtkAllocation *alloc,
668 GSList *buttons = gtk_size_group_get_widgets (group), *i;
669 int max_width = 0, total = 0;
670 for (i = buttons; i; i = i->next) {
671 if (!gtk_widget_get_visible (i->data))
674 gtk_widget_get_preferred_size ((GtkWidget *) i->data, &req, NULL);
675 max_width = MAX (max_width, req.width);
678 int spacing = gtk_box_get_spacing (GTK_BOX (box));
679 int width = max_width*total + (total ? spacing*(total-1) : 0);
680 GtkSizeGroupMode new_mode = width > alloc->width ?
681 GTK_SIZE_GROUP_VERTICAL : GTK_SIZE_GROUP_BOTH;
682 if (gtk_size_group_get_mode (group) != new_mode)
683 gtk_size_group_set_mode (group, new_mode);
686 G_DEFINE_TYPE (
YGtkWizard, ygtk_wizard, GTK_TYPE_BOX)
688 static void ygtk_wizard_init (
YGtkWizard *wizard)
690 wizard->menu_ids = g_hash_table_new_full (g_str_hash, g_str_equal,
692 wizard->tree_ids = g_hash_table_new_full (g_str_hash, g_str_equal,
693 g_free, destroy_tree_path);
694 wizard->steps_ids = g_hash_table_new_full (g_str_hash, g_str_equal,
697 gtk_orientable_set_orientation (GTK_ORIENTABLE (wizard), GTK_ORIENTATION_VERTICAL);
700 wizard->m_title = ygtk_wizard_header_new();
701 g_signal_connect (G_OBJECT (wizard->m_title),
"more-clicked",
702 G_CALLBACK (more_clicked_cb), wizard);
703 gtk_widget_show_all (wizard->m_title);
706 wizard->next_button = button_new (wizard);
707 wizard->back_button = button_new (wizard);
708 wizard->abort_button = button_new (wizard);
709 wizard->release_notes_button = button_new (wizard);
710 wizard->help_button = create_help_button();
711 g_signal_connect (G_OBJECT (wizard->help_button),
"toggled",
712 G_CALLBACK (help_button_toggled_cb), wizard);
714 wizard->m_buttons = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
715 gtk_button_box_set_layout (GTK_BUTTON_BOX (wizard->m_buttons), GTK_BUTTONBOX_END);
716 gtk_box_set_spacing (GTK_BOX (wizard->m_buttons), 6);
717 gtk_widget_show (wizard->m_buttons);
718 gtk_box_pack_start (GTK_BOX (wizard->m_buttons), wizard->help_button, FALSE, TRUE, 0);
719 gtk_box_pack_start (GTK_BOX (wizard->m_buttons), wizard->release_notes_button,
721 gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (wizard->m_buttons), wizard->help_button, TRUE);
722 gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (wizard->m_buttons), wizard->release_notes_button, TRUE);
724 gtk_box_pack_end (GTK_BOX (wizard->m_buttons), wizard->abort_button, FALSE, TRUE, 0);
725 gtk_box_pack_end (GTK_BOX (wizard->m_buttons), wizard->back_button, FALSE, TRUE, 0);
726 gtk_box_pack_end (GTK_BOX (wizard->m_buttons), wizard->next_button, FALSE, TRUE, 0);
729 GtkSizeGroup *buttons_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
730 gtk_size_group_add_widget (buttons_group, wizard->help_button);
731 gtk_size_group_add_widget (buttons_group, wizard->release_notes_button);
732 gtk_size_group_add_widget (buttons_group, wizard->next_button);
733 gtk_size_group_add_widget (buttons_group, wizard->back_button);
734 gtk_size_group_add_widget (buttons_group, wizard->abort_button);
735 g_object_unref (G_OBJECT (buttons_group));
736 gtk_widget_set_size_request (wizard->m_buttons, 0, -1);
737 g_signal_connect_after (G_OBJECT (wizard->m_buttons),
"size-allocate",
738 G_CALLBACK (buttons_size_allocate_cb), buttons_group);
739 wizard->m_default_button = NULL;
743 wizard->m_menu_box = gtk_event_box_new();
744 wizard->m_info_box = gtk_event_box_new();
745 wizard->m_status_box = gtk_event_box_new();
747 wizard->m_pane = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
748 gtk_widget_show (wizard->m_pane);
750 wizard->m_contents_box = YGTK_HBOX_NEW(6);
751 gtk_box_set_homogeneous (GTK_BOX (wizard->m_contents_box), FALSE);
753 gtk_box_pack_start (GTK_BOX (wizard->m_contents_box), wizard->m_info_box, FALSE, TRUE, 0);
754 gtk_box_pack_start (GTK_BOX (wizard->m_contents_box), wizard->m_pane, TRUE, TRUE, 0);
755 gtk_widget_show (wizard->m_contents_box);
758 vbox = YGTK_VBOX_NEW(12);
759 gtk_box_set_homogeneous (GTK_BOX (vbox), FALSE);
761 gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
762 gtk_box_pack_start (GTK_BOX (vbox), wizard->m_contents_box, TRUE, TRUE, 0);
764 GtkWidget *hsep = gtk_hseparator_new();
765 gtk_box_pack_start (GTK_BOX (vbox), hsep, FALSE, TRUE, 0);
766 gtk_widget_show (hsep);
768 gtk_box_pack_start (GTK_BOX (vbox), wizard->m_buttons, FALSE, TRUE, 0);
769 gtk_widget_show (vbox);
771 gtk_box_pack_start (GTK_BOX (wizard), wizard->m_menu_box, FALSE, TRUE, 0);
772 gtk_box_pack_start (GTK_BOX (wizard), wizard->m_title, FALSE, TRUE, 0);
773 gtk_box_pack_start (GTK_BOX (wizard), vbox, TRUE, TRUE, 0);
774 gtk_box_pack_start (GTK_BOX (wizard), wizard->m_status_box, FALSE, TRUE, 0);
778 static void ygtk_wizard_realize (GtkWidget *widget)
780 GTK_WIDGET_CLASS (ygtk_wizard_parent_class)->realize (widget);
782 if (wizard->m_default_button) {
783 GtkWidget *window = gtk_widget_get_toplevel (widget);
784 if (GTK_IS_WINDOW (window))
785 if (!gtk_window_get_default_widget (GTK_WINDOW (window)))
786 gtk_widget_grab_default (wizard->m_default_button);
790 static void ygtk_wizard_map (GtkWidget *widget)
792 GTK_WIDGET_CLASS (ygtk_wizard_parent_class)->map (widget);
796 const gchar *title = gtk_label_get_text (GTK_LABEL (header->title));
797 ygdialog_setTitle (title, FALSE);
800 static gboolean clear_hash_cb (gpointer key, gpointer value, gpointer data)
802 static void clear_hash (GHashTable *hash_table)
804 g_hash_table_foreach_remove (hash_table, clear_hash_cb, NULL);
806 static void destroy_hash (GHashTable **hash, gboolean is_tree)
809 g_hash_table_destroy (*hash);
813 static void ygtk_wizard_finalize (GObject *
object)
816 wizard->help_button = NULL;
817 destroy_hash (&wizard->menu_ids, FALSE);
818 destroy_hash (&wizard->tree_ids, TRUE);
819 destroy_hash (&wizard->steps_ids, FALSE);
820 if (wizard->m_help) {
821 ygtk_help_text_destroy (wizard->m_help);
822 wizard->m_help = NULL;
824 G_OBJECT_CLASS (ygtk_wizard_parent_class)->finalize (
object);
827 GtkWidget *ygtk_wizard_new (
void)
828 {
return g_object_new (YGTK_TYPE_WIZARD, NULL); }
830 static void selected_menu_item_cb (GtkMenuItem *item,
const char *
id)
832 YGtkWizard *wizard = g_object_get_data (G_OBJECT (item),
"wizard");
833 g_signal_emit (wizard, action_triggered_signal, 0,
id, G_TYPE_STRING);
836 static void tree_item_selected_cb (GtkTreeView *tree_view,
YGtkWizard *wizard)
838 const gchar *
id = ygtk_wizard_get_tree_selection (wizard);
840 g_signal_emit (wizard, action_triggered_signal, 0,
id, G_TYPE_STRING);
843 void ygtk_wizard_set_child (
YGtkWizard *wizard, GtkWidget *child)
846 gtk_container_remove (GTK_CONTAINER (wizard->m_pane), wizard->m_child);
847 wizard->m_child = child;
849 gtk_paned_pack2 (GTK_PANED (wizard->m_pane), child, TRUE, TRUE);
852 void ygtk_wizard_set_information_widget (
YGtkWizard *wizard, GtkWidget *widget)
854 GtkWidget *hbox = YGTK_HBOX_NEW(2);
855 gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
857 GtkWidget *sep = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
858 gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
859 gtk_box_pack_start (GTK_BOX (hbox), sep, FALSE, TRUE, 0);
860 gtk_container_add (GTK_CONTAINER (wizard->m_info_box), hbox);
861 gtk_widget_show_all (wizard->m_info_box);
864 void ygtk_wizard_set_control_widget (
YGtkWizard *wizard, GtkWidget *widget)
866 gtk_paned_pack1 (GTK_PANED (wizard->m_pane), widget, FALSE, TRUE);
869 void ygtk_wizard_enable_steps (
YGtkWizard *wizard)
871 g_return_if_fail (wizard->steps == NULL);
872 wizard->steps = ygtk_steps_new();
873 ygtk_wizard_set_information_widget (wizard, wizard->steps);
876 void ygtk_wizard_enable_tree (
YGtkWizard *wizard)
878 g_return_if_fail (wizard->tree_view == NULL);
880 wizard->tree_view = gtk_tree_view_new_with_model
881 (GTK_TREE_MODEL (gtk_tree_store_new (1, G_TYPE_STRING)));
882 GtkTreeView *view = GTK_TREE_VIEW (wizard->tree_view);
883 gtk_tree_view_insert_column_with_attributes (view,
884 0,
"", gtk_cell_renderer_text_new(),
"text", 0, NULL);
885 gtk_tree_view_set_headers_visible (view, FALSE);
886 gtk_tree_selection_set_mode (gtk_tree_view_get_selection (view), GTK_SELECTION_BROWSE);
887 g_signal_connect (G_OBJECT (wizard->tree_view),
"cursor-changed",
888 G_CALLBACK (tree_item_selected_cb), wizard);
890 gtk_tree_view_set_show_expanders (view, FALSE);
892 GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL);
893 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
894 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
895 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
898 gtk_container_add (GTK_CONTAINER (scroll), wizard->tree_view);
899 gtk_widget_show_all (scroll);
901 ygtk_wizard_set_control_widget (wizard, scroll);
902 ygutils_setPaneRelPosition (wizard->m_pane, .30);
905 #define ENABLE_WIDGET(enable, widget) \ 906 (enable ? gtk_widget_show (widget) : gtk_widget_hide (widget)) 907 #define ENABLE_WIDGET_STR(str, widget) \ 908 (str && str[0] ? gtk_widget_show (widget) : gtk_widget_hide (widget)) 912 void ygtk_wizard_set_help_text (
YGtkWizard *wizard,
const gchar *text)
915 wizard->m_help = ygtk_help_text_new();
916 const gchar *title = ygtk_wizard_header_get_title (YGTK_WIZARD_HEADER (wizard->m_title));
917 ygtk_help_text_set (wizard->m_help, title, text);
920 ygtk_wizard_header_set_description (YGTK_WIZARD_HEADER (wizard->m_title), text);
921 ENABLE_WIDGET_STR (text, wizard->help_button);
924 gboolean ygtk_wizard_add_tree_item (
YGtkWizard *wizard,
const char *parent_id,
925 const char *text,
const char *
id)
927 GtkTreeView *view = GTK_TREE_VIEW (wizard->tree_view);
928 GtkTreeModel *model = gtk_tree_view_get_model (view);
931 if (!parent_id || !*parent_id)
932 gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL);
934 GtkTreePath *path = g_hash_table_lookup (wizard->tree_ids, parent_id);
937 gtk_tree_view_set_show_expanders (view, TRUE);
938 GtkTreeIter parent_iter;
939 gtk_tree_model_get_iter (model, &parent_iter, path);
940 gtk_tree_store_append (GTK_TREE_STORE (model), &iter, &parent_iter);
943 gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, text, -1);
944 g_hash_table_insert (wizard->tree_ids, g_strdup (
id),
945 gtk_tree_model_get_path (model, &iter));
949 void ygtk_wizard_clear_tree (
YGtkWizard *wizard)
951 GtkTreeView *tree = GTK_TREE_VIEW (wizard->tree_view);
952 gtk_tree_store_clear (GTK_TREE_STORE (gtk_tree_view_get_model (tree)));
953 clear_hash (wizard->tree_ids);
956 gboolean ygtk_wizard_select_tree_item (
YGtkWizard *wizard,
const char *
id)
958 GtkTreePath *path = g_hash_table_lookup (wizard->tree_ids,
id);
962 g_signal_handlers_block_by_func (wizard->tree_view,
963 (gpointer) tree_item_selected_cb, wizard);
965 GtkWidget *widget = wizard->tree_view;
966 gtk_tree_view_expand_to_path (GTK_TREE_VIEW (widget), path);
967 gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget), path,
969 gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (widget), path, NULL,
972 g_signal_handlers_unblock_by_func (wizard->tree_view,
973 (gpointer) tree_item_selected_cb, wizard);
977 void ygtk_wizard_set_header_text (
YGtkWizard *wizard,
const char *text)
980 ygtk_wizard_header_set_title (YGTK_WIZARD_HEADER (wizard->m_title), text);
983 gboolean ygtk_wizard_set_header_icon (
YGtkWizard *wizard,
const char *icon)
986 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (icon, &error);
989 ygtk_wizard_header_set_icon (YGTK_WIZARD_HEADER (wizard->m_title), pixbuf);
990 g_object_unref (G_OBJECT (pixbuf));
994 void ygtk_wizard_set_button_label (
YGtkWizard *wizard, GtkWidget *button,
995 const char *_label,
const char *stock)
997 const char *label = _label ? _label :
"";
998 gtk_button_set_label (GTK_BUTTON (button), label);
999 ENABLE_WIDGET_STR (label, button);
1000 if (button == wizard->abort_button)
1001 stock =
"application-exit";
1002 else if (button == wizard->release_notes_button)
1003 stock =
"edit-copy";
1005 const char *_stock = ygutils_setStockIcon (button, label, stock);
1006 g_object_set_data (G_OBJECT (button),
"icon-fallback", _stock ? 0 : GINT_TO_POINTER (1));
1009 void ygtk_wizard_set_button_str_id (
YGtkWizard *wizard, GtkWidget *button,
const char *
id)
1011 g_object_set_data_full (G_OBJECT (button),
"str-id", g_strdup (
id), g_free);
1014 void ygtk_wizard_set_button_ptr_id (
YGtkWizard *wizard, GtkWidget *button, gpointer
id)
1016 g_object_set_data (G_OBJECT (button),
"ptr-id",
id);
1019 void ygtk_wizard_set_default_button (
YGtkWizard *wizard, GtkWidget *button)
1020 { wizard->m_default_button = button; }
1022 void ygtk_wizard_enable_button (
YGtkWizard *wizard, GtkWidget *button, gboolean enable)
1024 gtk_widget_set_sensitive (button, enable);
1027 void ygtk_wizard_set_extra_button (
YGtkWizard *wizard, GtkWidget *widget)
1029 gtk_box_pack_start (GTK_BOX (wizard->m_buttons), widget, FALSE, TRUE, 0);
1032 void ygtk_wizard_add_menu (
YGtkWizard *wizard,
const char *text,
1035 if (!wizard->menu) {
1036 wizard->menu = gtk_menu_bar_new();
1037 ygtk_wizard_set_custom_menubar (wizard, wizard->menu, TRUE);
1038 gtk_widget_show (wizard->menu);
1041 GtkWidget *entry = gtk_menu_item_new_with_mnemonic (text);
1042 GtkWidget *submenu = gtk_menu_new();
1043 gtk_menu_item_set_submenu (GTK_MENU_ITEM (entry), submenu);
1044 gtk_menu_shell_append (GTK_MENU_SHELL (wizard->menu), entry);
1045 gtk_widget_show_all (entry);
1047 g_hash_table_insert (wizard->menu_ids, g_strdup (
id), submenu);
1050 gboolean ygtk_wizard_add_menu_entry (
YGtkWizard *wizard,
const char *parent_id,
1051 const char *text,
const char *
id)
1053 GtkWidget *parent = g_hash_table_lookup (wizard->menu_ids, parent_id);
1058 entry = gtk_menu_item_new_with_mnemonic (text);
1059 gtk_menu_shell_append (GTK_MENU_SHELL (parent), entry);
1060 gtk_widget_show (entry);
1063 g_object_set_data (G_OBJECT (entry),
"wizard", wizard);
1064 g_signal_connect_data (G_OBJECT (entry),
"activate",
1065 G_CALLBACK (selected_menu_item_cb), g_strdup (
id),
1066 (GClosureNotify) g_free, 0);
1070 gboolean ygtk_wizard_add_sub_menu (
YGtkWizard *wizard,
const char *parent_id,
1071 const char *text,
const char *
id)
1073 GtkWidget *parent = g_hash_table_lookup (wizard->menu_ids, parent_id);
1077 GtkWidget *entry = gtk_menu_item_new_with_mnemonic (text);
1078 GtkWidget *submenu = gtk_menu_new();
1079 gtk_menu_item_set_submenu (GTK_MENU_ITEM (entry), submenu);
1080 gtk_menu_shell_append (GTK_MENU_SHELL (parent), entry);
1081 gtk_widget_show_all (entry);
1083 g_hash_table_insert (wizard->menu_ids, g_strdup (
id), submenu);
1087 gboolean ygtk_wizard_add_menu_separator (
YGtkWizard *wizard,
const char *parent_id)
1089 GtkWidget *parent = g_hash_table_lookup (wizard->menu_ids, parent_id);
1093 GtkWidget *separator = gtk_separator_menu_item_new();
1094 gtk_menu_shell_append (GTK_MENU_SHELL (parent), separator);
1095 gtk_widget_show (separator);
1099 void ygtk_wizard_clear_menu (
YGtkWizard *wizard)
1103 clear_hash (wizard->menu_ids);
1104 GList *children = gtk_container_get_children (GTK_CONTAINER (wizard->menu)), *i;
1105 for (i = children; i; i = i->next) {
1106 GtkWidget *child = (GtkWidget *) i->data;
1107 gtk_container_remove (GTK_CONTAINER (wizard->menu), child);
1111 void ygtk_wizard_set_custom_menubar (
YGtkWizard *wizard, GtkWidget *menu_bar, gboolean hide_header)
1113 gtk_container_add (GTK_CONTAINER (wizard->m_menu_box), menu_bar);
1114 gtk_widget_show (wizard->m_menu_box);
1117 gtk_widget_hide (wizard->m_title);
1120 void ygtk_wizard_set_status_bar (
YGtkWizard *wizard, GtkWidget *status_bar)
1122 gtk_container_add (GTK_CONTAINER (wizard->m_status_box), status_bar);
1123 gtk_widget_show (wizard->m_status_box);
1126 void ygtk_wizard_add_step_header (
YGtkWizard *wizard,
const char *text)
1128 g_return_if_fail (wizard->steps != NULL);
1129 ygtk_steps_append_heading (YGTK_STEPS (wizard->steps), text);
1132 void ygtk_wizard_add_step (
YGtkWizard *wizard,
const char *text,
const char *
id)
1134 g_return_if_fail (wizard->steps != NULL);
1135 YGtkSteps *steps = YGTK_STEPS (wizard->steps);
1139 gint step_nb, last_n = ygtk_steps_total (steps)-1;
1140 const gchar *last = ygtk_steps_get_nth_label (steps, last_n);
1141 if (last && !strcmp (last, text))
1144 step_nb = ygtk_steps_append (steps, text);
1145 g_hash_table_insert (wizard->steps_ids, g_strdup (
id), GINT_TO_POINTER (step_nb));
1148 gboolean ygtk_wizard_set_current_step (
YGtkWizard *wizard,
const char *
id)
1152 gpointer step_nb = g_hash_table_lookup (wizard->steps_ids,
id);
1155 ygtk_steps_set_current (YGTK_STEPS (wizard->steps), GPOINTER_TO_INT (step_nb));
1159 gpointer step_nb, foo;
1160 if (!g_hash_table_lookup_extended (wizard->steps_ids,
id, &foo, &step_nb))
1162 ygtk_steps_set_current (YGTK_STEPS (wizard->steps), GPOINTER_TO_INT (step_nb));
1166 ygtk_steps_set_current (YGTK_STEPS (wizard->steps), -1);
1170 void ygtk_wizard_clear_steps (
YGtkWizard *wizard)
1172 ygtk_steps_clear (YGTK_STEPS (wizard->steps));
1173 clear_hash (wizard->steps_ids);
1176 static const gchar *found_key;
1177 static void hash_lookup_tree_path_value (gpointer _key, gpointer _value,
1181 GtkTreePath *value = _value;
1182 GtkTreePath *needle = user_data;
1184 if (gtk_tree_path_compare (value, needle) == 0)
1188 const gchar *ygtk_wizard_get_tree_selection (
YGtkWizard *wizard)
1191 gtk_tree_view_get_cursor (GTK_TREE_VIEW (wizard->tree_view), &path, NULL);
1192 if (path == NULL)
return NULL;
1197 g_hash_table_foreach (wizard->tree_ids, hash_lookup_tree_path_value, path);
1199 gtk_tree_path_free (path);
1205 ygtk_wizard_parent_class = g_type_class_peek_parent (klass);
1207 GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
1208 widget_class->realize = ygtk_wizard_realize;
1209 widget_class->map = ygtk_wizard_map;
1211 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
1212 gobject_class->finalize = ygtk_wizard_finalize;
1214 action_triggered_signal = g_signal_new (
"action-triggered",
1215 G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)), G_SIGNAL_RUN_LAST,
1217 NULL, NULL, ygtk_marshal_VOID__POINTER_INT, G_TYPE_NONE,
1218 2, G_TYPE_POINTER, G_TYPE_INT);
1221 klass->popup_help = ygtk_wizard_popup_help;
1222 g_signal_new (
"popup_help", G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)),
1223 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
1225 NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
1227 GtkBindingSet *binding_set = gtk_binding_set_by_class (klass);
1228 gtk_binding_entry_add_signal (binding_set, GDK_KEY_F1, 0,
"popup_help", 0);