Пример #1
0
/**
 * Test whether we can move off format page.
 * \return <i>TRUE</i> if OK to move off page.
 */
static gboolean exp_html_move_format( void ) {
	gboolean retVal = FALSE;
	gint id;

	/* Set stylesheet */
	id = combobox_get_active_data(GTK_COMBO_BOX(exphtml_dlg.optmenuCSS));
	exporthtml_set_stylesheet( _exportCtl_, id );

	/* Set name format */
	id = combobox_get_active_data(GTK_COMBO_BOX(exphtml_dlg.optmenuName));
	exporthtml_set_name_format( _exportCtl_, id );

	exporthtml_set_banding( _exportCtl_,
		gtk_toggle_button_get_active(
			GTK_TOGGLE_BUTTON( exphtml_dlg.checkBanding ) ) );
	exporthtml_set_link_email( _exportCtl_,
		gtk_toggle_button_get_active(
			GTK_TOGGLE_BUTTON( exphtml_dlg.checkLinkEMail ) ) );
	exporthtml_set_attributes( _exportCtl_,
		gtk_toggle_button_get_active(
			GTK_TOGGLE_BUTTON( exphtml_dlg.checkAttributes ) ) );

	/* Process export */
	exporthtml_process( _exportCtl_, _addressCache_ );
	if( _exportCtl_->retVal == MGU_SUCCESS ) {
		retVal = TRUE;
	}
	else {
		export_html_status_show( _( "Error creating HTML file" ) );
	}
	return retVal;
}
Пример #2
0
static void export_ldif_relative_dn_changed(GtkWidget *widget, gpointer data)
{
	gint relativeDN = combobox_get_active_data(GTK_COMBO_BOX(widget));
	GtkLabel *label = GTK_LABEL(data);

	switch(relativeDN) {
	case EXPORT_LDIF_ID_UID:
		gtk_label_set_text(label,
		_("The address book Unique ID is used to create a DN that is " \
		"formatted similar to:\n" \
		"  uid=102376,ou=people,dc=claws-mail,dc=org"));
		break;
	case EXPORT_LDIF_ID_DNAME:
		gtk_label_set_text(label,
		_("The address book Display Name is used to create a DN that " \
		"is formatted similar to:\n" \
		"  cn=John Doe,ou=people,dc=claws-mail,dc=org"));	
		break;
	case EXPORT_LDIF_ID_EMAIL:
		gtk_label_set_text(label, 
		_("The first Email Address belonging to a person is used to " \
		"create a DN that is formatted similar to:\n" \
		"  [email protected],ou=people,dc=claws-mail,dc=org"));	
		break;
	}
	
}
Пример #3
0
static void save_fancy_prefs_page(PrefsPage *page)
{
		FancyPrefsPage *prefs_page = (FancyPrefsPage *) page;
	
#ifdef HAVE_LIBSOUP_GNOME
		fancy_prefs.enable_gnome_proxy = gtk_toggle_button_get_active
				(GTK_TOGGLE_BUTTON(prefs_page->gnome_proxy_checkbox));
#endif
		fancy_prefs.enable_images = gtk_toggle_button_get_active
				(GTK_TOGGLE_BUTTON(prefs_page->enable_images));
		fancy_prefs.enable_remote_content = gtk_toggle_button_get_active
				(GTK_TOGGLE_BUTTON(prefs_page->enable_remote_content));
		fancy_prefs.enable_scripts = gtk_toggle_button_get_active
				(GTK_TOGGLE_BUTTON(prefs_page->enable_scripts));
		fancy_prefs.enable_plugins = gtk_toggle_button_get_active
				(GTK_TOGGLE_BUTTON(prefs_page->enable_plugins));
		fancy_prefs.enable_java = gtk_toggle_button_get_active
				(GTK_TOGGLE_BUTTON(prefs_page->enable_java));
		fancy_prefs.open_external = combobox_get_active_data
				(GTK_COMBO_BOX(prefs_page->open_external));
		fancy_prefs.enable_proxy = gtk_toggle_button_get_active
				(GTK_TOGGLE_BUTTON(prefs_page->proxy_checkbox));
		fancy_prefs.proxy_str = pref_get_pref_from_entry(GTK_ENTRY(prefs_page->proxy_str));

		save_fancy_prefs(page);
}
Пример #4
0
static void prefs_summaries_save(PrefsPage *_page)
{
	SummariesPage *page = (SummariesPage *) _page;

	prefs_common.trans_hdr = gtk_toggle_button_get_active(
			GTK_TOGGLE_BUTTON(page->checkbtn_transhdr));


	prefs_common.display_folder_unread = combobox_get_active_data(
			GTK_COMBO_BOX(page->optmenu_folder_unread));

	prefs_common.use_addr_book = gtk_toggle_button_get_active(
			GTK_TOGGLE_BUTTON(page->checkbtn_useaddrbook));
	prefs_common.show_tooltips = gtk_toggle_button_get_active(
			GTK_TOGGLE_BUTTON(page->checkbtn_show_tooltips));
	prefs_common.thread_by_subject = gtk_toggle_button_get_active(
			GTK_TOGGLE_BUTTON(page->checkbtn_threadsubj));
	prefs_common.ng_abbrev_len = gtk_spin_button_get_value_as_int(
			GTK_SPIN_BUTTON(page->spinbtn_ng_abbrev_len));
	
	g_free(prefs_common.date_format); 
	prefs_common.date_format = gtk_editable_get_chars(
			GTK_EDITABLE(page->entry_datefmt), 0, -1);	

	prefs_common.goto_last_folder_on_startup = gtk_toggle_button_get_active(
		GTK_TOGGLE_BUTTON(page->checkbtn_reopen_last_folder));
	prefs_common.always_show_msg = combobox_get_active_data(
		GTK_COMBO_BOX(page->optmenu_always_show_msg));
	prefs_common.mark_as_read_on_new_window = gtk_toggle_button_get_active(
		GTK_TOGGLE_BUTTON(page->checkbtn_mark_as_read_on_newwin));
	prefs_common.immediate_exec = gtk_toggle_button_get_active(
		GTK_TOGGLE_BUTTON(page->checkbtn_immedexec));
	prefs_common.ask_mark_all_read = gtk_toggle_button_get_active(
		GTK_TOGGLE_BUTTON(page->checkbtn_ask_mark_all_read));
	prefs_common.mark_as_read_delay = gtk_spin_button_get_value_as_int(
			GTK_SPIN_BUTTON(page->spinbtn_mark_as_read_delay));

	prefs_common.default_sort_key = combobox_get_active_data(
			GTK_COMBO_BOX(page->optmenu_sort_key));
	prefs_common.default_sort_type = combobox_get_active_data(
			GTK_COMBO_BOX(page->optmenu_sort_type));
	prefs_common.next_unread_msg_dialog = combobox_get_active_data(
			GTK_COMBO_BOX(page->optmenu_nextunreadmsgdialog));
	main_window_reflect_prefs_all();
}
Пример #5
0
/**
 * Test whether we can move off distinguished name page.
 * \return <i>TRUE</i> if OK to move off page.
 */
static gboolean exp_ldif_move_dn( void ) {
	gboolean retVal = FALSE;
	gboolean errFlag = FALSE;
	gchar *suffix;
	gint id;

	/* Set suffix */
	suffix = gtk_editable_get_chars( GTK_EDITABLE(expldif_dlg.entrySuffix), 0, -1 );
	g_strstrip( suffix );

	/* Set RDN format */
	id = combobox_get_active_data(GTK_COMBO_BOX(expldif_dlg.optmenuRDN));
	exportldif_set_rdn( _exportCtl_, id );

	exportldif_set_suffix( _exportCtl_, suffix );
	exportldif_set_use_dn( _exportCtl_,
		gtk_toggle_button_get_active(
			GTK_TOGGLE_BUTTON( expldif_dlg.checkUseDN ) ) );
	exportldif_set_exclude_email( _exportCtl_,
		gtk_toggle_button_get_active(
			GTK_TOGGLE_BUTTON( expldif_dlg.checkEMail ) ) );

	if( *suffix == '\0' || strlen( suffix ) < 1 ) {
		AlertValue aval;

		aval = alertpanel(
			_( "Suffix was not supplied" ),
			_(
				"A suffix is required if data is to be used " \
				"for an LDAP server. Are you sure you wish " \
				"to proceed without a suffix?"
			 ),
			GTK_STOCK_NO, GTK_STOCK_YES, NULL );
		if( aval != G_ALERTALTERNATE ) {
			gtk_widget_grab_focus( expldif_dlg.entrySuffix );
			errFlag = TRUE;
		}
	}

	if( ! errFlag ) {
		/* Process export */
		exportldif_process( _exportCtl_, _addressCache_ );
		if( _exportCtl_->retVal == MGU_SUCCESS ) {
			retVal = TRUE;
		}
		else {
			export_ldif_status_show( _( "Error creating LDIF file" ) );
		}
	}

	return retVal;
}
Пример #6
0
/*!
 *\brief	Returns action from the content of the dialog
 *
 *\param	alert specifies whether alert dialog boxes should be shown
 *                or not.
 *
 *\return	FilteringAction * action entered in the dialog box.
 */
static FilteringAction * prefs_filtering_action_dialog_to_action(gboolean alert)
{
	Action action_id;
	gint action_type;
	gint list_id;
	gint account_id;
	gchar * destination = NULL;
	gint labelcolor = 0;
        FilteringAction * action;
        gint score;
	gchar * header = NULL;
        
	action_id = combobox_get_active_data(GTK_COMBO_BOX(filtering_action.action_combo));
	action_type = prefs_filtering_action_get_matching_from_action(action_id);
	list_id = gtk_combo_box_get_active(GTK_COMBO_BOX(filtering_action.account_combo));
	account_id = get_account_id_from_list_id(list_id);
        score = 0;
        destination = NULL;
        
	switch (action_id) {
	case ACTION_MOVE:
	case ACTION_COPY:
	case ACTION_EXECUTE:
		destination = gtk_editable_get_chars(GTK_EDITABLE(filtering_action.dest_entry), 0, -1);
		if (*destination == '\0') {
			if (alert)
                                alertpanel_error(action_id == ACTION_EXECUTE 
						 ? _("Command-line not set")
						 : _("Destination is not set."));
			g_free(destination);
			return NULL;
		}
		break;
	case ACTION_FORWARD:
	case ACTION_FORWARD_AS_ATTACHMENT:
	case ACTION_REDIRECT:
		destination = gtk_editable_get_chars(GTK_EDITABLE(filtering_action.dest_entry), 0, -1);
		if (*destination == '\0') {
			if (alert)
                                alertpanel_error(_("Recipient is not set."));
			g_free(destination);
			return NULL;
		}
		break;
#if !GTK_CHECK_VERSION(3, 0, 0)
	case ACTION_COLOR:
		labelcolor = colorlabel_get_color_menu_active_item(
			gtk_cmoption_menu_get_menu(GTK_CMOPTION_MENU(filtering_action.color_optmenu)));
		destination = NULL;	
		break;
#endif
        case ACTION_CHANGE_SCORE:
        case ACTION_SET_SCORE:
        	score = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(
						filtering_action.score_entry));
		if (!score && action_id == ACTION_CHANGE_SCORE) {
			if (alert)
                                alertpanel_error(_("Score is not set"));
			return NULL;
		}
                break;
	case ACTION_ADD_TO_ADDRESSBOOK:
		header = gtk_editable_get_chars(GTK_EDITABLE(filtering_action.header_entry), 0, -1);
		if (*header == '\0') {
			if (alert)
                                alertpanel_error(_("Header is not set."));
			g_free(header);
			return NULL;
		}
		destination = gtk_editable_get_chars(GTK_EDITABLE(filtering_action.dest_entry), 0, -1);
		if (*destination == '\0') {
			if (alert)
                                alertpanel_error(_("Target addressbook/folder is not set."));
			g_free(destination);
			return NULL;
		}
		break;
	case ACTION_SET_TAG:
	case ACTION_UNSET_TAG:
#if !GTK_CHECK_VERSION(2, 24, 0)
		destination = gtk_combo_box_get_active_text(GTK_COMBO_BOX(filtering_action.tags_combo));
#else
		destination = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(filtering_action.tags_combo));
#endif
		if (!destination || *destination == '\0') {
			if (alert)
                                alertpanel_error(_("Tag name is empty."));
			g_free(destination);
			return NULL;
		}
		break;
	case ACTION_STOP:
	case ACTION_HIDE:
	case ACTION_IGNORE:
	case ACTION_WATCH:
        case ACTION_DELETE:
        case ACTION_MARK:
        case ACTION_UNMARK:
        case ACTION_LOCK:
        case ACTION_UNLOCK:
        case ACTION_MARK_AS_READ:
        case ACTION_MARK_AS_UNREAD:
        case ACTION_MARK_AS_SPAM:
        case ACTION_MARK_AS_HAM:
        case ACTION_CLEAR_TAGS:
	default:
		break;
	}
	action = filteringaction_new(action_type, account_id,
            destination, labelcolor, score, header);
	
	g_free(destination);
	return action;
}