Logo Search packages:      
Sourcecode: teg version File versions  Download package

void preferences_activate ( void   ) 

Status options

end

Definition at line 295 of file preferences.c.

References apply_cb(), conf_cb_robotclient, conf_cb_showattackturn, conf_cb_showerr, and conf_cb_stscolor.

{
      GtkWidget *label;
      GtkWidget *msg_frame;
      GtkWidget *sts_frame;
      GtkWidget *dialog_frame;
      GtkWidget *robot_frame;
      GtkWidget *theme_frame_sel, *theme_vbox;
      GtkWidget *vbox, *hbox;
      GtkWidget *menu, *omenu;

      if( pref_dialog != NULL ) {
            gdk_window_show( pref_dialog->window);
            gdk_window_raise( pref_dialog->window);
            return ;
      }


      /* Theme options */
      theme_vbox = gtk_vbox_new (FALSE, 0);
      
      theme_frame_sel = gtk_frame_new (_("Select theme"));
      gtk_container_border_width (GTK_CONTAINER (theme_frame_sel), GNOME_PAD);
      omenu = gtk_option_menu_new ();
      menu = gtk_menu_new ();
      fill_menu (menu);
      gtk_widget_show (omenu);
      gtk_option_menu_set_menu (GTK_OPTION_MENU(omenu), menu);
      label = gtk_label_new (_("Select theme"));
      gtk_widget_show (label);

      hbox = gtk_hbox_new (TRUE, 0);
      gtk_container_border_width (GTK_CONTAINER (hbox), GNOME_PAD);

      gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, FALSE, 0);
      gtk_box_pack_start( GTK_BOX( hbox ), omenu, FALSE, FALSE, 0);
      gtk_container_add (GTK_CONTAINER (theme_frame_sel), hbox);
      gtk_widget_show(theme_frame_sel);

      theme_frame_prev = gtk_frame_new (_("Preview"));
      gtk_container_border_width (GTK_CONTAINER (theme_frame_prev), GNOME_PAD);
      gtk_widget_show(theme_frame_prev);

      load_preview(g_game.theme);

      gtk_box_pack_start( GTK_BOX( theme_vbox ), theme_frame_sel, FALSE, FALSE, 0);
      gtk_box_pack_start( GTK_BOX( theme_vbox ), theme_frame_prev, FALSE, FALSE, 0);

      /* Message Options */
      msg_frame = gtk_frame_new (_("Console Messages"));
      gtk_container_border_width (GTK_CONTAINER (msg_frame), GNOME_PAD);

      vbox = gtk_vbox_new (FALSE, 0);
      gtk_container_border_width (GTK_CONTAINER (vbox), GNOME_PAD);


      conf_cb_showerr = gtk_check_button_new_with_label(_("Show Error Messages"));
      GTK_TOGGLE_BUTTON(conf_cb_showerr)->active = (g_game.msg_show & M_ERR) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_showerr, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_showerr), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);

      conf_cb_showimp = gtk_check_button_new_with_label(_("Show Important Messages"));
      GTK_TOGGLE_BUTTON(conf_cb_showimp)->active = (g_game.msg_show & M_IMP) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_showimp, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_showimp), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);

      conf_cb_showmsg = gtk_check_button_new_with_label(_("Show Players Messages"));
      GTK_TOGGLE_BUTTON(conf_cb_showmsg)->active = (g_game.msg_show & M_MSG) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_showmsg, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_showmsg), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);

      conf_cb_showmsgcolor = gtk_check_button_new_with_label(_("Show Players Messages with colors"));
      GTK_TOGGLE_BUTTON(conf_cb_showmsgcolor)->active = (gui_private.msg_show_colors & 1) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_showmsgcolor, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_showmsgcolor), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);

      conf_cb_showinf = gtk_check_button_new_with_label(_("Show Informative Messages"));
      GTK_TOGGLE_BUTTON(conf_cb_showinf)->active = (g_game.msg_show & M_INF) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_showinf, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_showinf), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);

      gtk_container_add (GTK_CONTAINER (msg_frame), vbox);


      /** Status options **/

      sts_frame = gtk_frame_new (_("Status Of Players"));
      gtk_container_border_width (GTK_CONTAINER (sts_frame), GNOME_PAD);

      hbox = gtk_hbox_new (TRUE, 0);
      vbox = gtk_vbox_new (FALSE, 0);
      gtk_container_border_width (GTK_CONTAINER (hbox), GNOME_PAD);
      gtk_container_border_width (GTK_CONTAINER (vbox), 0);


      conf_cb_stscolor = gtk_check_button_new_with_label(_("Show Color"));
      GTK_TOGGLE_BUTTON(conf_cb_stscolor)->active = (gui_private.status_show & (1 <<STATUS_COLUMN_COLOR) ) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_stscolor, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_stscolor), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);


      conf_cb_stsnumber = gtk_check_button_new_with_label(_("Show Player Number"));
      GTK_TOGGLE_BUTTON(conf_cb_stsnumber)->active = (gui_private.status_show & (1 << STATUS_COLUMN_NUMBER) ) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_stsnumber, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_stsnumber), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);


      conf_cb_stsname = gtk_check_button_new_with_label(_("Show Name"));
      GTK_TOGGLE_BUTTON(conf_cb_stsname)->active = (gui_private.status_show & (1 <<STATUS_COLUMN_NAME) ) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_stsname, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_stsname), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);


      conf_cb_stsscore= gtk_check_button_new_with_label(_("Show Score"));
      GTK_TOGGLE_BUTTON(conf_cb_stsscore)->active = (gui_private.status_show & (1 << STATUS_COLUMN_SCORE) ) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_stsscore, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_stsscore), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);

      conf_cb_stsaddress = gtk_check_button_new_with_label(_("Show IP Address"));
      GTK_TOGGLE_BUTTON(conf_cb_stsaddress)->active = (gui_private.status_show & (1 << STATUS_COLUMN_ADDR) ) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_stsaddress, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_stsaddress), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);

      conf_cb_stshuman= gtk_check_button_new_with_label(_("Show Human/Robot"));
      GTK_TOGGLE_BUTTON(conf_cb_stshuman)->active = (gui_private.status_show & (1 << STATUS_COLUMN_HUMAN) ) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_stshuman, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_stshuman), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);

      // now start the left box
      gtk_box_pack_start ( GTK_BOX (hbox), vbox, FALSE, TRUE, 0);
      vbox = gtk_vbox_new (FALSE, 0);
      gtk_container_border_width (GTK_CONTAINER (vbox), 0);


      conf_cb_stscountries = gtk_check_button_new_with_label(_("Show Countries"));
      GTK_TOGGLE_BUTTON(conf_cb_stscountries)->active = (gui_private.status_show & (1 << STATUS_COLUMN_COUNTRIES) ) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_stscountries, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_stscountries), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);

      conf_cb_stsarmies = gtk_check_button_new_with_label(_("Show Armies"));
      GTK_TOGGLE_BUTTON(conf_cb_stsarmies)->active = (gui_private.status_show & (1 << STATUS_COLUMN_ARMIES) ) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_stsarmies, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_stsarmies), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);

      conf_cb_stscards = gtk_check_button_new_with_label(_("Show Cards"));
      GTK_TOGGLE_BUTTON(conf_cb_stscards)->active = (gui_private.status_show & (1 << STATUS_COLUMN_CARDS) ) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_stscards, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_stscards), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);

      conf_cb_stsstatus = gtk_check_button_new_with_label(_("Show Status"));
      GTK_TOGGLE_BUTTON(conf_cb_stsstatus)->active = (gui_private.status_show & (1 << STATUS_COLUMN_STATUS) ) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_stsstatus, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_stsstatus), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);

      conf_cb_stswho = gtk_check_button_new_with_label(_("Show Who Started"));
      GTK_TOGGLE_BUTTON(conf_cb_stswho)->active = ( gui_private.status_show & (1<<STATUS_COLUMN_WHO) ) ?1:0;
      gtk_box_pack_start( GTK_BOX( vbox ), conf_cb_stswho, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_stswho), "clicked", GTK_SIGNAL_FUNC
                  (prop_box_changed_callback), NULL);

      /* hbox contains two vboxes which contain the buttons/labels */
      gtk_box_pack_start ( GTK_BOX (hbox), vbox, FALSE, TRUE, 0);

      gtk_container_add (GTK_CONTAINER (sts_frame), hbox);


      /* Robot Options */

      robot_frame = gtk_frame_new (_("Launch Robot"));
      gtk_container_border_width (GTK_CONTAINER (robot_frame), GNOME_PAD);

      vbox = gtk_vbox_new (FALSE, 0);
      gtk_container_border_width (GTK_CONTAINER (vbox), GNOME_PAD);

      conf_cb_robotserver = gtk_radio_button_new_with_label ( NULL, 
                  _("Starts the robots in the server (faster)"));
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (conf_cb_robotserver), g_game.robot_in_server );
      gtk_box_pack_start( GTK_BOX(vbox), conf_cb_robotserver, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_robotserver), "clicked",
                  GTK_SIGNAL_FUNC(prop_box_changed_callback), NULL);

      conf_cb_robotclient = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON(conf_cb_robotserver),
                  _("Starts the robots in the client (preserves localization)"));
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (conf_cb_robotclient), ! g_game.robot_in_server );
      gtk_box_pack_start( GTK_BOX(vbox), conf_cb_robotclient, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_robotclient), "clicked",
                  GTK_SIGNAL_FUNC(prop_box_changed_callback), NULL);


      gtk_container_add (GTK_CONTAINER (robot_frame), vbox);


      /* Dialogs Options */
      dialog_frame = gtk_frame_new (_("Popup Dialogs"));
      gtk_container_border_width (GTK_CONTAINER (dialog_frame), GNOME_PAD);

      vbox = gtk_vbox_new (FALSE, 0);
      gtk_container_border_width (GTK_CONTAINER (vbox), GNOME_PAD);

      conf_cb_showattackturn = gtk_check_button_new_with_label (_("Show 'your turn for attack' dialog"));
      GTK_TOGGLE_BUTTON(conf_cb_showattackturn)->active =
            ( gui_private.dialog_show & (1<<DIALOG_ATTACK_TURN) ) ?1:0;
      gtk_box_pack_start( GTK_BOX(vbox), conf_cb_showattackturn, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_showattackturn), "clicked",
                  GTK_SIGNAL_FUNC(prop_box_changed_callback), NULL);

      conf_cb_showregrouparmies = gtk_check_button_new_with_label (_("Show 'regroup your armies' dialog"));
      GTK_TOGGLE_BUTTON(conf_cb_showregrouparmies)->active =
            ( gui_private.dialog_show & (1<<DIALOG_REGROUP_ARMIES) ) ?1:0;
      gtk_box_pack_start( GTK_BOX(vbox), conf_cb_showregrouparmies, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_showregrouparmies), "clicked",
                  GTK_SIGNAL_FUNC(prop_box_changed_callback), NULL);

      conf_cb_showplacearmies = gtk_check_button_new_with_label (_("Show 'place your armies' dialog"));
      GTK_TOGGLE_BUTTON(conf_cb_showplacearmies)->active =
            ( gui_private.dialog_show & (1<<DIALOG_PLACE_ARMIES) ) ?1:0;
      gtk_box_pack_start( GTK_BOX(vbox), conf_cb_showplacearmies, FALSE, FALSE, 0);
      gtk_signal_connect (GTK_OBJECT (conf_cb_showplacearmies), "clicked",
                  GTK_SIGNAL_FUNC(prop_box_changed_callback), NULL);

      gtk_container_add (GTK_CONTAINER (dialog_frame), vbox);


      /** end **/

      pref_dialog = gnome_property_box_new ();
      gnome_dialog_set_parent (GNOME_DIALOG (pref_dialog),
                  GTK_WINDOW (main_window));
      gtk_window_set_title (GTK_WINDOW (pref_dialog),
                  _("TEG Preferences"));
      gtk_signal_connect (GTK_OBJECT (pref_dialog), "destroy",
                  GTK_SIGNAL_FUNC (gtk_widget_destroyed), &pref_dialog);


      label = gtk_label_new (_("Themes"));
      gnome_property_box_append_page (GNOME_PROPERTY_BOX (pref_dialog),
                  theme_vbox, label);

      label = gtk_label_new (_("Console Messages"));
      gnome_property_box_append_page (GNOME_PROPERTY_BOX (pref_dialog),
                  msg_frame, label);

      label = gtk_label_new (_("Status Of Players"));
      gnome_property_box_append_page (GNOME_PROPERTY_BOX (pref_dialog),
                  sts_frame, label);

      label = gtk_label_new (_("Robot"));
      gnome_property_box_append_page (GNOME_PROPERTY_BOX (pref_dialog),
                  robot_frame, label);

      label = gtk_label_new (_("Popup Dialogs"));
      gnome_property_box_append_page (GNOME_PROPERTY_BOX (pref_dialog),
                  dialog_frame, label);



      gtk_signal_connect (GTK_OBJECT (pref_dialog), "apply", GTK_SIGNAL_FUNC
                  (apply_cb), NULL);

      if (!GTK_WIDGET_VISIBLE (pref_dialog))
            gtk_widget_show_all (pref_dialog);
      else
            gtk_widget_destroy (pref_dialog);
}


Generated by  Doxygen 1.6.0   Back to index