Exemple #1
0
static void
config_start(GcomprisBoard *agcomprisBoard,
		    GcomprisProfile *aProfile)
{
  board_conf = agcomprisBoard;
  profile_conf = aProfile;

  if (gcomprisBoard_missing)
    pause_board(TRUE);
  else
    {
      gcomprisBoard_missing=agcomprisBoard;
      _init(agcomprisBoard);
    }

  gchar *label = g_strdup_printf(_("<b>%s</b> configuration\n for profile <b>%s</b>"),
				 agcomprisBoard->name,
				 aProfile ? aProfile->name : "");
  GcomprisBoardConf *bconf;
  bconf = gc_board_config_window_display( label,
				 conf_ok);

  g_free(label);

  /* init the combo to previously saved value */
  GHashTable *config = gc_db_get_conf( profile_conf, board_conf);

  gchar *locale = g_hash_table_lookup( config, "locale");

  gc_board_config_combo_locales(bconf, locale);
  config_missing_letter(bconf, config);

}
Exemple #2
0
static void
gletter_config_start(GcomprisBoard *agcomprisBoard,
		    GcomprisProfile *aProfile)
{
  board_conf = agcomprisBoard;
  profile_conf = aProfile;

  gchar *label;

  if (gcomprisBoard)
    pause_board(TRUE);

  label = g_strdup_printf(_("<b>%s</b> configuration\n for profile <b>%s</b>"),
			  agcomprisBoard->name, aProfile ? aProfile->name : "");

  GcomprisBoardConf *bconf = gc_board_config_window_display(label, (GcomprisConfCallback )conf_ok);

  g_free(label);

  /* init the combo to previously saved value */
  GHashTable *config = gc_db_get_conf( profile_conf, board_conf);

  gchar *locale = g_hash_table_lookup( config, "locale");

  gc_board_config_combo_locales( bconf, locale);

  gboolean up_init = FALSE;

  gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only");

  if (up_init_str && (strcmp(up_init_str, "True")==0))
    up_init = TRUE;

  gc_board_conf_separator(bconf);

  gchar *control_sound = g_hash_table_lookup( config, "with_sound");
  if (control_sound && strcmp(g_hash_table_lookup( config, "with_sound"),"True")==0)
    with_sound = TRUE;
  else
    with_sound = FALSE;

  gc_board_config_boolean_box(bconf, _("Enable sounds"), "with_sound", with_sound);

  gc_board_conf_separator(bconf);

  gc_board_config_boolean_box(bconf, _("Uppercase only text"),
		       "uppercase_only",
		       up_init);

}
Exemple #3
0
static void
wordsgame_config_start(GcomprisBoard *agcomprisBoard,
		       GcomprisProfile *aProfile)
{
  GcomprisBoardConf *conf;
  board_conf = agcomprisBoard;
  profile_conf = aProfile;

  if (gcomprisBoard)
    pause_board(TRUE);

  gchar *label = g_strdup_printf(_("<b>%s</b> configuration\n for profile <b>%s</b>"),
				 agcomprisBoard->name,
				 aProfile? aProfile->name: "");

  conf = gc_board_config_window_display( label,
					 conf_ok);

  g_free(label);

  /* init the combo to previously saved value */
  GHashTable *config = gc_db_get_conf( profile_conf, board_conf);

  gchar *locale = g_hash_table_lookup( config, "locale");

  gc_board_config_combo_locales(conf, locale);
  gc_board_config_wordlist(conf, "wordsgame/default-$LOCALE.xml");
  /* upper case */
  gboolean up_init = FALSE;
  gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only");

  if (up_init_str && (strcmp(up_init_str, "True")==0))
    up_init = TRUE;

  gc_board_config_boolean_box(conf, _("Uppercase only text"),
			      "uppercase_only",
			      up_init);
}
Exemple #4
0
static void
config_start(GcomprisBoard *agcomprisBoard,
	     GcomprisProfile *aProfile)
{
  board_conf = agcomprisBoard;
  profile_conf = aProfile;

  if (gcomprisBoard)
    pause_board(TRUE);

  gc_locale_set( NULL );

  gchar *label = g_strdup_printf(_("<b>%1$s</b> configuration\n for profile <b>%2$s</b>"),
				 agcomprisBoard->name,
				 aProfile ? aProfile->name : "");
  GcomprisBoardConf *bconf;
  bconf = gc_board_config_window_display(label, conf_ok);

  g_free(label);

  /* init the combo to previously saved value */
  GHashTable *config = gc_db_get_conf( profile_conf, board_conf);

  gchar *saved_locale_sound = g_hash_table_lookup( config, "locale_sound");

  gc_board_config_combo_locales_asset(bconf, "Select sound locale", saved_locale_sound,
				      "voices/$LOCALE/colors/purple.ogg",
				      G_CALLBACK (locale_changed));

  /* frame */
  GtkWidget *frame = gtk_frame_new("");
  gtk_widget_show(frame);
  gtk_box_pack_start(GTK_BOX(bconf->main_conf_box),
		     frame, TRUE, TRUE, 8);

  GtkWidget *vbox = gtk_vbox_new(FALSE, 8);
  gtk_widget_show(vbox);
  gtk_container_add(GTK_CONTAINER(frame), vbox);

  /* list view */
  GtkListStore *list = gtk_list_store_new(N_COLUMNS,
					  G_TYPE_UINT,    /* Level */
					  G_TYPE_STRING,  /* Answers */
					  G_TYPE_STRING   /* Questions */
					  );

  GtkWidget *treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list));
  configure_colummns(GTK_TREE_VIEW(treeview));
  gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
  gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview), LEVEL_COLUMN);
  gtk_widget_set_size_request(treeview, -1, 200);
  gtk_widget_show(treeview);

  GtkScrolledWindow *scroll = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(NULL,NULL));
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
				  GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_widget_show(GTK_WIDGET(scroll));
  gtk_container_add(GTK_CONTAINER(scroll), treeview);

  gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(scroll), TRUE, TRUE, 10);

  GtkTreeSelection *selection;
  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
  gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);

  model = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)));

  load_model_from_levels(model);

  /* some buttons */
  GtkWidget *hbox = gtk_hbox_new (TRUE, 4);
  gtk_widget_show(hbox);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

  GtkWidget *button = gtk_button_new_from_stock(GTK_STOCK_NEW);
  gtk_widget_show(button);
  g_signal_connect (button, "clicked",
		    G_CALLBACK (add_item), model);
  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);

  button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
  gtk_widget_show(button);
  g_signal_connect (button, "clicked",
		    G_CALLBACK (remove_item), treeview);
  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);

  button = gtk_button_new_from_stock(GTK_STOCK_GO_UP);
  gtk_widget_show(button);
  g_signal_connect (button, "clicked",
		    G_CALLBACK (up_item), treeview);
  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);

  button = gtk_button_new_from_stock(GTK_STOCK_GO_DOWN);
  gtk_widget_show(button);
  g_signal_connect (button, "clicked",
		    G_CALLBACK (down_item), treeview);
  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);

  hbox = gtk_hbox_new (TRUE, 4);
  gtk_widget_show(hbox);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

  button = gtk_button_new_with_label(_("Back to default"));
  gtk_widget_show(button);
  g_signal_connect (button, "clicked",
		    G_CALLBACK (return_to_default), model);
  gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0);


  g_hash_table_destroy(config);
}