1
/* gcompris - board_config.c
3
* Time-stamp: <2006/08/21 23:27:57 bruno>
5
* Copyright (C) 2001 Pascal Georges
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
#define COMBOBOX_COL_MAX 15
28
static GcomprisBoard *config_board;
31
gc_board_config_start(GcomprisBoard *aBoard, GcomprisProfile *aProfile)
34
if (aBoard->plugin == NULL){
35
g_warning("gc_board_config_start: board %s/%s is not initialised ? Hummmm...", aBoard->section,aBoard->name);
39
if (aBoard->plugin->config_start == NULL) {
40
g_warning("Trying to configure board %s/%s without config_start", aBoard->section,aBoard->name);
44
config_board = aBoard;
46
aBoard->plugin->config_start(aBoard, aProfile);
53
gc_board_config_stop()
58
config_board->plugin->config_stop();
64
static GtkWindow *conf_window = NULL;
65
static GtkVBox *main_conf_box = NULL;
66
static GHashTable *hash_conf = NULL;
67
static GcomprisConfCallback Confcallback = NULL;
68
static gchar *label_markup = NULL;
74
if ((strcmp(key, "locale") == 0) ||
75
(strcmp(key, "locale_sound") == 0) ||
76
(strcmp(key, "wordlist") == 0))
77
g_error(" Key %s forbiden ! Change !", key);
81
gc_board_conf_close (GtkDialog *dialog,
84
gtk_object_destroy(GTK_OBJECT(dialog));
85
g_hash_table_destroy (hash_conf);
88
/* in case we close without response */
98
_response_board_conf (GtkButton *button,
106
case GTK_RESPONSE_APPLY:
107
Confcallback(hash_conf);
109
case GTK_RESPONSE_CANCEL:
112
case GTK_RESPONSE_NONE:
123
gc_board_conf_close (GTK_DIALOG(conf_window), NULL);
128
static GdkEventConfigure last_configure_event;
131
_conf_window_configured(GtkWindow *window,
132
GdkEventConfigure *event, gpointer param)
135
double screen_width, screen_height;
136
/* Because we call gtk_window_move, we cause a configure event. Filter out
137
identical events to avoid looping. */
138
if (memcmp(&last_configure_event, event, sizeof(GdkEventConfigure)))
140
gnome_canvas_get_scroll_region( GNOME_CANVAS( gtk_bin_get_child( GTK_BIN(
141
gc_get_window()))), NULL, NULL, &screen_width, &screen_height);
142
/* strange but gcompris.c sets the scrollheight to screen_height + 30 */
144
new_x = ((gint)screen_width - event->width) / 2;
145
new_y = ((gint)screen_height - event->height) / 2;
146
/* printf("screen %dx%d, window %dx%d, place %dx%d\n", (int)screen_width, (int)screen_height, event->width, event->height, new_x, new_y); */
147
gtk_window_move (conf_window, new_x, new_y);
148
memcpy(&last_configure_event, event, sizeof(GdkEventConfigure));
151
/* Act as if we aren't there / aren't hooked up */
157
gc_board_config_window_display(gchar *label, GcomprisConfCallback callback)
161
/* init static values or callbacks */
162
Confcallback = callback;
163
hash_conf = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
165
/* Creating a config window will cause our main window to loose focus,
166
this tells the main window to ignore the next focus out event (and thus
167
stay in fullscreen mode if we're fullscreen). */
168
gc_ignore_next_focus_out();
170
/* main configuration window */
172
GTK_WINDOW(gtk_dialog_new_with_buttons ("GCompris",
173
GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET(gc_board_get_current()->canvas))),
174
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
184
if (gc_prop_get()->fullscreen &&
185
!gc_prop_get()->noxf86vm)
187
memset(&last_configure_event, 0, sizeof(GdkEventConfigure));
188
gtk_widget_add_events(GTK_WIDGET(conf_window), GDK_STRUCTURE_MASK);
189
gtk_signal_connect (GTK_OBJECT (conf_window), "configure_event",
190
GTK_SIGNAL_FUNC (_conf_window_configured), 0);
194
gtk_window_set_position (conf_window,
195
GTK_WIN_POS_CENTER_ALWAYS);
197
gtk_widget_show(GTK_WIDGET(conf_window));
199
GcomprisProperties *properties = gc_prop_get();
200
if (properties->fullscreen && !properties->noxf86vm)
201
if (gdk_pointer_grab(gc_get_window()->window, TRUE, 0,
202
gc_get_window()->window, NULL, GDK_CURRENT_TIME) !=
204
g_warning("Pointer grab failed");
206
/* main vbox in window */
207
main_conf_box = GTK_VBOX(GTK_DIALOG(conf_window)->vbox);
209
g_signal_connect(G_OBJECT(conf_window),
211
G_CALLBACK(_response_board_conf),
214
g_signal_connect (G_OBJECT(conf_window),
216
G_CALLBACK(gc_board_conf_close),
222
header = gtk_label_new ((gchar *)NULL);
223
gtk_widget_show(header);
224
gtk_box_pack_start (GTK_BOX(main_conf_box),
230
gtk_label_set_justify (GTK_LABEL(header),
233
label_markup = g_strdup_printf("<span size='large'>%s</span>",label);
234
gtk_label_set_markup (GTK_LABEL(header),
235
(const gchar *)label_markup);
237
gc_board_conf_separator();
239
return main_conf_box;
243
gc_board_conf_boolean_box_toggled (GtkToggleButton *togglebutton,
246
gchar *the_key = g_strdup((gchar *)key);
249
if (gtk_toggle_button_get_active (togglebutton))
250
value = g_strdup("True");
252
value = g_strdup("False");
254
g_hash_table_replace(hash_conf, (gpointer) the_key, (gpointer) value);
258
gc_board_config_boolean_box(const gchar *label, gchar *key, gboolean initial_value)
262
GtkWidget *CheckBox = gtk_check_button_new_with_label (label);
264
gtk_widget_show(CheckBox);
266
gtk_box_pack_start (GTK_BOX(main_conf_box),
272
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(CheckBox),
275
g_signal_connect (G_OBJECT(CheckBox),
277
G_CALLBACK(gc_board_conf_boolean_box_toggled),
280
return GTK_CHECK_BUTTON(CheckBox);
283
/* code get from gtk */
284
/* included here to not depend on gtk 2.6 */
287
_get_active_text (GtkComboBox *combo_box)
292
g_return_val_if_fail (GTK_IS_LIST_STORE (gtk_combo_box_get_model (combo_box)), NULL);
294
if (gtk_combo_box_get_active_iter (combo_box, &iter))
295
gtk_tree_model_get (gtk_combo_box_get_model (combo_box), &iter,
302
_combo_box_changed(GtkComboBox *combobox,
305
gchar *the_key = g_strdup((gchar *)key);
307
gchar *value = g_strdup_printf("%s", _get_active_text (combobox));
309
g_hash_table_replace(hash_conf, (gpointer) the_key, (gpointer) value);
312
static inline int my_strcmp(gchar *a, gchar *b) { return strcmp( a, b); }
315
GtkComboBox *gc_board_config_combo_box(const gchar *label, GList *strings, gchar *key, gchar *init)
320
GtkWidget *hbox = gtk_hbox_new (FALSE, 8);
322
GtkWidget *label_combo;
326
init_index = g_list_position ( strings, g_list_find_custom ( strings,(gconstpointer) init, (GCompareFunc) my_strcmp));
331
gtk_widget_show(hbox);
333
gtk_box_pack_start (GTK_BOX(main_conf_box),
340
label_combo = gtk_label_new ((gchar *)NULL);
341
gtk_widget_show(label_combo);
342
gtk_box_pack_start (GTK_BOX(hbox),
348
gtk_label_set_justify (GTK_LABEL(label_combo),
351
gtk_label_set_markup (GTK_LABEL(label_combo),
352
(const gchar *)label);
355
combobox = gtk_combo_box_new_text();
357
gtk_widget_show(combobox);
359
gtk_box_pack_start (GTK_BOX(hbox),
366
for (list = strings; list != NULL; list = list->next)
367
gtk_combo_box_append_text (GTK_COMBO_BOX(combobox),
370
if (g_list_length(strings) > COMBOBOX_COL_MAX)
371
gtk_combo_box_set_wrap_width (GTK_COMBO_BOX(combobox),
372
g_list_length(strings) / COMBOBOX_COL_MAX +1 );
374
gtk_combo_box_set_active (GTK_COMBO_BOX(combobox),
377
g_signal_connect(G_OBJECT(combobox),
379
G_CALLBACK(_combo_box_changed),
382
return GTK_COMBO_BOX(combobox);
385
static GSList *radio_group = NULL;
386
static GtkWidget *radio_box;
387
static gchar *radio_key = NULL;
388
static gchar *radio_text = NULL;
389
static gchar *radio_init = NULL;
391
static void radio_changed(GtkToggleButton *togglebutton,
394
gboolean state = gtk_toggle_button_get_active (togglebutton);
399
h_key = g_strdup (radio_key);
400
h_value = g_strdup((gchar *) key);
401
g_hash_table_replace (hash_conf, h_key, h_value);
406
create_radio_buttons(gpointer key,
410
GtkWidget *radio_button;
413
radio_button = gtk_radio_button_new_with_label (radio_group,
414
(const gchar *) g_strdup(value));
416
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, TRUE, TRUE, 2);
418
gtk_widget_show (GTK_WIDGET (radio_button));
420
radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button));
422
key_copy = g_strdup ((gchar *)key);
424
if (strcmp( key_copy, radio_init)==0)
425
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(radio_button),TRUE);
427
g_signal_connect(G_OBJECT(radio_button),
429
G_CALLBACK(radio_changed),
430
(gpointer) key_copy);
432
g_hash_table_replace ( hash_radio, (gpointer) key_copy, (gpointer) radio_button);
436
destroy_hash (GtkObject *object,
439
g_hash_table_destroy((GHashTable *)hash_table);
447
gc_board_config_radio_buttons(const gchar *label,
449
GHashTable *buttons_label,
454
GtkWidget *radio_label;
456
GHashTable *buttons = g_hash_table_new_full (g_str_hash,
461
radio_box = gtk_vbox_new (TRUE, 2);
462
gtk_widget_show (GTK_WIDGET (radio_box));
464
gtk_box_pack_start (GTK_BOX(main_conf_box),
470
radio_label = gtk_label_new ((gchar *)NULL);
471
gtk_widget_show(radio_label);
473
gtk_box_pack_start (GTK_BOX(radio_box),
479
gtk_label_set_justify (GTK_LABEL(radio_label),
482
radio_text = g_strdup(label);
483
gtk_label_set_markup (GTK_LABEL(radio_label),
484
(const gchar *)radio_text);
486
radio_key = g_strdup(key);
487
radio_init = g_strdup(init);
489
g_hash_table_foreach( buttons_label,
490
(GHFunc) create_radio_buttons,
493
g_signal_connect (G_OBJECT(radio_box), "destroy", G_CALLBACK(destroy_hash), (gpointer) buttons);
499
spin_changed (GtkSpinButton *spinbutton,
502
gchar *h_key = g_strdup((gchar *) key);
503
gchar *h_value = g_strdup_printf("%d",gtk_spin_button_get_value_as_int (spinbutton));
505
g_hash_table_replace (hash_conf, h_key, h_value);
509
gc_board_config_spin_int(const gchar *label, gchar *key, gint min, gint max, gint step, gint init)
514
GtkWidget *hbox = gtk_hbox_new (FALSE, 8);
515
GtkWidget *label_spin;
517
gtk_widget_show(hbox);
519
gtk_box_pack_start (GTK_BOX(main_conf_box),
526
label_spin = gtk_label_new ((gchar *)NULL);
527
gtk_widget_show(label_spin);
528
gtk_box_pack_start (GTK_BOX(hbox),
534
gtk_label_set_justify (GTK_LABEL(label_spin),
537
gtk_label_set_markup (GTK_LABEL(label_spin),
538
(const gchar *)label);
540
spin = gtk_spin_button_new_with_range ((gdouble )min,
543
gtk_widget_show(spin);
544
gtk_box_pack_start (GTK_BOX(hbox),
550
gtk_spin_button_set_wrap ( GTK_SPIN_BUTTON(spin), TRUE);
551
gtk_spin_button_set_numeric ( GTK_SPIN_BUTTON(spin), TRUE);
552
gtk_spin_button_set_digits ( GTK_SPIN_BUTTON(spin), 0);
554
gtk_spin_button_set_value ( GTK_SPIN_BUTTON(spin), (gdouble) init);
556
g_signal_connect (G_OBJECT(spin),
558
G_CALLBACK(spin_changed),
561
return GTK_SPIN_BUTTON(spin);
566
gc_board_conf_separator()
568
GtkWidget *separator = gtk_hseparator_new ();
570
gtk_widget_show(separator);
572
gtk_box_pack_start (GTK_BOX(main_conf_box),
578
return GTK_HSEPARATOR(separator);
582
/***********************************************/
584
/***********************************************/
586
/** \brief return the list of locales in which GCompris has been translated
589
* \note The list is calculated at the first call and must not be freed.
590
* Uppon next call, the same list is returned.
592
* \return a list containing the locales we suport
595
gc_locale_gets_list(){
597
static GList *gcompris_locales_list = NULL;
599
GcomprisProperties *properties = gc_prop_get();
600
GDir *textdomain_dir;
601
GError **error = NULL;
602
GList *locales = NULL;
604
if(gcompris_locales_list)
605
return(gcompris_locales_list);
607
/* There is no english locale but it exists anyway */
608
locales = g_list_append(locales, g_strdup("en"));
610
textdomain_dir = g_dir_open (properties->package_locale_dir, 0, error);
615
while ((fname = g_dir_read_name(textdomain_dir))) {
616
fname_abs = g_strdup_printf("%s/%s", properties->package_locale_dir, fname);
617
if (!g_file_test(fname_abs, G_FILE_TEST_IS_DIR))
620
catalog = g_strdup_printf("%s/LC_MESSAGES/gcompris.mo", fname_abs);
622
if (g_file_test(catalog, G_FILE_TEST_EXISTS)){
623
locales = g_list_append(locales, g_strdup(fname));
629
g_dir_close (textdomain_dir);
631
/* Save it for next call */
632
gcompris_locales_list = locales;
639
gc_board_config_combo_locales_changed(GtkComboBox *combobox,
642
gchar *the_key = g_strdup((gchar *)key);
644
gint index = gtk_combo_box_get_active (combobox);
647
/* Default value of gcompris selected */
648
value = g_strdup ("NULL");
650
value = _get_active_text (combobox);
652
g_hash_table_replace(hash_conf, (gpointer) the_key, (gpointer) value);
657
gc_board_config_combo_locales(gchar *init)
661
GtkWidget *hbox = gtk_hbox_new (FALSE, 8);
662
GList *list, *strings;
663
GtkWidget *label_combo;
666
strings = gc_locale_gets_list();
668
strings = g_list_prepend( strings, _("Default"));
671
init_index = g_list_position(strings,
672
g_list_find_custom(strings,
673
(gconstpointer) init,
674
(GCompareFunc) my_strcmp));
679
gtk_widget_show(hbox);
681
gtk_box_pack_start (GTK_BOX(main_conf_box),
688
label_combo = gtk_label_new ((gchar *)NULL);
689
gtk_widget_show(label_combo);
690
gtk_box_pack_start (GTK_BOX(hbox),
696
gtk_label_set_justify (GTK_LABEL(label_combo),
699
gtk_label_set_markup (GTK_LABEL(label_combo),
700
_("Select the language\n to use in the board"));
702
combobox = gtk_combo_box_new_text();
704
gtk_widget_show(combobox);
706
gtk_box_pack_start (GTK_BOX(hbox),
713
for (list = strings; list != NULL; list = list->next)
714
gtk_combo_box_append_text (GTK_COMBO_BOX(combobox),
717
if (g_list_length(strings) > COMBOBOX_COL_MAX)
718
gtk_combo_box_set_wrap_width (GTK_COMBO_BOX(combobox),
719
g_list_length(strings) / COMBOBOX_COL_MAX +1 );
721
gtk_combo_box_set_active (GTK_COMBO_BOX(combobox),
724
g_signal_connect(G_OBJECT(combobox),
726
G_CALLBACK(gc_board_config_combo_locales_changed),
729
return GTK_COMBO_BOX(combobox);
733
static gchar *current_locale = NULL;
735
gc_locale_change(gchar *locale)
740
if (strcmp(locale, "NULL") == 0){
745
current_locale = g_strdup(gc_locale_get());
747
gc_locale_set(locale);
753
if (current_locale == NULL)
756
gc_locale_change(current_locale);
758
g_free(current_locale);
759
current_locale = NULL;
763
/** \brief Search the given file for each locale and returns the locale list
765
* \param file: the file to search. In order to work, you need to provide a
766
* filename that includes a $LOCALE in it like:
767
* sounds/$LOCALE/colors/blue.ogg
769
* \return a list of locale
772
gc_locale_gets_asset_list(const gchar *filename)
774
GList *locales, *list, *locales_asset = NULL;
777
locales = gc_locale_gets_list();
779
for (list = locales; list != NULL; list = list->next)
783
/* Check there is a $LOCALE to replace */
784
if((tmp = g_strsplit(filename, "$LOCALE", -1)))
789
/* try with the locale */
790
g_strlcpy(locale, list->data, sizeof(locale));
791
filename2 = g_strjoinv(locale, tmp);
792
g_warning("trying locale file '%s'\n", filename2);
793
abs_filename = gc_file_find_absolute(filename2);
800
abs_filename = gc_file_find_absolute(filename);
804
/* It would be cleaner to provide the real locale name but then we need a way
805
* to get back the locale code from it's name and from the boards
807
* locales_asset = g_list_append(locales_asset, gc_locale_get_name(list->data));
810
locales_asset = g_list_append(locales_asset, list->data);
815
return locales_asset;
818
/* key = "locale_sound" */
819
GtkComboBox *gc_board_config_combo_locales_asset(const gchar *label,
825
GtkWidget *hbox = gtk_hbox_new (FALSE, 8);
826
GList *list, *strings;
827
GtkWidget *label_combo;
830
strings = gc_locale_gets_asset_list(file);
832
strings = g_list_prepend( strings, _("Default"));
836
init_index = g_list_position(strings,
837
g_list_find_custom(strings,
839
(GCompareFunc) my_strcmp));
845
gtk_widget_show(hbox);
847
gtk_box_pack_start (GTK_BOX(main_conf_box),
854
label_combo = gtk_label_new ((gchar *)NULL);
855
gtk_widget_show(label_combo);
856
gtk_box_pack_start (GTK_BOX(hbox),
862
gtk_label_set_justify (GTK_LABEL(label_combo),
865
gtk_label_set_markup (GTK_LABEL(label_combo),
868
combobox = gtk_combo_box_new_text();
870
gtk_widget_show(combobox);
872
gtk_box_pack_start (GTK_BOX(hbox),
879
for (list = strings; list != NULL; list = list->next)
880
gtk_combo_box_append_text(GTK_COMBO_BOX(combobox),
883
if (g_list_length(strings) > COMBOBOX_COL_MAX)
884
gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(combobox),
885
g_list_length(strings) / COMBOBOX_COL_MAX +1 );
887
gtk_combo_box_set_active (GTK_COMBO_BOX(combobox),
890
g_signal_connect(G_OBJECT(combobox),
892
G_CALLBACK(gc_board_config_combo_locales_changed),
895
return GTK_COMBO_BOX(combobox);
899
/****************************************/
904
GcomprisTextCallback callback;
906
GtkTextBuffer *TextBuffer;
910
_textview_destroy (GtkButton *button,
913
g_free(((user_param_type *)user_data)->key);
921
_textbuffer_changed (GtkTextBuffer *buffer,
924
gtk_widget_set_sensitive (GTK_WIDGET(user_data),
931
_textview_yes (GtkButton *button,
935
user_param_type *params= (user_param_type *) user_data;
937
gchar *key = params->key;
938
GcomprisTextCallback validate = params->callback;
939
GtkLabel *label = params->feedback;
940
GtkTextBuffer *text_buffer = params->TextBuffer;
942
GtkTextIter start_iter;
943
GtkTextIter end_iter;
945
gtk_text_buffer_get_start_iter (text_buffer,
948
gtk_text_buffer_get_end_iter (text_buffer,
951
/* has this to be freed ? */
952
gchar *text = gtk_text_buffer_get_slice (text_buffer,
959
gchar *in_memoriam_text = g_strdup (text);
960
gchar *in_memoriam_key = g_strdup (key);
962
if (validate( key, text, label)){
963
g_hash_table_replace ( hash_conf, (gpointer) in_memoriam_key, (gpointer) in_memoriam_text);
964
gtk_widget_set_sensitive (GTK_WIDGET(button),
968
g_free (in_memoriam_text);
969
g_free (in_memoriam_key);
977
gc_board_config_textview(const gchar *label,
979
const gchar*description,
981
GcomprisTextCallback validate)
983
GtkWidget*frame = gtk_frame_new ("GCompris text tool");
984
gtk_widget_show(frame);
986
gtk_box_pack_start (GTK_BOX(main_conf_box),
994
/* Main vbox for all our widegt */
995
GtkWidget *textVbox = gtk_vbox_new ( FALSE, 8);
996
gtk_widget_show(textVbox);
998
gtk_container_add(GTK_CONTAINER(frame),
1001
GtkWidget *title = gtk_label_new ((gchar *)NULL);
1002
gtk_widget_show(title);
1004
gtk_box_pack_start (GTK_BOX(textVbox),
1010
gtk_label_set_justify (GTK_LABEL(title),
1011
GTK_JUSTIFY_CENTER);
1013
gchar *title_text = g_strdup(label);
1014
gtk_label_set_markup (GTK_LABEL(title),
1015
(const gchar *)title_text);
1017
GtkWidget *separator = gtk_hseparator_new ();
1019
gtk_widget_show(separator);
1021
gtk_box_pack_start (GTK_BOX(textVbox),
1028
GtkWidget *desc = gtk_label_new ((gchar *)NULL);
1029
gtk_widget_show(desc);
1031
gtk_box_pack_start (GTK_BOX(textVbox),
1037
//gtk_label_set_justify (GTK_LABEL(title),
1038
// GTK_JUSTIFY_CENTER);
1040
gtk_label_set_line_wrap(GTK_LABEL(desc), TRUE);
1042
gchar *desc_text = g_strdup(description);
1043
gtk_label_set_markup (GTK_LABEL(desc),
1044
(const gchar *)desc_text);
1046
GtkWidget *scroll = gtk_scrolled_window_new ( NULL, NULL);
1049
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scroll),
1050
GTK_POLICY_AUTOMATIC,
1051
GTK_POLICY_AUTOMATIC);
1053
gtk_widget_set_size_request (scroll,
1057
gtk_widget_show( scroll);
1059
gtk_box_pack_start (GTK_BOX(textVbox),
1066
GtkWidget *textView = gtk_text_view_new ();
1067
gtk_widget_show(textView);
1069
gtk_container_add (GTK_CONTAINER(scroll),
1072
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textView), GTK_WRAP_WORD_CHAR);
1075
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textView));
1077
gtk_text_buffer_set_text (buffer, g_strdup(init_text), -1);
1080
/* hbox for feedback and validation button */
1081
GtkWidget *validationHbox = gtk_vbox_new ( FALSE, 8);
1082
gtk_widget_show(validationHbox);
1084
gtk_box_pack_start (GTK_BOX(textVbox),
1091
GtkWidget *feedback = gtk_label_new ((gchar *)NULL);
1092
gtk_widget_show(feedback);
1094
gtk_box_pack_start (GTK_BOX(validationHbox),
1100
gtk_label_set_justify (GTK_LABEL(title),
1103
gtk_label_set_line_wrap(GTK_LABEL(feedback), TRUE);
1105
user_param_type *user_param = g_malloc0(sizeof(user_param_type));
1107
user_param->key = g_strdup(key);
1108
user_param->callback = validate;
1109
user_param->feedback = GTK_LABEL(feedback);
1110
user_param->TextBuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(textView));
1113
/* vbox for feedback and validation button */
1114
GtkWidget *validationVbox = gtk_hbox_new ( FALSE, 8);
1115
gtk_widget_show(validationVbox);
1117
gtk_box_pack_end (GTK_BOX(validationHbox),
1124
/* Validate button */
1125
GtkWidget *button = gtk_button_new_from_stock (GTK_STOCK_YES);
1126
gtk_widget_show(button);
1127
gtk_box_pack_end (GTK_BOX(validationVbox),
1133
g_signal_connect(G_OBJECT(button),
1135
G_CALLBACK(_textview_yes),
1136
(gpointer) user_param);
1139
g_signal_connect(G_OBJECT(button),
1141
G_CALLBACK(_textview_destroy),
1142
(gpointer) user_param);
1144
g_signal_connect(G_OBJECT(user_param->TextBuffer),
1146
G_CALLBACK(_textbuffer_changed),
1149
gtk_widget_set_sensitive (button,
1152
return GTK_TEXT_VIEW(textView);