static EContact *
ecard_from_remote_record(EAddrConduitContext *ctxt,
			 GnomePilotRecord *remote,
			 EContact *in_contact)
{
	struct Address address;
	EContact *contact;
	EContactName *name;
	EContactAddress *eaddress;
	EContactField mailing_address;
	char *txt, *find, *full_name;
	EContactField next_mail, next_home, next_work, next_fax;
	EContactField next_other, next_main, next_pager, next_mobile;
	int i;
#ifdef PILOT_LINK_0_12
	pi_buffer_t * buffer;
#endif
	g_return_val_if_fail(remote!=NULL,NULL);
	memset (&address, 0, sizeof (struct Address));
#ifdef PILOT_LINK_0_12
	buffer = pi_buffer_new(DLP_BUF_SIZE);
	if(buffer == NULL){
		pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
		return NULL;
	}

	if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){
		pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
		return NULL;
	}
	unpack_Address (&address, buffer, address_v1);
	pi_buffer_free(buffer);
#else
	unpack_Address (&address, remote->record, remote->length);
#endif
	if (in_contact == NULL)
		contact = e_contact_new ();
	else
		contact = e_contact_duplicate (in_contact);

	/* Name */
	name = e_contact_name_new ();
	name->given = get_entry_text (address, entryFirstname);
	name->family = get_entry_text (address, entryLastname);

	full_name = e_contact_name_to_string (name);
	e_contact_set (contact, E_CONTACT_FULL_NAME, full_name);
	e_contact_name_free (name);

	/* File As */
	if (!full_name || !*full_name)
		set_contact_text (contact, E_CONTACT_FILE_AS, address, entryCompany);

	g_free (full_name);

	/* Title and Company */
	set_contact_text (contact, E_CONTACT_TITLE, address, entryTitle);
	set_contact_text (contact, E_CONTACT_ORG, address, entryCompany);

	/* Address */
	mailing_address = -1;
	if ((eaddress = e_contact_get (contact, ctxt->cfg->default_address))) {
		mailing_address = ctxt->cfg->default_address;
		e_contact_address_free (eaddress);
	} else {
		for (i = E_CONTACT_FIRST_ADDRESS_ID; i <= E_CONTACT_LAST_ADDRESS_ID; i++) {
			if ((eaddress = e_contact_get (contact, i))) {
				e_contact_address_free (eaddress);
				mailing_address = i;
				break;
			}
		}
	}

	if (mailing_address == -1)
		mailing_address = ctxt->cfg->default_address;

	eaddress = g_new0 (EContactAddress, 1);

	txt = get_entry_text (address, entryAddress);
	if (txt && (find = strchr (txt, '\n')) != NULL) {
		*find = '\0';
		find++;
	} else {
		find = NULL;
	}

	eaddress->street = txt;
	eaddress->ext = find != NULL ? g_strdup (find) : g_strdup ("");
	eaddress->locality = get_entry_text (address, entryCity);
	eaddress->region = get_entry_text (address, entryState);
	eaddress->country = get_entry_text (address, entryCountry);
	eaddress->code = get_entry_text (address, entryZip);

	e_contact_set (contact, mailing_address, eaddress);
	e_contact_address_free (eaddress);

	/* Phone numbers */
	get_next_init (&next_mail, &next_home, &next_work, &next_fax,
		       &next_other, &next_main, &next_pager, &next_mobile);

	for (i = entryPhone1; i <= entryPhone5; i++) {
		int phonelabel = address.phoneLabel[i - entryPhone1];
		char *phonenum = get_entry_text (address, i);

		if (phonelabel == LABEL_EMAIL && !is_next_done (next_mail)) {
			e_contact_set (contact, next_mail, phonenum);
			next_mail = get_next_mail (&next_mail);
		} else if (phonelabel == LABEL_HOME && !is_next_done (next_home)) {
			e_contact_set (contact, next_home, phonenum);
			next_home = get_next_home (&next_home);
		} else if (phonelabel == LABEL_WORK && !is_next_done (next_work)) {
			e_contact_set (contact, next_work, phonenum);
			next_work = get_next_work (&next_work);
		} else if (phonelabel == LABEL_FAX && !is_next_done (next_fax)) {
			e_contact_set (contact, next_fax, phonenum);
			next_fax = get_next_fax (&next_fax);
		} else if (phonelabel == LABEL_OTHER && !is_next_done (next_other)) {
			e_contact_set (contact, next_other, phonenum);
			next_other = get_next_other (&next_other);
		} else if (phonelabel == LABEL_MAIN && !is_next_done (next_main)) {
			e_contact_set (contact, next_main, phonenum);
			next_main = get_next_main (&next_main);
		} else if (phonelabel == LABEL_PAGER && !is_next_done (next_pager)) {
			e_contact_set (contact, next_pager, phonenum);
			next_pager = get_next_pager (&next_pager);
		} else if (phonelabel == LABEL_MOBILE && !is_next_done (next_mobile)) {
			e_contact_set (contact, next_mobile, phonenum);
			next_mobile = get_next_mobile (&next_mobile);
		}

		g_free (phonenum);
	}

	/* Note */
	set_contact_text (contact, E_CONTACT_NOTE, address, entryNote);

	free_Address(&address);

	return contact;
}
Beispiel #2
0
/* Get username entry box text */
static void get_username(void)
{
    TRACE(stdout, "%s", "Getting username entry box text...");
    get_entry_text(&user, &USERNAME);
    TRACE(stdout, "%s", "Done getting username text.");
} 
Beispiel #3
0
/* Get password entry box text */
static void get_password(void)
{
    TRACE(stdout, "%s", "Getting password entry box text...");
    get_entry_text(&pass, &PASSWORD);
    TRACE(stdout, "%s", "Done getting password text.");
} 
Beispiel #4
0
void
Snes9xPreferences::get_settings_from_dialog (void)
{
    int sound_needs_restart = 0;
    int gfx_needs_restart = 0;

    if ((config->sound_driver       != get_combo ("sound_driver"))          ||
        (config->mute_sound         != get_check ("mute_sound_check"))      ||
        (config->sound_buffer_size  != (int) get_spin ("sound_buffer_size"))||
        (Settings.Stereo            != get_check ("stereo_check"))          ||
        (config->sound_playback_rate !=
                     (7 - (get_combo ("playback_combo"))))                  ||
        (config->sound_input_rate   != get_slider ("sound_input_rate"))     ||
        (Settings.SoundSync         != get_check ("sync_sound"))
        )
    {
        sound_needs_restart = 1;
    }

#ifdef USE_XRANDR
    if ((config->change_display_resolution != get_check ("change_display_resolution") ||
            (config->change_display_resolution &&
                    (config->xrr_index != get_combo ("resolution_combo")))) &&
        config->fullscreen)
    {
        top_level->leave_fullscreen_mode ();
        config->xrr_index = get_combo ("resolution_combo");
        config->xrr_width = config->xrr_sizes[config->xrr_index].width;
        config->xrr_height = config->xrr_sizes[config->xrr_index].height;
        config->change_display_resolution = get_check ("change_display_resolution");
        top_level->enter_fullscreen_mode ();
    }
    else
    {
        config->xrr_index = get_combo ("resolution_combo");
        config->xrr_width = config->xrr_sizes[config->xrr_index].width;
        config->xrr_height = config->xrr_sizes[config->xrr_index].height;
    }
#endif

    config->change_display_resolution = get_check ("change_display_resolution");

    if (config->multithreading != get_check ("multithreading"))
        gfx_needs_restart = 1;

    if (config->hw_accel != hw_accel_value (get_combo ("hw_accel")))
        gfx_needs_restart = 1;

    if (config->force_inverted_byte_order != get_check ("force_inverted_byte_order"))
        gfx_needs_restart = 1;

#ifdef USE_OPENGL
#endif

    config->full_screen_on_open       = get_check ("full_screen_on_open");
    Settings.DisplayFrameRate         = get_check ("show_frame_rate");
    config->scale_to_fit              = get_check ("scale_to_fit");
    config->overscan                  = get_check ("overscan");
    config->maintain_aspect_ratio     = get_check ("maintain_aspect_ratio");
    config->aspect_ratio              = get_combo ("aspect_ratio");
    config->scale_method              = get_combo ("scale_method_combo");
    config->hires_effect              = get_combo ("hires_effect");
    config->force_inverted_byte_order = get_check ("force_inverted_byte_order");
    Settings.AutoSaveDelay            = get_entry_value ("save_sram_after_sec");
    config->multithreading            = get_check ("multithreading");
    config->pause_emulation_on_switch = get_check ("pause_emulation_on_switch");
    Settings.SkipFrames               = get_combo ("frameskip_combo");
    Settings.BlockInvalidVRAMAccessMaster   = get_check ("block_invalid_vram_access");
    Settings.UpAndDown                = get_check ("upanddown");
    config->sound_driver              = get_combo ("sound_driver");
    Settings.Stereo                   = get_check ("stereo_check");
    config->sound_playback_rate       = 7 - (get_combo ("playback_combo"));
    config->sound_buffer_size         = get_spin ("sound_buffer_size");
    config->sound_input_rate          = get_slider ("sound_input_rate");
    Settings.SoundSync                = get_check ("sync_sound");
    config->mute_sound                = get_check ("mute_sound_check");

    store_ntsc_settings ();
    config->ntsc_scanline_intensity   = get_combo ("ntsc_scanline_intensity");
    config->scanline_filter_intensity = get_combo ("scanline_filter_intensity");
    config->hw_accel                  = hw_accel_value (get_combo ("hw_accel"));
    config->bilinear_filter           = get_check ("bilinear_filter");
    config->num_threads               = get_spin ("num_threads");
    config->default_esc_behavior      = get_combo ("default_esc_behavior");
    config->prevent_screensaver       = get_check ("prevent_screensaver");

#ifdef USE_JOYSTICK
    config->joystick_threshold        = get_spin ("joystick_threshold");
#endif

#ifdef USE_OPENGL
    if (config->sync_to_vblank != get_check ("sync_to_vblank") ||
        config->npot_textures != get_check ("npot_textures") ||
        config->use_pbos != get_check ("use_pbos") ||
        config->pbo_format != get_combo ("pixel_format") ||
        config->use_shaders != get_check ("use_shaders") ||
        get_check ("use_shaders"))
    {
        gfx_needs_restart = 1;
    }

    config->sync_to_vblank            = get_check ("sync_to_vblank");
    config->use_pbos                  = get_check ("use_pbos");
    config->npot_textures             = get_check ("npot_textures");
    config->use_shaders               = get_check ("use_shaders");
    config->sync_every_frame          = get_check ("sync_every_frame");

    strncpy (config->fragment_shader, get_entry_text ("fragment_shader"), PATH_MAX);

    config->pbo_format = get_combo ("pixel_format");
#endif
    char safety_sram_directory [PATH_MAX];

    strncpy (safety_sram_directory, get_entry_text ("sram_directory"), PATH_MAX);
    strncpy (config->savestate_directory, get_entry_text ("savestate_directory"), PATH_MAX);
    strncpy (config->patch_directory, get_entry_text ("patch_directory"), PATH_MAX);
    strncpy (config->cheat_directory, get_entry_text ("cheat_directory"), PATH_MAX);
    strncpy (config->export_directory, get_entry_text ("export_directory"), PATH_MAX);

    if (!strcmp (safety_sram_directory, SAME_GAME))
        safety_sram_directory[0] = '\0';
    if (!strcmp (config->savestate_directory, SAME_GAME))
        config->savestate_directory[0] = '\0';
    if (!strcmp (config->patch_directory, SAME_GAME))
        config->patch_directory[0] = '\0';
    if (!strcmp (config->cheat_directory, SAME_GAME))
        config->cheat_directory[0] = '\0';
    if (!strcmp (config->export_directory, SAME_GAME))
        config->export_directory[0] = '\0';

    if (strcmp (safety_sram_directory, config->sram_directory) && config->rom_loaded)
    {
        GtkWidget *msg;
        int responseid;

        msg = gtk_message_dialog_new (GTK_WINDOW (this->window),
                                      GTK_DIALOG_DESTROY_WITH_PARENT,
                                      GTK_MESSAGE_WARNING,
                                      GTK_BUTTONS_OK_CANCEL,
                                      _("Changing the SRAM directory with a game loaded will replace the .srm file in the selected directory with the SRAM from the running game. If this is not what you want, click 'cancel'."));
        gtk_window_set_title (GTK_WINDOW (msg), _("Warning: Possible File Overwrite"));

        responseid = gtk_dialog_run (GTK_DIALOG (msg));

        if (responseid == GTK_RESPONSE_OK)
        {
            strncpy (config->sram_directory, safety_sram_directory, PATH_MAX);
        }
        else
        {
            if (config->sram_directory[0] == '\0')
                set_entry_text ("sram_directory", SAME_GAME);
            else
                set_entry_text ("sram_directory", config->sram_directory);
        }

        gtk_widget_destroy (msg);
    }
    else
    {
        strncpy (config->sram_directory, safety_sram_directory, PATH_MAX);
    }

    if (Settings.SkipFrames == 0)
        Settings.SkipFrames = AUTO_FRAMERATE;
    else
        Settings.SkipFrames--;

    memcpy (config->pad, pad, (sizeof (JoypadBinding)) * NUM_JOYPADS);
    memcpy (config->shortcut, shortcut, (sizeof (Binding)) * NUM_EMU_LINKS);

    if (sound_needs_restart)
    {
        S9xPortSoundReinit ();
    }

    if (gfx_needs_restart)
    {
        S9xReinitDisplay ();
    }
    else
    {
        S9xDisplayReconfigure ();
        S9xDisplayRefresh (top_level->last_width, top_level->last_height);

        if (config->rom_loaded)
            S9xDeinitUpdate (top_level->last_width, top_level->last_height);
    }

    top_level->configure_widgets ();

    if (config->default_esc_behavior != ESC_TOGGLE_MENUBAR)
        top_level->leave_fullscreen_mode ();

    return;
}