Esempio n. 1
0
static GtkWidget *create_kbm_opts()
{

  GtkWidget *hbox = gtk_hbox_new (FALSE, 1);

  opt_kbm_opts = gtk_combo_box_new_text ();
#if !GTK_CHECK_VERSION(2,4,0)
  GtkWidget *menu_kbm_opts = gtk_menu_new ();
#endif
  gtk_box_pack_start (GTK_BOX (hbox), opt_kbm_opts, FALSE, FALSE, 0);

  int i;
  int current_idx = get_current_kbm_idx();

  for(i=0; kbm_sel[i].name; i++) {
#if GTK_CHECK_VERSION(2,4,0)
    gtk_combo_box_append_text (GTK_COMBO_BOX_TEXT (opt_kbm_opts), _(kbm_sel[i].name));
#else
    GtkWidget *item = gtk_menu_item_new_with_label (_(kbm_sel[i].name));
    gtk_menu_shell_append (GTK_MENU_SHELL (menu_kbm_opts), item);
#endif
  }

#if !GTK_CHECK_VERSION(2,4,0)
  gtk_option_menu_set_menu (GTK_OPTION_MENU (opt_kbm_opts), menu_kbm_opts);
#endif
  gtk_combo_box_set_active (GTK_COMBO_BOX (opt_kbm_opts), current_idx);

  opt_selkeys = gtk_combo_box_new_text ();
#if !GTK_CHECK_VERSION(2,4,0)
  GtkWidget *menu_selkey = gtk_menu_new ();
#endif
  gtk_box_pack_start (GTK_BOX (hbox), opt_selkeys, FALSE, FALSE, 0);

  current_idx = 0;
  for(i=0; selkeys[i].kstr; i++) {
#if GTK_CHECK_VERSION(2,4,0)
    gtk_combo_box_append_text (GTK_COMBO_BOX_TEXT (opt_selkeys), selkeys[i].kstr);
#else
    GtkWidget *item = gtk_menu_item_new_with_label (selkeys[i].kstr);
    gtk_menu_shell_append (GTK_MENU_SHELL (menu_selkeys), item);
#endif

    if (!strcmp(selkeys[i].kstr, pho_selkey))
      current_idx = i;
  }

#if !GTK_CHECK_VERSION(2,4,0)
  gtk_option_menu_set_menu (GTK_OPTION_MENU (opt_selkeys), menu_kbm_opts);
#endif
  gtk_combo_box_set_active (GTK_COMBO_BOX (opt_selkeys), current_idx);

  GtkAdjustment *adj =
   (GtkAdjustment *) gtk_adjustment_new (pho_candicate_col_N, 1, 10, 1.0, 1.0, 0.0);
  spinner_pho_candicate_col_N = gtk_spin_button_new (adj, 0, 0);
  gtk_box_pack_start (GTK_BOX (hbox), spinner_pho_candicate_col_N, FALSE, FALSE, 0);

  return hbox;
}
Esempio n. 2
0
static GtkWidget *create_kbm_opts()
{

  GtkWidget *hbox = gtk_hbox_new (FALSE, 1);

  opt_kbm_opts = gtk_combo_box_new_text ();
  gtk_box_pack_start (GTK_BOX (hbox), opt_kbm_opts, FALSE, FALSE, 0);

  int i;
  int current_idx = get_current_kbm_idx();

  for(i=0; kbm_sel[i].name; i++) {
    gtk_combo_box_append_text (GTK_COMBO_BOX_TEXT (opt_kbm_opts), _(kbm_sel[i].name));
  }

  gtk_combo_box_set_active (GTK_COMBO_BOX (opt_kbm_opts), current_idx);

  opt_selkeys = gtk_combo_box_new_text ();
  gtk_box_pack_start (GTK_BOX (hbox), opt_selkeys, FALSE, FALSE, 0);

  current_idx = 0;
  for(i=0; selkeys[i].kstr; i++) {
    gtk_combo_box_append_text (GTK_COMBO_BOX_TEXT (opt_selkeys), selkeys[i].kstr);
    if (!strcmp(selkeys[i].kstr, pho_selkey))
      current_idx = i;
  }

  gtk_combo_box_set_active (GTK_COMBO_BOX (opt_selkeys), current_idx);

  GtkAdjustment *adj =
   (GtkAdjustment *) gtk_adjustment_new (pho_candicate_col_N, 1, 10, 1.0, 1.0, 0.0);
  spinner_pho_candicate_col_N = gtk_spin_button_new (adj, 0, 0);
  gtk_box_pack_start (GTK_BOX (hbox), spinner_pho_candicate_col_N, FALSE, FALSE, 0);

  return hbox;
}