Merge new-ui-branch to the trunk.
svn path=/trunk/; revision=22964
This commit is contained in:
parent
0e19f2c16d
commit
0fb08f3ff8
@ -96,6 +96,12 @@ extern "C" {
|
||||
* SWIGSTATIC.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.2 2003/10/21 18:28:33 ettore
|
||||
* Merge new-ui-branch to the trunk.
|
||||
*
|
||||
* Revision 1.1.2.1 2003/09/23 19:43:57 ettore
|
||||
* Sync with trunk, and fixicate a bit so it still works.
|
||||
*
|
||||
* Revision 1.1 2003/09/11 22:04:08 hansp
|
||||
* Import new libical from mainline HEAD and make appropriate changes to
|
||||
* Evolution.
|
||||
|
@ -2,7 +2,7 @@
|
||||
# FILE: Makefile.am
|
||||
# CREATOR: eric
|
||||
#
|
||||
# $Id: Makefile.am,v 1.40 2003/10/09 21:02:23 fejj Exp $
|
||||
# $Id: Makefile.am,v 1.41 2003/10/21 18:28:29 ettore Exp $
|
||||
#
|
||||
#
|
||||
# (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
|
@ -3,7 +3,7 @@
|
||||
FILE: icalderivedparameters.{c,h}
|
||||
CREATOR: eric 09 May 1999
|
||||
|
||||
$Id: icalderivedparameter.c.in,v 1.2 2003/09/11 22:04:19 hansp Exp $
|
||||
$Id: icalderivedparameter.c.in,v 1.3 2003/10/21 18:28:29 ettore Exp $
|
||||
$Locker: $
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
CREATOR: eric 20 March 1999
|
||||
|
||||
|
||||
$Id: icalderivedparameter.h.in,v 1.2 2003/09/11 22:04:19 hansp Exp $
|
||||
$Id: icalderivedparameter.h.in,v 1.3 2003/10/21 18:28:29 ettore Exp $
|
||||
$Locker: $
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
FILE: icalderivedproperty.c
|
||||
CREATOR: eric 15 Feb 2001
|
||||
|
||||
$Id: icalderivedproperty.c.in,v 1.2 2003/09/11 22:04:19 hansp Exp $
|
||||
$Id: icalderivedproperty.c.in,v 1.3 2003/10/21 18:28:29 ettore Exp $
|
||||
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
|
@ -3,7 +3,7 @@
|
||||
FILE: icalderivedproperties.{c,h}
|
||||
CREATOR: eric 09 May 1999
|
||||
|
||||
$Id: icalderivedproperty.h.in,v 1.2 2003/09/11 22:04:19 hansp Exp $
|
||||
$Id: icalderivedproperty.h.in,v 1.3 2003/10/21 18:28:29 ettore Exp $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
======================================================================*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
FILE: icalvalue.c
|
||||
CREATOR: eric 02 May 1999
|
||||
|
||||
$Id: icalderivedvalue.c.in,v 1.4 2003/09/11 22:04:19 hansp Exp $
|
||||
$Id: icalderivedvalue.c.in,v 1.5 2003/10/21 18:28:29 ettore Exp $
|
||||
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
|
@ -4,7 +4,7 @@
|
||||
CREATOR: eric 20 March 1999
|
||||
|
||||
|
||||
$Id: icalderivedvalue.h.in,v 1.3 2003/09/11 22:04:19 hansp Exp $
|
||||
$Id: icalderivedvalue.h.in,v 1.4 2003/10/21 18:28:29 ettore Exp $
|
||||
$Locker: $
|
||||
|
||||
|
||||
|
161
libical/src/libical/icallexer.l
Normal file
161
libical/src/libical/icallexer.l
Normal file
@ -0,0 +1,161 @@
|
||||
%{
|
||||
/* -*- Mode: C -*-
|
||||
======================================================================
|
||||
FILE: icallexer.l
|
||||
CREATOR: eric 10 June 1999
|
||||
|
||||
DESCRIPTION:
|
||||
|
||||
$Id: icallexer.l,v 1.10 2003/10/21 18:28:28 ettore Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 1999 Eric Busboom
|
||||
http://www.softwarestudio.org
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License
|
||||
Version 1.0 (the "License"); you may not use this file except in
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
the License for the specific language governing rights and
|
||||
limitations under the License.
|
||||
|
||||
The original author is Eric Busboom
|
||||
The original code is icalitip.y
|
||||
|
||||
|
||||
|
||||
======================================================================*/
|
||||
#include "icalparser.h"
|
||||
#include "icalenums.h"
|
||||
#include "icalmemory.h"
|
||||
#include "assert.h"
|
||||
#include "icalyacc.h"
|
||||
|
||||
#include <string.h> /* For strdup() */
|
||||
|
||||
int icalparser_flex_input(char* buf, int max_size);
|
||||
void icalparser_clear_flex_input(void);
|
||||
|
||||
|
||||
#define ICAL_MAX_STR_CONST 1024
|
||||
|
||||
#undef YY_INPUT
|
||||
#define YY_INPUT(b,r,ms) ( r= icalparser_flex_input(b,ms))
|
||||
#undef yywrap
|
||||
|
||||
#undef YY_FATAL_ERROR
|
||||
#define YY_FATAL_ERROR(msg) ical_yyerror(msg)
|
||||
|
||||
icalvalue_kind value_kind=ICAL_NO_VALUE;
|
||||
void set_parser_value_state(icalvalue_kind kind);
|
||||
extern int yydebug;
|
||||
|
||||
void ical_yyerror(char *s);
|
||||
|
||||
void init_str_buf(void);
|
||||
|
||||
int last_state;
|
||||
|
||||
char *str_buf;
|
||||
char *str_buf_p;
|
||||
size_t buf_sz; /* = ICAL_MAX_STR_CONST;*/
|
||||
|
||||
%}
|
||||
|
||||
crlf \x0D?\x0A
|
||||
space [ ]
|
||||
qsafechar [^\x00-\x1F\"]
|
||||
safechar [^\x00-\x1F\"\:\;\,]
|
||||
tsafechar [\x20-\x21\x23-\x2B\x2D-\x39\x3C-\x5B\x5D-\x7E]
|
||||
valuechar [^\x00-\x08\x10-\x1F]
|
||||
xname X-[a-zA-Z0-9\-]+
|
||||
xname2 [a-zA-Z0-9\-\ ]
|
||||
paramtext {safechar}+
|
||||
value {valuechar}+
|
||||
quotedstring \"{qsafechar}+\"
|
||||
digit [0-9]
|
||||
|
||||
%array /* Make yytext an array. Slow, but handy. HACK */
|
||||
|
||||
%option caseless
|
||||
|
||||
%s quoted_string
|
||||
%s binary_value boolean_value uri_value time_value duration_value number_value period_value recur_value text_value utcoffset_value
|
||||
%s enum_param_value string_param_value stringlist_param_value keyword line_start component seperator parameter end_of_value paramtext
|
||||
|
||||
|
||||
|
||||
%%
|
||||
|
||||
%{
|
||||
%}
|
||||
|
||||
|
||||
<time_value>{
|
||||
{digit}+ { ical_yylval.v_string =icalmemory_tmp_copy(yytext) ;
|
||||
return DIGITS; }
|
||||
T { return TIME_CHAR; }
|
||||
Z { return UTC_CHAR; }
|
||||
[\/\+\-PWHMSD] { return yytext[0]; }
|
||||
{crlf} { return EOL;}
|
||||
|
||||
}
|
||||
|
||||
<utcoffset_value>{
|
||||
{crlf} { return EOL;}
|
||||
\-|\+ { return yytext[0]; }
|
||||
{digit}{digit} { ical_yylval.v_int=atoi(yytext); return INTNUMBER; }
|
||||
|
||||
}
|
||||
|
||||
<enum_param_value>{
|
||||
. { return CHARACTER; }
|
||||
{crlf} { return EOL;}
|
||||
|
||||
}
|
||||
|
||||
<seperator>{
|
||||
, { BEGIN(last_state); return COMMA; }
|
||||
}
|
||||
|
||||
|
||||
%%
|
||||
|
||||
int yywrap()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void set_parser_value_state(icalvalue_kind kind)
|
||||
{
|
||||
|
||||
switch (kind){
|
||||
|
||||
case ICAL_UTCOFFSET_VALUE:
|
||||
{BEGIN(utcoffset_value);break;}
|
||||
|
||||
case ICAL_DATETIMEPERIOD_VALUE:
|
||||
case ICAL_DURATION_VALUE:
|
||||
case ICAL_PERIOD_VALUE:
|
||||
{BEGIN(time_value);break;}
|
||||
|
||||
default:
|
||||
{
|
||||
assert(1==0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void init_str_buf(void)
|
||||
{
|
||||
str_buf = icalmemory_tmp_buffer(ICAL_MAX_STR_CONST);
|
||||
str_buf_p = str_buf;
|
||||
buf_sz = ICAL_MAX_STR_CONST;
|
||||
|
||||
|
||||
}
|
||||
|
417
libical/src/libical/icalyacc.y
Normal file
417
libical/src/libical/icalyacc.y
Normal file
@ -0,0 +1,417 @@
|
||||
%{
|
||||
/* -*- Mode: C -*-
|
||||
======================================================================
|
||||
FILE: icalitip.y
|
||||
CREATOR: eric 10 June 1999
|
||||
|
||||
DESCRIPTION:
|
||||
|
||||
$Id: icalyacc.y,v 1.16 2003/10/21 18:28:27 ettore Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 1999 Eric Busboom
|
||||
http://www.softwarestudio.org
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License
|
||||
Version 1.0 (the "License"); you may not use this file except in
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
the License for the specific language governing rights and
|
||||
limitations under the License.
|
||||
|
||||
The original author is Eric Busboom
|
||||
The original code is icalitip.y
|
||||
|
||||
|
||||
|
||||
=======================================================================*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h> /* for strdup() */
|
||||
#include "icalparser.h"
|
||||
#include "pvl.h"
|
||||
|
||||
icalvalue *icalparser_yy_value; /* Current Value */
|
||||
|
||||
void ical_yyerror(char* s);
|
||||
void icalparser_clear_flex_input();
|
||||
int ical_yy_lex(void);
|
||||
|
||||
/* Globals for UTCOFFSET values */
|
||||
int utc;
|
||||
int utc_b;
|
||||
int utcsign;
|
||||
|
||||
/* Globals for DURATION values */
|
||||
struct icaldurationtype duration;
|
||||
|
||||
/* Globals for TRIGGER values */
|
||||
struct icaltriggertype trigger;
|
||||
|
||||
void copy_list(short* array, size_t size);
|
||||
void add_prop(icalproperty_kind);
|
||||
void icalparser_fill_date(struct tm* t, char* dstr);
|
||||
void icalparser_fill_time(struct tm* t, char* tstr);
|
||||
void set_value_type(icalvalue_kind kind);
|
||||
void set_parser_value_state();
|
||||
struct icaltimetype fill_datetime(char* d, char* t);
|
||||
void ical_yy_error(char *s); /* Don't know why I need this.... */
|
||||
int yylex(void); /* Or this. */
|
||||
|
||||
|
||||
|
||||
/* Set the state of the lexer so it will interpret values ( iCAL
|
||||
VALUEs, that is, ) correctly. */
|
||||
|
||||
%}
|
||||
|
||||
%union {
|
||||
float v_float;
|
||||
int v_int;
|
||||
char* v_string;
|
||||
}
|
||||
|
||||
|
||||
/* Renaming hack */
|
||||
|
||||
/*
|
||||
#define yymaxdepth ical_yy_maxdepth
|
||||
#define yyparse ical_yy_parse
|
||||
#define yyerror ical_yy_error
|
||||
#define yylval ical_yy_lval
|
||||
#define yychar ical_yy_char
|
||||
#define yydebug ical_yy_debug
|
||||
#define yypact ical_yy_pact
|
||||
#define yyr1 ical_yy_r1
|
||||
#define yyr2 ical_yy_r2
|
||||
#define yydef ical_yy_def
|
||||
#define yychk ical_yy_chk
|
||||
#define yypgo ical_yy_pgo
|
||||
#define yyact ical_yy_act
|
||||
#define yyexca ical_yy_exca
|
||||
#define yyerrflag ical_yy_errflag
|
||||
#define yynerrs ical_yy_nerrs
|
||||
#define yyps ical_yy_ps
|
||||
#define yypv ical_yy_pv
|
||||
#define yys ical_yy_s
|
||||
#define yy_yys ical_yy_yys
|
||||
#define yystate ical_yy_state
|
||||
#define yytmp ical_yy_tmp
|
||||
#define yyv ical_yy_v
|
||||
#define yy_yyv ical_yy_yyv
|
||||
#define yyval ical_yy_val
|
||||
#define yylloc ical_yy_lloc
|
||||
#define yyreds ical_yy_reds
|
||||
#define yytoks ical_yy_toks
|
||||
#define yylhs ical_yy_yylhs
|
||||
#define yylen ical_yy_yylen
|
||||
#define yydefred ical_yy_yydefred
|
||||
#define yydgoto ical_yy_yydgoto
|
||||
#define yydefred ical_yy_yydefred
|
||||
#define yydgoto ical_yy_yydgoto
|
||||
#define yysindex ical_yy_yysindex
|
||||
#define yyrindex ical_yy_yyrindex
|
||||
#define yygindex ical_yy_yygindex
|
||||
#define yytable ical_yy_yytable
|
||||
#define yycheck ical_yy_yycheck
|
||||
#define yyname ical_yy_yyname
|
||||
#define yyrule ical_yy_yyrule
|
||||
#define yy_scan_bytes ical_yy_scan_bytes
|
||||
#define yy_scan_string ical_yy_scan_string
|
||||
#define yy_scan_buffer ical_yy_scan_buffer
|
||||
*/
|
||||
|
||||
/* These are redefined with the -P option to flex */
|
||||
/*
|
||||
#define yy_create_buffer ical_yy_create_buffer
|
||||
#define yy_delete_buffer ical_yy_delete_buffer
|
||||
#define yy_flex_debug ical_yy_flex_debug
|
||||
#define yy_init_buffer ical_yy_init_buffer
|
||||
#define yy_flush_buffer ical_yy_flush_buffer
|
||||
#define yy_load_buffer_state ical_yy_load_buffer_state
|
||||
#define yy_switch_to_buffer ical_yy_switch_to_buffer
|
||||
#define yyin ical_yyin
|
||||
#define yyleng ical_yyleng
|
||||
#define yylex ical_yylex
|
||||
#define yylineno ical_yylineno
|
||||
#define yyout ical_yyout
|
||||
#define yyrestart ical_yyrestart
|
||||
#define yytext ical_yytext
|
||||
#define yywrap ical_yywrap
|
||||
*/
|
||||
|
||||
|
||||
%token <v_string> DIGITS
|
||||
%token <v_int> INTNUMBER
|
||||
%token <v_float> FLOATNUMBER
|
||||
%token <v_string> STRING
|
||||
%token EOL EQUALS CHARACTER COLON COMMA SEMICOLON MINUS TIMESEPERATOR
|
||||
|
||||
%token TRUE FALSE
|
||||
|
||||
%token FREQ BYDAY BYHOUR BYMINUTE BYMONTH BYMONTHDAY BYSECOND BYSETPOS BYWEEKNO
|
||||
%token BYYEARDAY DAILY MINUTELY MONTHLY SECONDLY WEEKLY HOURLY YEARLY
|
||||
%token INTERVAL COUNT UNTIL WKST MO SA SU TU WE TH FR
|
||||
|
||||
%token BIT8 ACCEPTED ADD AUDIO BASE64 BINARY BOOLEAN BUSY BUSYTENTATIVE
|
||||
%token BUSYUNAVAILABLE CALADDRESS CANCEL CANCELLED CHAIR CHILD COMPLETED
|
||||
%token CONFIDENTIAL CONFIRMED COUNTER DATE DATETIME DECLINECOUNTER DECLINED
|
||||
%token DELEGATED DISPLAY DRAFT DURATION EMAIL END FINAL FLOAT FREE GREGORIAN
|
||||
%token GROUP INDIVIDUAL INPROCESS INTEGER NEEDSACTION NONPARTICIPANT
|
||||
%token OPAQUE OPTPARTICIPANT PARENT PERIOD PRIVATE PROCEDURE PUBLIC PUBLISH
|
||||
%token RECUR REFRESH REPLY REQPARTICIPANT REQUEST RESOURCE ROOM SIBLING
|
||||
%token START TENTATIVE TEXT THISANDFUTURE THISANDPRIOR TIME TRANSPAENT
|
||||
%token UNKNOWN UTCOFFSET XNAME
|
||||
|
||||
%token ALTREP CN CUTYPE DAYLIGHT DIR ENCODING EVENT FBTYPE FMTTYPE LANGUAGE
|
||||
%token MEMBER PARTSTAT RANGE RELATED RELTYPE ROLE RSVP SENTBY STANDARD URI
|
||||
|
||||
%token TIME_CHAR UTC_CHAR
|
||||
|
||||
|
||||
%%
|
||||
|
||||
value:
|
||||
date_value
|
||||
| datetime_value
|
||||
| duration_value
|
||||
| period_value
|
||||
| utcoffset_value
|
||||
| error {
|
||||
icalparser_yy_value = 0;
|
||||
icalparser_clear_flex_input();
|
||||
yyclearin;
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
date_value: DIGITS
|
||||
{
|
||||
struct icaltimetype stm;
|
||||
|
||||
stm = fill_datetime($1,0);
|
||||
|
||||
stm.hour = -1;
|
||||
stm.minute = -1;
|
||||
stm.second = -1;
|
||||
stm.is_utc = 0;
|
||||
stm.is_date = 1;
|
||||
|
||||
icalparser_yy_value = icalvalue_new_date(stm);
|
||||
}
|
||||
;
|
||||
|
||||
utc_char:
|
||||
/*empty*/ {utc = 0;}
|
||||
| UTC_CHAR {utc = 1;}
|
||||
;
|
||||
|
||||
/* This is used in the period_value, where there may be two utc characters per rule. */
|
||||
utc_char_b:
|
||||
/*empty*/ {utc_b = 0;}
|
||||
| UTC_CHAR {utc_b = 1;}
|
||||
;
|
||||
|
||||
datetime_value:
|
||||
DIGITS TIME_CHAR DIGITS utc_char
|
||||
{
|
||||
struct icaltimetype stm;
|
||||
stm = fill_datetime($1, $3);
|
||||
stm.is_utc = utc;
|
||||
stm.is_date = 0;
|
||||
|
||||
icalparser_yy_value =
|
||||
icalvalue_new_datetime(stm);
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
/* Duration */
|
||||
|
||||
|
||||
dur_date: dur_day
|
||||
| dur_day dur_time
|
||||
;
|
||||
|
||||
dur_week: DIGITS 'W'
|
||||
{
|
||||
duration.weeks = atoi($1);
|
||||
}
|
||||
;
|
||||
|
||||
dur_time: TIME_CHAR dur_hour
|
||||
{
|
||||
}
|
||||
| TIME_CHAR dur_minute
|
||||
{
|
||||
}
|
||||
| TIME_CHAR dur_second
|
||||
{
|
||||
}
|
||||
;
|
||||
|
||||
dur_hour: DIGITS 'H'
|
||||
{
|
||||
duration.hours = atoi($1);
|
||||
}
|
||||
| DIGITS 'H' dur_minute
|
||||
{
|
||||
duration.hours = atoi($1);
|
||||
}
|
||||
;
|
||||
|
||||
dur_minute: DIGITS 'M'
|
||||
{
|
||||
duration.minutes = atoi($1);
|
||||
}
|
||||
| DIGITS 'M' dur_second
|
||||
{
|
||||
duration.minutes = atoi($1);
|
||||
}
|
||||
;
|
||||
|
||||
dur_second: DIGITS 'S'
|
||||
{
|
||||
duration.seconds = atoi($1);
|
||||
}
|
||||
;
|
||||
|
||||
dur_day: DIGITS 'D'
|
||||
{
|
||||
duration.days = atoi($1);
|
||||
}
|
||||
;
|
||||
|
||||
dur_prefix: /* empty */
|
||||
{
|
||||
duration.is_neg = 0;
|
||||
}
|
||||
| '+'
|
||||
{
|
||||
duration.is_neg = 0;
|
||||
}
|
||||
| '-'
|
||||
{
|
||||
duration.is_neg = 1;
|
||||
}
|
||||
;
|
||||
|
||||
duration_value: dur_prefix 'P' dur_date
|
||||
{
|
||||
icalparser_yy_value = icalvalue_new_duration(duration);
|
||||
memset(&duration,0, sizeof(duration));
|
||||
}
|
||||
| dur_prefix 'P' dur_time
|
||||
{
|
||||
icalparser_yy_value = icalvalue_new_duration(duration);
|
||||
memset(&duration,0, sizeof(duration));
|
||||
}
|
||||
| dur_prefix 'P' dur_week
|
||||
{
|
||||
icalparser_yy_value = icalvalue_new_duration(duration);
|
||||
memset(&duration,0, sizeof(duration));
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
/* Period */
|
||||
|
||||
period_value: DIGITS TIME_CHAR DIGITS utc_char '/' DIGITS TIME_CHAR DIGITS utc_char_b
|
||||
{
|
||||
struct icalperiodtype p;
|
||||
|
||||
p.start = fill_datetime($1,$3);
|
||||
p.start.is_utc = utc;
|
||||
p.start.is_date = 0;
|
||||
|
||||
|
||||
p.end = fill_datetime($6,$8);
|
||||
p.end.is_utc = utc_b;
|
||||
p.end.is_date = 0;
|
||||
|
||||
p.duration.days = -1;
|
||||
p.duration.weeks = -1;
|
||||
p.duration.hours = -1;
|
||||
p.duration.minutes = -1;
|
||||
p.duration.seconds = -1;
|
||||
|
||||
icalparser_yy_value = icalvalue_new_period(p);
|
||||
}
|
||||
| DIGITS TIME_CHAR DIGITS utc_char '/' duration_value
|
||||
{
|
||||
struct icalperiodtype p;
|
||||
|
||||
p.start = fill_datetime($1,$3);
|
||||
p.start.is_utc = utc;
|
||||
p.start.is_date = 0;
|
||||
|
||||
p.end.year = -1;
|
||||
p.end.month = -1;
|
||||
p.end.day = -1;
|
||||
p.end.hour = -1;
|
||||
p.end.minute = -1;
|
||||
p.end.second = -1;
|
||||
|
||||
/* The duration_value rule setes the global 'duration'
|
||||
variable, but it also creates a new value in
|
||||
icalparser_yy_value. So, free that, then copy
|
||||
'duration' into the icalperiodtype struct. */
|
||||
|
||||
p.duration = icalvalue_get_duration(icalparser_yy_value);
|
||||
icalvalue_free(icalparser_yy_value);
|
||||
icalparser_yy_value = 0;
|
||||
|
||||
icalparser_yy_value = icalvalue_new_period(p);
|
||||
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
/* UTC Offset */
|
||||
|
||||
plusminus: '+' { utcsign = 1; }
|
||||
| '-' { utcsign = -1; }
|
||||
;
|
||||
|
||||
utcoffset_value:
|
||||
plusminus INTNUMBER INTNUMBER
|
||||
{
|
||||
icalparser_yy_value = icalvalue_new_utcoffset( utcsign * (($2*3600) + ($3*60)) );
|
||||
}
|
||||
|
||||
| plusminus INTNUMBER INTNUMBER INTNUMBER
|
||||
{
|
||||
icalparser_yy_value = icalvalue_new_utcoffset(utcsign * (($2*3600) + ($3*60) +($4)));
|
||||
}
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
struct icaltimetype fill_datetime(char* datestr, char* timestr)
|
||||
{
|
||||
struct icaltimetype stm;
|
||||
|
||||
memset(&stm,0,sizeof(stm));
|
||||
|
||||
if (datestr != 0){
|
||||
sscanf(datestr,"%4d%2d%2d",&(stm.year), &(stm.month),
|
||||
&(stm.day));
|
||||
}
|
||||
|
||||
if (timestr != 0){
|
||||
sscanf(timestr,"%2d%2d%2d", &(stm.hour), &(stm.minute),
|
||||
&(stm.second));
|
||||
}
|
||||
|
||||
return stm;
|
||||
|
||||
}
|
||||
|
||||
void ical_yyerror(char* s)
|
||||
{
|
||||
/*fprintf(stderr,"Parse error \'%s\'\n", s);*/
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
# FILE: Makefile.am
|
||||
# CREATOR: acampi
|
||||
#
|
||||
# $Id: Makefile.am,v 1.4 2003/10/07 14:28:18 danw Exp $
|
||||
# $Id: Makefile.am,v 1.5 2003/10/21 18:28:26 ettore Exp $
|
||||
#
|
||||
#
|
||||
# (C) COPYRIGHT 2003, Andrea Campi, mailto:a.campi@inet.it
|
||||
|
@ -2,7 +2,7 @@
|
||||
# FILE: Makefile.am
|
||||
# CREATOR: eric
|
||||
#
|
||||
# $Id: Makefile.am,v 1.21 2003/10/09 21:02:25 fejj Exp $
|
||||
# $Id: Makefile.am,v 1.22 2003/10/21 18:28:20 ettore Exp $
|
||||
#
|
||||
#
|
||||
# (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
|
@ -29,6 +29,8 @@
|
||||
#ifndef ICALGAUGE_H
|
||||
#define ICALGAUGE_H
|
||||
|
||||
#include <libical/icalcomponent.h>
|
||||
|
||||
/** @file icalgauge.h
|
||||
* @brief Routines implementing a filter for ical components
|
||||
*/
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@
|
||||
|
||||
DESCRIPTION:
|
||||
|
||||
$Id: icalsslexer.l,v 1.4 2003/09/24 02:06:52 hansp Exp $
|
||||
$Id: icalsslexer.l,v 1.5 2003/10/21 18:28:18 ettore Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@
|
||||
|
||||
DESCRIPTION:
|
||||
|
||||
$Id: icalssyacc.y,v 1.3 2003/09/24 02:06:52 hansp Exp $
|
||||
$Id: icalssyacc.y,v 1.4 2003/10/21 18:28:18 ettore Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -30,7 +30,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h> /* for strdup() */
|
||||
#include <limits.h> /* for SHRT_MAX*/
|
||||
#include "ical.h"
|
||||
#include <libical/ical.h>
|
||||
#include "icalgauge.h"
|
||||
#include "icalgaugeimpl.h"
|
||||
|
||||
|
362
mail/ChangeLog
362
mail/ChangeLog
@ -1,3 +1,85 @@
|
||||
2003-10-21 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* mail-component.c (emc_popup_properties): implement.
|
||||
(emc_popup_properties_got_folder): builds dynamic
|
||||
folder-properties dialogue.
|
||||
(emc_popup_properties_response): set the properties on the folder
|
||||
on an ok response.
|
||||
(emc_popup_properties_free): free the properties working data.
|
||||
|
||||
* mail-folder-cache.c (unset_folder_info): unhook from the right
|
||||
function for message_changed.
|
||||
|
||||
2003-10-20 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* mail-component.c (emc_popup_new_folder): pass the right object
|
||||
to set_selected(). Fixes a new real bug. Undid reformatting.
|
||||
|
||||
2003-10-17 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* mail-component.c: General compile fixes.
|
||||
(emc_popup_new_folder): Fixed to not shadow a parameter. Fixes a
|
||||
real bug.
|
||||
|
||||
* mail-component.h: Added some prototypes.
|
||||
|
||||
2003-10-13 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* em-popup.c (em_popup_create_menu_once): only hookup target free
|
||||
if we have a target set.
|
||||
|
||||
* mail-component.c (load_accounts): removed debug i accidentally
|
||||
left in.
|
||||
(emc_tree_right_click): handle right-click context menu, using an
|
||||
EMPopup table.
|
||||
(emc_popup_*): setup empty popup handlers.
|
||||
|
||||
2003-10-13 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* em-folder-selection.c (em_select_folder): asynchornous folder
|
||||
selection call.
|
||||
(emfs_folder_selected): callback for folder selected.
|
||||
|
||||
* em-folder-view.c (emfv_popup_move): implement.
|
||||
(emfv_popup_copy): "
|
||||
(emfv_popup_move_cb): async folder select callback to run it.
|
||||
|
||||
2003-10-10 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* mail-account-gui.c
|
||||
(mail_account_gui_folder_selector_button_new): use
|
||||
em_folder_selection_button.
|
||||
(mail_account_gui_new): "
|
||||
(folder_selected): "
|
||||
|
||||
* em-folder-selection-button.c: Make this use camel uri's rather
|
||||
than camelfolders.
|
||||
(set_selection): removed, redundant.
|
||||
(impl_dispose): removed, not needed.
|
||||
|
||||
* em-folder-selection-button.h: change the selected signal not to
|
||||
actually return the selection, which must get retrieved later.
|
||||
|
||||
* mail-component.c (em_uri_from_camel): create an evo mail uri
|
||||
from a camel one.
|
||||
(em_uri_to_camel): the reverse.
|
||||
|
||||
* mail-signature-editor.c (mail_signature_editor): up the version
|
||||
of the gtkhtml editor.
|
||||
|
||||
2003-10-09 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* em-folder-selection-button.c (set_selection): always set
|
||||
selected_folder, otherwise we don't unset it properly.
|
||||
|
||||
* em-folder-selection.c (em_folder_selection_run_dialog): fix a
|
||||
small memleak.
|
||||
(em_folder_selection_run_dialog_uri): do the same as run_dialog
|
||||
but take, and return physical uri's.
|
||||
|
||||
* mail-component-factory.c (factory): removed some fixme's, and
|
||||
re-hookedup the composer.
|
||||
|
||||
2003-10-09 Frederic Crozat <fcrozat@mandrakesoft.com>
|
||||
|
||||
* em-icon-stream.c: (emis_sync_close):
|
||||
@ -10,6 +92,38 @@
|
||||
create-rule-from-message bars so that we don't segfault when we
|
||||
right click with a multi-selection.
|
||||
|
||||
2003-10-08 Chris Toshok <toshok@ximian.com>
|
||||
|
||||
* em-utils.c (em_utils_camel_address_to_destination): EDestination
|
||||
=> EABDestination, and e_destination => eab_destination.
|
||||
(reply_get_composer): same.
|
||||
(post_reply_to_message): same.
|
||||
|
||||
* em-composer-utils.c (ask_confirm_for_unwanted_html_mail)
|
||||
EDestination => EABDestination, and e_destination =>
|
||||
eab_destination.
|
||||
(composer_get_message):same.
|
||||
|
||||
2003-10-08 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* mail-component.c (mail_component_peek): setup vfolders once we
|
||||
hve the component, since its setup will call mail_component_peek,
|
||||
fun recursion.
|
||||
|
||||
2003-10-08 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* mail-component.c (setup_local_folder): removed.
|
||||
(setup_local_store): setup various needed globals properly.
|
||||
(setup_account_storages): renamed to load_accounts.
|
||||
(go_online): turn on interactivity as well as onlinedness.
|
||||
|
||||
* GNOME_Evolution_Mail.server.in.in: point the preferences pages
|
||||
to the right factory.
|
||||
|
||||
2003-10-07 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* mail-component.[ch]: Fix copyrights.
|
||||
|
||||
2003-10-06 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* mail-config-druid.c (identity_prepare): Fixed.
|
||||
@ -28,6 +142,22 @@
|
||||
the first unread message for now. This is actually annoying the
|
||||
fuck out of me, Radek, and a few other people.
|
||||
|
||||
2003-10-02 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* mail-component.c (add_storage): Add the storage to the hash
|
||||
after we've initialised it.
|
||||
(mail_component_evomail_uri_from_folder): hardcode "local" account
|
||||
pseudo-id for local folders.
|
||||
(mail_component_get_folder_from_evomail_uri): handle the "local"
|
||||
account case.
|
||||
|
||||
2003-10-02 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* mail-component.c (setup_local_store): use mbox:/path rather than
|
||||
mbox:///path - the mbox code is 'wrong', but this is easier to
|
||||
fix. fixes local unread counts. maybe the provider url-compare
|
||||
should address this too.
|
||||
|
||||
2003-10-02 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com>
|
||||
|
||||
* mail-config-druid.c: Fix for 40917 "Backspace shouldn't
|
||||
@ -101,6 +231,27 @@
|
||||
|
||||
* em-format.c (emf_init): Oops, put the arguments in the right order.
|
||||
|
||||
2003-09-29 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* mail-component.c: New member local_store in
|
||||
MailComponentPrivate.
|
||||
(impl_dispose): Unref.
|
||||
(mail_component_load_storage_by_uri): Return the CamelStore.
|
||||
(setup_local_folder): New.
|
||||
(setup_local_store): New.
|
||||
(mail_component_init): Call it.
|
||||
(mail_component_peek_storage_set): New.
|
||||
(mail_component_get_folder_from_evomail_uri): New.
|
||||
(mail_component_evomail_uri_from_folder): New.
|
||||
|
||||
* em-folder-selection-button.c: New.
|
||||
* em-folder-selection-button.h: New.
|
||||
|
||||
* em-folder-selection.c: New.
|
||||
* em-folder-selection.h: New.
|
||||
|
||||
* em-marshal.list: Add NONE:POINTER.
|
||||
|
||||
2003-09-25 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* mail-account-gui.c (mail_account_gui_save): Allow any file: uri
|
||||
@ -120,6 +271,33 @@
|
||||
charset string is empty, default the charset to the user's locale
|
||||
charset. Partial fix for bug #47638.
|
||||
|
||||
2003-09-23 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* mail-component.c (add_storage): Remove unused arg "uri".
|
||||
(mail_component_add_store): Likewise.
|
||||
(add_storage): Don't set the "Connecting..." node.
|
||||
(mail_component_init): Set up local store at
|
||||
~/.evolution/mail/local.
|
||||
|
||||
* evolution-mbox-upgrade.c (get_local_store): Remove a double
|
||||
xmlFree() that was causing it to crash.
|
||||
|
||||
|
||||
2003-09-23 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* mail-component.c (add_storage): Note the new store.
|
||||
|
||||
* mail-component-factory.c: Don't include "mail-callbacks.h"
|
||||
anymore.
|
||||
|
||||
* em-format-html.c (em_format_html_get_type): Get the base
|
||||
directory with mail_component_peek_base_directory().
|
||||
* em-utils.c (filter_editor_response): Likewise.
|
||||
(em_utils_edit_filters): Likewise.
|
||||
|
||||
* em-folder-browser.c (emfb_init): Get the search context through
|
||||
mail_component_peek_search_context().
|
||||
|
||||
2003-09-23 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* evolution-mbox-upgrade.c (get_local_store): Don't xmlFree (name)
|
||||
@ -273,6 +451,14 @@
|
||||
* evolution-mbox-upgrade.c: New source file to migrate from the
|
||||
old mbox structure to the new mbox structure.
|
||||
|
||||
2003-09-08 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* mail-folder-cache.c (mail_note_store): Allow NULL storage in
|
||||
precondition.
|
||||
|
||||
* mail-component.c (mail_component_init): Remove debugging
|
||||
message.
|
||||
|
||||
2003-08-22 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* mail-format.c (write_date): translate the local time format.
|
||||
@ -284,14 +470,13 @@
|
||||
day names, and the autoconf magic which made Not Zed dislike the
|
||||
inclusion of the timezone name.
|
||||
|
||||
2003-08-14 Jeffrey Stedfast <fejj@ximian.com>
|
||||
2003-08-18 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* mail-ops.c (mail_send_message): Don't abort at the first failure
|
||||
after sending (filtering, appending to Sent, syncing). Instead,
|
||||
keep a running tab of exceptions and then set a culmulative
|
||||
exception at the end to report to our caller. Also, if we fail to
|
||||
append to the account Sent folder, try again with the local Sent
|
||||
folder. Fixes bug #46512.
|
||||
* GNOME_Evolution_Mail.server.in.in: Rename
|
||||
GNOME_Evolution_Mail_Component2 to
|
||||
GNOME_Evolution_Mail_Component_2 and GNOME_Evolution_Mail_Factory2
|
||||
to GNOME_Evolution_Mail_Factory_2.
|
||||
* mail-component-factory.c: Update accordingly.
|
||||
|
||||
2003-08-18 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
@ -336,6 +521,15 @@
|
||||
* mail-display.c (mail_display_render): Change "%P" to "%p" so
|
||||
that strftime() can work under solaris.
|
||||
|
||||
2003-08-14 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* mail-ops.c (mail_send_message): Don't abort at the first failure
|
||||
after sending (filtering, appending to Sent, syncing). Instead,
|
||||
keep a running tab of exceptions and then set a culmulative
|
||||
exception at the end to report to our caller. Also, if we fail to
|
||||
append to the account Sent folder, try again with the local Sent
|
||||
folder. Fixes bug #46512.
|
||||
|
||||
2003-08-13 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com>
|
||||
|
||||
* e-searching-tokenizer.c (searcher_next_token): Fix for 45818 (
|
||||
@ -353,6 +547,12 @@
|
||||
* mail-session.c (remove_timeout): Removed.
|
||||
(register_timeout): Removed.
|
||||
|
||||
2003-08-09 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* mail-component.c (storage_go_online): Pass NULL for the
|
||||
operation pointer to mail_note_store(), to sync with Michael's
|
||||
changes.
|
||||
|
||||
2003-08-05 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* mail-format.c (handle_multipart_encrypted): Updated for
|
||||
@ -1308,6 +1508,154 @@
|
||||
* message-browser.c (message_browser_new): Handle our own Delete
|
||||
key presses. Fixes bug #45597.
|
||||
|
||||
2003-07-25 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* mail-callbacks.c (do_view_message): No need to pass a shell
|
||||
argument to message_browser_new() anymore.
|
||||
|
||||
* message-browser.c (message_browser_new): Removed arg shell. No
|
||||
need to pass it to folder_browser_new() either.
|
||||
|
||||
* mail-component.c (create_view_callback): No need to pass a shell
|
||||
arg to folder_browser_factory_new_control() anymore.
|
||||
|
||||
* folder-browser-factory.c (folder_browser_factory_new_control):
|
||||
Removed arg shell; folder_browser_browser_new() doesn't need it
|
||||
anymore.
|
||||
|
||||
* folder-browser.c (folder_browser_destroy): No need to unref
|
||||
->shell anymore.
|
||||
(folder_browser_new): Removed shell arg.
|
||||
(folder_browser_gui_init): Removed a const qualifier that was not
|
||||
supposed to be there.
|
||||
|
||||
* folder-browser.h: Removed member shell from struct
|
||||
FolderBrowser.
|
||||
|
||||
2003-07-25 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* folder-browser.c (folder_browser_gui_init): Get the search
|
||||
context through mail_component_peek_search_context(), since it's
|
||||
no longer a global variable.
|
||||
(folder_browser_gui_init): Cleaned up an extra unneeded if()
|
||||
statement.
|
||||
|
||||
* mail-component.c: New member search_context in struct
|
||||
MailComponentPrivate.
|
||||
(mail_component_peek_search_context): New.
|
||||
(setup_search_context): New function to initialize the
|
||||
search_context, based on the old code in component-factory.c.
|
||||
(mail_component_init): Call it here.
|
||||
(impl_dispose): Unref the rule_context.
|
||||
|
||||
* mail-component-factory.c: Removed global variable
|
||||
search_context.
|
||||
|
||||
2003-07-25 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* mail-component.c (browser_page_switched_callback): New callback
|
||||
for the "page_switched" signal on EStorageBrowser; deactivate the
|
||||
previous page, activate the new one.
|
||||
(impl_createControls): Connect.
|
||||
|
||||
2003-07-24 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* mail-mt.c (do_op_status): Pass "evolution-mail" as the ID to
|
||||
evolution_activity_client_new(). [This is just a temporary thing
|
||||
to avoid the fact that we don't have component-factory.h anymore.
|
||||
Eventually we'll just get rid of the activity client stuff.]
|
||||
|
||||
* mail-component-factory.c: Added to the build. Also, finished
|
||||
implementing and moving the factory over from component-factory.c.
|
||||
|
||||
* component-factory.c: Removed from the build.
|
||||
* component-factory.h: Removed from the build.
|
||||
|
||||
* mail-component.c: Removed some debugging messages.
|
||||
|
||||
2003-07-23 Ettore Perazzoli <ettore@ximian.com>
|
||||
|
||||
* subscribe-dialog.c: Converted to use EStorages instead of
|
||||
EvolutionStorages and the new MailComponent object.
|
||||
|
||||
* mail.h: Nuked a bunch of stuff. This will go away when I am
|
||||
done refactoring.
|
||||
|
||||
* mail-offline-handler.c: Use the new MailComponent object.
|
||||
|
||||
* mail-folder-cache.c, mail-folder-cache.h: Converted to use
|
||||
EStorages instead of EvolutionStorages.
|
||||
|
||||
* mail-display.c: Use g_timeout and g_source functions instead of
|
||||
gtk_timeout functions.
|
||||
|
||||
* mail-send-recv.c: Use g_timeout and g_source functions instead
|
||||
of gtk_timeout functions.
|
||||
(receive_update_got_store): Updated for the new mail_note_store().
|
||||
|
||||
* mail-session.c: Use g_timeout and g_source functions instead of
|
||||
gtk_timeout functions.
|
||||
|
||||
* mail-config-factory.c (factory): Removed.
|
||||
|
||||
* folder-browser.c (folder_browser_destroy): Use GLib
|
||||
timeout/source functions instead of the deprecated GTK ones.
|
||||
(done_message_selected): Likewise.
|
||||
(folder_browser_gui_init): Protect against fb->search being NULL.
|
||||
|
||||
* mail-account-gui.c (add_new_store): Use new MailComponent object
|
||||
and EStorages instead of EvolutionStorages.
|
||||
(mail_account_gui_save): Likewise.
|
||||
|
||||
* mail-accounts.c (account_delete_clicked): Use new MailComponent
|
||||
object and EStorages instead of EvolutionStorages.
|
||||
(account_able_clicked): Likewise.
|
||||
(account_able_toggled): Likewise.
|
||||
|
||||
* mail-autofilter.c: Use mail_component_peek_base_directory()
|
||||
instead of the evolution_dir global.
|
||||
* mail-callbacks.c: Likewise.
|
||||
* mail-config.c (uri_to_evname): Likewise.
|
||||
(mail_config_get_signature_list): Likewise.
|
||||
(delete_unused_signature_file): Likewise.
|
||||
* mail-display.c (mail_display_class_init): Likewise.
|
||||
* mail-importer.c (mail_importer_make_local_folder): Likewise.
|
||||
* mail-local.c (mlf_getv): Likewise.
|
||||
* mail-ops.c (uid_cachename_hack): Likewise.
|
||||
* mail-summary.c (generate_folder_summaries): Likewise.
|
||||
* mail-tools.c (mail_tool_get_local_inbox): Likewise.
|
||||
(mail_tools_folder_to_url): Likewise.
|
||||
* mail-vfolder.c (mail_vfolder_delete_uri): Likewise.
|
||||
(mail_vfolder_rename_uri): Likewise.
|
||||
(context_rule_removed): Likewise.
|
||||
(store_folder_deleted): Likewise.
|
||||
(store_folder_renamed): Likewise.
|
||||
(vfolder_load_storage): Likewise.
|
||||
(vfolder_editor_response): Likewise.
|
||||
(edit_rule_response): Likewise.
|
||||
(new_rule_clicked): Likewise.
|
||||
(vfolder_gui_add_rule): Likewise.
|
||||
* mail-session.c (main_get_filter_driver): Likewise.
|
||||
(mail_session_forget_password): Likewise.
|
||||
(mail_session_init): Get a base_directory arg.
|
||||
|
||||
* component-factory.c, component-factory.h: Disabled a bunch of
|
||||
stuff to get it to compile in the new configuration. These files
|
||||
will eventually go away when I am done refactoring this.
|
||||
|
||||
* Makefile.am: Do not build importers, compile generate
|
||||
skels/stubs for Evolution.
|
||||
|
||||
* GNOME_Evolution_Mail.server.in.in: Rename control factory to
|
||||
OAFIID:GNOME_Evolution_Mail_Factory2. Add new component
|
||||
GNOME_Evolution_Mail_Component2.
|
||||
|
||||
* mail-component-factory.c: New file implementing the Bonobo
|
||||
factory.
|
||||
|
||||
* mail-component.c, mail-component.h: New files implementing the
|
||||
new mail component, using the new Evolution::Component IDL.
|
||||
|
||||
2003-07-23 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* mail-format.c (mail_format_data_wrapper_write_to_stream): Revert
|
||||
|
@ -3,7 +3,7 @@
|
||||
<!-- Folder display control -->
|
||||
|
||||
<!-- (factory) -->
|
||||
<oaf_server iid="OAFIID:GNOME_Evolution_Mail_ControlFactory"
|
||||
<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Factory_2"
|
||||
type="shlib"
|
||||
location="@COMPONENTDIR@/libevolution-mail.so">
|
||||
|
||||
@ -29,6 +29,22 @@
|
||||
_value="Evolution Mail folder viewer"/>
|
||||
</oaf_server>
|
||||
|
||||
<!-- Component Interface -->
|
||||
|
||||
<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Component_2"
|
||||
type="factory"
|
||||
location="OAFIID:GNOME_Evolution_Mail_Factory_2">
|
||||
|
||||
<oaf_attribute name="repo_ids" type="stringv">
|
||||
<item value="IDL:GNOME/Evolution/Component:1.0"/>
|
||||
</oaf_attribute>
|
||||
|
||||
<oaf_attribute name="name" type="string" _value="Evolution Mail component"/>
|
||||
|
||||
<oaf_attribute name="evolution:component_icon" type="string" value="evolution-inbox.png"/>
|
||||
<oaf_attribute name="evolution:component_display_order" type="number" value="1"/>
|
||||
</oaf_server>
|
||||
|
||||
<!-- Shell Component -->
|
||||
|
||||
<oaf_server iid="OAFIID:GNOME_Evolution_Mail_ShellComponent"
|
||||
@ -53,7 +69,7 @@
|
||||
<!-- (composer) -->
|
||||
<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Composer"
|
||||
type="factory"
|
||||
location="OAFIID:GNOME_Evolution_Mail_ControlFactory">
|
||||
location="OAFIID:GNOME_Evolution_Mail_Factory_2">
|
||||
|
||||
<oaf_attribute name="repo_ids" type="stringv">
|
||||
<item value="IDL:GNOME/Evolution:Composer:1.0"/>
|
||||
@ -109,7 +125,7 @@
|
||||
<!-- Account Editor -->
|
||||
<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Accounts_ConfigControl"
|
||||
type="factory"
|
||||
location="OAFIID:GNOME_Evolution_Mail_ControlFactory">
|
||||
location="OAFIID:GNOME_Evolution_Mail_Factory_2">
|
||||
|
||||
<oaf_attribute name="repo_ids" type="stringv">
|
||||
<item value="IDL:GNOME/Evolution/ConfigControl:1.0"/>
|
||||
@ -138,7 +154,7 @@
|
||||
<!-- Mail Preferences -->
|
||||
<oaf_server iid="OAFIID:GNOME_Evolution_Mail_Preferences_ConfigControl"
|
||||
type="factory"
|
||||
location="OAFIID:GNOME_Evolution_Mail_ControlFactory">
|
||||
location="OAFIID:GNOME_Evolution_Mail_Factory_2">
|
||||
|
||||
<oaf_attribute name="repo_ids" type="stringv">
|
||||
<item value="IDL:GNOME/Evolution/ConfigControl:1.0"/>
|
||||
@ -163,7 +179,7 @@
|
||||
<!-- Composer Preferences -->
|
||||
<oaf_server iid="OAFIID:GNOME_Evolution_Mail_ComposerPrefs_ConfigControl"
|
||||
type="factory"
|
||||
location="OAFIID:GNOME_Evolution_Mail_ControlFactory">
|
||||
location="OAFIID:GNOME_Evolution_Mail_Factory_2">
|
||||
|
||||
<oaf_attribute name="repo_ids" type="stringv">
|
||||
<item value="IDL:GNOME/Evolution/ConfigControl:1.0"/>
|
||||
|
269
mail/Makefile.am
269
mail/Makefile.am
@ -1,4 +1,4 @@
|
||||
SUBDIRS = importers
|
||||
SUBDIRS = # importers FIXME
|
||||
|
||||
libexec_PROGRAMS = \
|
||||
evolution-mbox-upgrade
|
||||
@ -39,128 +39,153 @@ INCLUDES = \
|
||||
|
||||
component_LTLIBRARIES = libevolution-mail.la
|
||||
|
||||
EVOLUTION_MAIL_CORBA_GENERATED_H = \
|
||||
|
||||
# Code generation for Mailer.idl
|
||||
|
||||
MAILER_IDL = Mailer.idl
|
||||
|
||||
MAILER_IDL_GENERATED_H = \
|
||||
Mailer.h
|
||||
EVOLUTION_MAIL_CORBA_GENERATED_C = \
|
||||
MAILER_IDL_GENERATED_C = \
|
||||
Mailer-common.c \
|
||||
Mailer-skels.c \
|
||||
Mailer-stubs.c
|
||||
EVOLUTION_MAIL_CORBA_GENERATED = $(EVOLUTION_MAIL_CORBA_GENERATED_C) $(EVOLUTION_MAIL_CORBA_GENERATED_H)
|
||||
MAILER_IDL_GENERATED = $(MAILER_IDL_GENERATED_C) $(MAILER_IDL_GENERATED_H)
|
||||
|
||||
$(MAILER_IDL_GENERATED_H): Mailer.idl
|
||||
$(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl $(IDL_INCLUDES) $(srcdir)/Mailer.idl
|
||||
$(MAILER_IDL_GENERATED_C): $(MAILER_IDL_GENERATED_H)
|
||||
|
||||
|
||||
# Code generation for Spell.idl
|
||||
|
||||
SPELL_IDL = Spell.idl
|
||||
|
||||
IDL_GENERATED_H = \
|
||||
SPELL_IDL_GENERATED_H = \
|
||||
Spell.h
|
||||
IDL_GENERATED_C = \
|
||||
SPELL_IDL_GENERATED_C = \
|
||||
Spell-common.c \
|
||||
Spell-skels.c \
|
||||
Spell-stubs.c
|
||||
IDL_GENERATED = $(IDL_GENERATED_C) $(IDL_GENERATED_H)
|
||||
SPELL_IDL_GENERATED = $(SPELL_IDL_GENERATED_C) $(SPELL_IDL_GENERATED_H)
|
||||
|
||||
$(IDL_GENERATED_H): $(SPELL_IDL)
|
||||
$(SPELL_IDL_GENERATED_H): $(SPELL_IDL)
|
||||
$(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl $(IDL_INCLUDES) $(srcdir)/Spell.idl
|
||||
$(IDL_GENERATED_C): $(IDL_GENERATED_H)
|
||||
$(SPELL_IDL_GENERATED_C): $(SPELL_IDL_GENERATED_H)
|
||||
|
||||
Spell-impl.o: Spell.h
|
||||
|
||||
libevolution_mail_la_SOURCES = \
|
||||
$(EVOLUTION_MAIL_CORBA_GENERATED) \
|
||||
$(IDL_GENERATED) \
|
||||
component-factory.c \
|
||||
component-factory.h \
|
||||
e-searching-tokenizer.c \
|
||||
e-searching-tokenizer.h \
|
||||
em-inline-filter.c \
|
||||
em-inline-filter.h \
|
||||
em-folder-view.c \
|
||||
em-folder-view.h \
|
||||
em-folder-browser.c \
|
||||
em-folder-browser.h \
|
||||
em-format.c \
|
||||
em-format.h \
|
||||
em-format-html.c \
|
||||
em-format-html.h \
|
||||
em-format-html-display.c \
|
||||
em-format-html-display.h \
|
||||
em-format-html-print.c \
|
||||
em-format-html-print.h \
|
||||
em-format-html-quote.c \
|
||||
em-format-html-quote.h \
|
||||
em-format-quote.c \
|
||||
em-format-quote.h \
|
||||
em-marshal.c \
|
||||
em-marshal.h \
|
||||
em-message-browser.c \
|
||||
em-message-browser.h \
|
||||
em-composer-utils.c \
|
||||
em-composer-utils.h \
|
||||
em-popup.c \
|
||||
em-popup.h \
|
||||
em-utils.c \
|
||||
em-utils.h \
|
||||
em-subscribe-editor.c \
|
||||
em-subscribe-editor.h \
|
||||
em-sync-stream.c \
|
||||
em-sync-stream.h \
|
||||
em-icon-stream.c \
|
||||
em-icon-stream.h \
|
||||
em-html-stream.c \
|
||||
em-html-stream.h \
|
||||
folder-browser-factory.c \
|
||||
folder-browser-factory.h \
|
||||
folder-info.c \
|
||||
folder-info.h \
|
||||
mail-account-editor.c \
|
||||
mail-account-editor.h \
|
||||
mail-account-gui.c \
|
||||
mail-account-gui.h \
|
||||
mail-accounts.c \
|
||||
mail-accounts.h \
|
||||
mail-autofilter.c \
|
||||
mail-autofilter.h \
|
||||
mail-composer-prefs.c \
|
||||
mail-composer-prefs.h \
|
||||
mail-config.c \
|
||||
mail-config.h \
|
||||
mail-config-druid.c \
|
||||
mail-config-druid.h \
|
||||
mail-crypto.c \
|
||||
mail-crypto.h \
|
||||
mail-config-factory.c \
|
||||
mail-config-factory.h \
|
||||
mail-preferences.c \
|
||||
mail-preferences.h \
|
||||
mail-folder-cache.c \
|
||||
mail-folder-cache.h \
|
||||
mail-importer.c \
|
||||
mail-importer.h \
|
||||
mail-local.c \
|
||||
mail-local.h \
|
||||
mail-mt.c \
|
||||
mail-mt.h \
|
||||
mail-offline-handler.c \
|
||||
mail-offline-handler.h \
|
||||
mail-ops.c \
|
||||
mail-ops.h \
|
||||
mail-send-recv.c \
|
||||
mail-send-recv.h \
|
||||
mail-session.c \
|
||||
mail-session.h \
|
||||
mail-signature-editor.c \
|
||||
mail-signature-editor.h \
|
||||
mail-tools.c \
|
||||
mail-tools.h \
|
||||
mail-types.h \
|
||||
mail-vfolder.c \
|
||||
mail-vfolder.h \
|
||||
message-list.c \
|
||||
message-list.h \
|
||||
message-tag-editor.c \
|
||||
message-tag-editor.h \
|
||||
message-tag-followup.c \
|
||||
message-tag-followup.h \
|
||||
|
||||
# libevolution-mail
|
||||
|
||||
libevolution_mail_la_SOURCES = \
|
||||
$(SPELL_IDL_GENERATED) \
|
||||
$(MAILER_IDL_GENERATED) \
|
||||
e-searching-tokenizer.c \
|
||||
e-searching-tokenizer.h \
|
||||
em-inline-filter.c \
|
||||
em-inline-filter.h \
|
||||
em-folder-selection.c \
|
||||
em-folder-selection.h \
|
||||
em-folder-selection-button.c \
|
||||
em-folder-selection-button.h \
|
||||
em-folder-selector.c \
|
||||
em-folder-selector.h \
|
||||
em-folder-view.c \
|
||||
em-folder-view.h \
|
||||
em-folder-browser.c \
|
||||
em-folder-browser.h \
|
||||
em-format.c \
|
||||
em-format.h \
|
||||
em-format-html.c \
|
||||
em-format-html.h \
|
||||
em-format-html-display.c \
|
||||
em-format-html-display.h \
|
||||
em-format-html-print.c \
|
||||
em-format-html-print.h \
|
||||
em-format-html-quote.c \
|
||||
em-format-html-quote.h \
|
||||
em-format-quote.c \
|
||||
em-format-quote.h \
|
||||
em-marshal.c \
|
||||
em-marshal.h \
|
||||
em-message-browser.c \
|
||||
em-message-browser.h \
|
||||
em-composer-utils.c \
|
||||
em-composer-utils.h \
|
||||
em-popup.c \
|
||||
em-popup.h \
|
||||
em-utils.c \
|
||||
em-utils.h \
|
||||
em-subscribe-editor.c \
|
||||
em-subscribe-editor.h \
|
||||
em-sync-stream.c \
|
||||
em-sync-stream.h \
|
||||
em-icon-stream.c \
|
||||
em-icon-stream.h \
|
||||
em-html-stream.c \
|
||||
em-html-stream.h \
|
||||
folder-browser-factory.c \
|
||||
folder-browser-factory.h \
|
||||
folder-info.c \
|
||||
folder-info.h \
|
||||
mail-account-editor.c \
|
||||
mail-account-editor.h \
|
||||
mail-account-gui.c \
|
||||
mail-account-gui.h \
|
||||
mail-accounts.c \
|
||||
mail-accounts.h \
|
||||
mail-autofilter.c \
|
||||
mail-autofilter.h \
|
||||
mail-component-factory.c \
|
||||
mail-component.c \
|
||||
mail-component.h \
|
||||
mail-composer-prefs.c \
|
||||
mail-composer-prefs.h \
|
||||
mail-config.c \
|
||||
mail-config.h \
|
||||
mail-config-druid.c \
|
||||
mail-config-druid.h \
|
||||
mail-crypto.c \
|
||||
mail-crypto.h \
|
||||
mail-config-factory.c \
|
||||
mail-config-factory.h \
|
||||
mail-preferences.c \
|
||||
mail-preferences.h \
|
||||
mail-folder-cache.c \
|
||||
mail-folder-cache.h \
|
||||
mail-importer.c \
|
||||
mail-importer.h \
|
||||
mail-mt.c \
|
||||
mail-mt.h \
|
||||
mail-offline-handler.c \
|
||||
mail-offline-handler.h \
|
||||
mail-ops.c \
|
||||
mail-ops.h \
|
||||
mail-send-recv.c \
|
||||
mail-send-recv.h \
|
||||
mail-session.c \
|
||||
mail-session.h \
|
||||
mail-signature-editor.c \
|
||||
mail-signature-editor.h \
|
||||
mail-tools.c \
|
||||
mail-tools.h \
|
||||
mail-types.h \
|
||||
mail-vfolder.c \
|
||||
mail-vfolder.h \
|
||||
message-list.c \
|
||||
message-list.h \
|
||||
message-tag-editor.c \
|
||||
message-tag-editor.h \
|
||||
message-tag-followup.c \
|
||||
message-tag-followup.h \
|
||||
mail.h
|
||||
|
||||
# EPFIXME: Functionality to be brought back to life.
|
||||
#
|
||||
# mail-local.c
|
||||
# mail-local.h
|
||||
|
||||
libevolution_mail_la_LIBADD = \
|
||||
$(top_builddir)/shell/importer/libevolution-importer.la \
|
||||
$(top_builddir)/camel/libcamel.la \
|
||||
@ -177,6 +202,9 @@ libevolution_mail_la_LIBADD = \
|
||||
libevolution_mail_la_LDFLAGS = \
|
||||
-avoid-version -module
|
||||
|
||||
|
||||
# .server files
|
||||
|
||||
evolution_mbox_upgrade_SOURCES = evolution-mbox-upgrade.c
|
||||
evolution_mbox_upgrade_LDADD = \
|
||||
$(top_builddir)/camel/libcamel.la \
|
||||
@ -190,21 +218,16 @@ server_DATA = $(server_in_files:.server.in.in=.server)
|
||||
sed -e "s|\@COMPONENTDIR\@|$(componentdir)|" $< > $@
|
||||
@INTLTOOL_SERVER_RULE@
|
||||
|
||||
|
||||
# Misc data to install
|
||||
|
||||
glade_DATA = mail-config.glade local-config.glade subscribe-dialog.glade message-tags.glade mail-search.glade
|
||||
MARSHAL_GENERATED = em-marshal.c em-marshal.h
|
||||
@EVO_MARSHAL_RULE@
|
||||
|
||||
glade_DATA = mail-config.glade local-config.glade subscribe-dialog.glade message-tags.glade mail-search.glade
|
||||
etspec_DATA = mail-accounts.etspec message-list.etspec subscribe-dialog.etspec
|
||||
|
||||
etspec_DATA = message-list.etspec
|
||||
|
||||
schemadir = $(GCONF_SCHEMA_FILE_DIR)
|
||||
schema_DATA = evolution-mail.schemas
|
||||
|
||||
idl_DATA = Mailer.idl
|
||||
|
||||
$(EVOLUTION_MAIL_CORBA_GENERATED_H): Mailer.idl
|
||||
$(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl $(IDL_INCLUDES) $(srcdir)/Mailer.idl
|
||||
$(EVOLUTION_MAIL_CORBA_GENERATED_C): $(EVOLUTION_MAIL_CORBA_GENERATED_H)
|
||||
idl_DATA = $(MAILER_IDL)
|
||||
|
||||
EXTRA_DIST = \
|
||||
ChangeLog.pre-1-4 \
|
||||
@ -217,6 +240,9 @@ EXTRA_DIST = \
|
||||
$(server_DATA) \
|
||||
$(etspec_DATA)
|
||||
|
||||
|
||||
# Purify support
|
||||
|
||||
if ENABLE_PURIFY
|
||||
PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
@ -228,6 +254,12 @@ evolution-mail.pure: evolution-mail
|
||||
|
||||
endif
|
||||
|
||||
|
||||
# GConf
|
||||
|
||||
schemadir = $(GCONF_SCHEMA_FILE_DIR)
|
||||
schema_DATA = evolution-mail.schemas
|
||||
|
||||
install-data-local:
|
||||
if test -z "$(DESTDIR)" ; then \
|
||||
for p in $(schema_DATA) ; do \
|
||||
@ -235,8 +267,11 @@ install-data-local:
|
||||
done \
|
||||
fi
|
||||
|
||||
|
||||
# Prologue
|
||||
|
||||
dist-hook:
|
||||
cd $(distdir); rm -f $(BUILT_SOURCES)
|
||||
|
||||
BUILT_SOURCES = $(EVOLUTION_MAIL_CORBA_GENERATED) $(IDL_GENERATED) $(MARSHAL_GENERATED) $(server_DATA)
|
||||
BUILT_SOURCES = $(MAILER_IDL_GENERATED) $(SPELL_IDL_GENERATED) $(MARSHAL_GENERATED) $(server_DATA)
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
@ -20,6 +20,8 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* EPFIXME: This file should go away. */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
@ -54,6 +56,7 @@
|
||||
#include "mail-config.h"
|
||||
#include "mail-config-factory.h"
|
||||
#include "mail-preferences.h"
|
||||
#include "mail-component.h"
|
||||
#include "mail-composer-prefs.h"
|
||||
#include "mail-tools.h"
|
||||
#include "mail-ops.h"
|
||||
@ -79,7 +82,6 @@ char *default_sent_folder_uri;
|
||||
CamelFolder *sent_folder = NULL;
|
||||
char *default_outbox_folder_uri;
|
||||
CamelFolder *outbox_folder = NULL;
|
||||
char *evolution_dir;
|
||||
|
||||
EvolutionShellClient *global_shell_client = NULL;
|
||||
|
||||
@ -136,6 +138,14 @@ type_is_vtrash (const char *type)
|
||||
return !strcmp (type, "vtrash");
|
||||
}
|
||||
|
||||
|
||||
/* Forward decls just to get it to compile without warnings. EPFIXME: This is
|
||||
all junk at this point in the refactoring anyways, so it will all die. */
|
||||
static void mail_load_storage_by_uri (GNOME_Evolution_Shell shell, const char *uri, const char *name);
|
||||
static void mail_load_storages (GNOME_Evolution_Shell shell, EAccountList *accounts);
|
||||
static void mail_hash_storage (CamelService *store, EvolutionStorage *storage);
|
||||
|
||||
|
||||
/* EvolutionShellComponent methods and signals. */
|
||||
|
||||
static BonoboControl *
|
||||
@ -766,6 +776,7 @@ owner_set_cb (EvolutionShellComponent *shell_component,
|
||||
const char *evolution_homedir,
|
||||
gpointer user_data)
|
||||
{
|
||||
#if 0
|
||||
GNOME_Evolution_Shell corba_shell;
|
||||
EAccountList *accounts;
|
||||
int i;
|
||||
@ -774,7 +785,6 @@ owner_set_cb (EvolutionShellComponent *shell_component,
|
||||
global_shell_client = shell_client;
|
||||
g_object_weak_ref ((GObject *) shell_client, (GWeakNotify) shell_client_destroy, NULL);
|
||||
|
||||
evolution_dir = g_strdup (evolution_homedir);
|
||||
mail_session_init ();
|
||||
|
||||
async_event = mail_async_event_new();
|
||||
@ -831,6 +841,7 @@ owner_set_cb (EvolutionShellComponent *shell_component,
|
||||
|
||||
/* Everything should be ready now */
|
||||
evolution_folder_info_notify_ready ();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1037,7 +1048,7 @@ request_quit (EvolutionShellComponent *shell_component,
|
||||
}
|
||||
|
||||
static BonoboObject *
|
||||
create_component (void)
|
||||
create_shell_component (void)
|
||||
{
|
||||
EvolutionShellComponentDndDestinationFolder *destination_interface;
|
||||
MailOfflineHandler *offline_handler;
|
||||
@ -1336,12 +1347,14 @@ storage_xfer_folder (EvolutionStorage *storage,
|
||||
camel_exception_clear (&ex);
|
||||
}
|
||||
|
||||
#if 0 /* EPFIXME */
|
||||
static void
|
||||
storage_connected (CamelStore *store, CamelFolderInfo *info, void *listener)
|
||||
{
|
||||
notify_listener (listener, (info ? GNOME_Evolution_Storage_OK :
|
||||
GNOME_Evolution_Storage_GENERIC_ERROR));
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
storage_connect (EvolutionStorage *storage,
|
||||
@ -1349,8 +1362,10 @@ storage_connect (EvolutionStorage *storage,
|
||||
const char *path,
|
||||
CamelStore *store)
|
||||
{
|
||||
#if 0 /* EPFIXME */
|
||||
mail_note_store (CAMEL_STORE (store), NULL, storage, CORBA_OBJECT_NIL,
|
||||
storage_connected, listener);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1373,7 +1388,7 @@ add_storage (const char *name, const char *uri, CamelService *store,
|
||||
evolution_storage_has_subfolders (storage, "/", _("Connecting..."));
|
||||
mail_hash_storage (store, storage);
|
||||
/*if (auto_connect)*/
|
||||
mail_note_store ((CamelStore *) store, NULL, storage, CORBA_OBJECT_NIL, NULL, NULL);
|
||||
/* EPFIXME mail_note_store ((CamelStore *) store, NULL, storage, CORBA_OBJECT_NIL, NULL, NULL); */
|
||||
/* falllll */
|
||||
case EVOLUTION_STORAGE_ERROR_ALREADYREGISTERED:
|
||||
case EVOLUTION_STORAGE_ERROR_EXISTS:
|
||||
@ -1386,34 +1401,7 @@ add_storage (const char *name, const char *uri, CamelService *store,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mail_add_storage (CamelStore *store, const char *name, const char *uri)
|
||||
{
|
||||
EvolutionShellClient *shell_client;
|
||||
GNOME_Evolution_Shell shell;
|
||||
CamelException ex;
|
||||
|
||||
g_return_if_fail (CAMEL_IS_STORE (store));
|
||||
|
||||
shell_client = evolution_shell_component_get_owner (shell_component);
|
||||
shell = evolution_shell_client_corba_objref (shell_client);
|
||||
|
||||
camel_exception_init (&ex);
|
||||
|
||||
if (name == NULL) {
|
||||
char *service_name;
|
||||
|
||||
service_name = camel_service_get_name ((CamelService *) store, TRUE);
|
||||
add_storage (service_name, uri, (CamelService *) store, shell, &ex);
|
||||
g_free (service_name);
|
||||
} else {
|
||||
add_storage (name, uri, (CamelService *) store, shell, &ex);
|
||||
}
|
||||
|
||||
camel_exception_clear (&ex);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
mail_load_storage_by_uri (GNOME_Evolution_Shell shell, const char *uri, const char *name)
|
||||
{
|
||||
CamelException ex;
|
||||
@ -1468,7 +1456,7 @@ mail_load_storage_by_uri (GNOME_Evolution_Shell shell, const char *uri, const ch
|
||||
camel_object_unref (CAMEL_OBJECT (store));
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
mail_load_storages (GNOME_Evolution_Shell shell, EAccountList *accounts)
|
||||
{
|
||||
CamelException ex;
|
||||
@ -1500,103 +1488,23 @@ mail_load_storages (GNOME_Evolution_Shell shell, EAccountList *accounts)
|
||||
g_object_unref (iter);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
mail_hash_storage (CamelService *store, EvolutionStorage *storage)
|
||||
{
|
||||
camel_object_ref (CAMEL_OBJECT (store));
|
||||
g_hash_table_insert (storages_hash, store, storage);
|
||||
}
|
||||
|
||||
EvolutionStorage *
|
||||
mail_lookup_storage (CamelStore *store)
|
||||
{
|
||||
EvolutionStorage *storage;
|
||||
|
||||
/* Because the storages_hash holds a reference to each store
|
||||
* used as a key in it, none of them will ever be gc'ed, meaning
|
||||
* any call to camel_session_get_{service,store} with the same
|
||||
* URL will always return the same object. So this works.
|
||||
*/
|
||||
|
||||
storage = g_hash_table_lookup (storages_hash, store);
|
||||
if (storage)
|
||||
bonobo_object_ref (BONOBO_OBJECT (storage));
|
||||
|
||||
return storage;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
store_disconnect(CamelStore *store, void *event_data, void *data)
|
||||
{
|
||||
camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL);
|
||||
camel_object_unref (CAMEL_OBJECT (store));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
mail_remove_storage (CamelStore *store)
|
||||
{
|
||||
EvolutionStorage *storage;
|
||||
EvolutionShellClient *shell_client;
|
||||
GNOME_Evolution_Shell corba_shell;
|
||||
|
||||
/* Because the storages_hash holds a reference to each store
|
||||
* used as a key in it, none of them will ever be gc'ed, meaning
|
||||
* any call to camel_session_get_{service,store} with the same
|
||||
* URL will always return the same object. So this works.
|
||||
*/
|
||||
|
||||
storage = g_hash_table_lookup (storages_hash, store);
|
||||
if (!storage)
|
||||
return;
|
||||
|
||||
g_hash_table_remove (storages_hash, store);
|
||||
|
||||
/* so i guess potentially we could have a race, add a store while one
|
||||
being removed. ?? */
|
||||
mail_note_store_remove(store);
|
||||
|
||||
shell_client = evolution_shell_component_get_owner (shell_component);
|
||||
corba_shell = evolution_shell_client_corba_objref(shell_client);
|
||||
|
||||
evolution_storage_deregister_on_shell (storage, corba_shell);
|
||||
|
||||
mail_async_event_emit(async_event, MAIL_ASYNC_THREAD, (MailAsyncFunc)store_disconnect, store, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
mail_remove_storage_by_uri (const char *uri)
|
||||
{
|
||||
CamelProvider *prov;
|
||||
CamelService *store;
|
||||
|
||||
prov = camel_session_get_provider (session, uri, NULL);
|
||||
if (!prov)
|
||||
return;
|
||||
if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE) ||
|
||||
(prov->flags & CAMEL_PROVIDER_IS_EXTERNAL))
|
||||
return;
|
||||
|
||||
store = camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, NULL);
|
||||
if (store != NULL) {
|
||||
mail_remove_storage (CAMEL_STORE (store));
|
||||
camel_object_unref (CAMEL_OBJECT (store));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
mail_storages_count (void)
|
||||
{
|
||||
return g_hash_table_size (storages_hash);
|
||||
}
|
||||
|
||||
void
|
||||
mail_storages_foreach (GHFunc func, gpointer data)
|
||||
{
|
||||
g_hash_table_foreach (storages_hash, func, data);
|
||||
}
|
||||
|
||||
|
||||
#define FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ControlFactory"
|
||||
#define FACTORY_ID "OAFIID:GNOME_Evolution_Mail_Factory_2"
|
||||
|
||||
#define MAIL_CONFIG_IID "OAFIID:GNOME_Evolution_MailConfig"
|
||||
#define WIZARD_IID "OAFIID:GNOME_Evolution_Mail_Wizard"
|
||||
@ -1608,9 +1516,14 @@ factory (BonoboGenericFactory *factory,
|
||||
const char *component_id,
|
||||
void *closure)
|
||||
{
|
||||
if (strcmp (component_id, COMPONENT_ID) == 0)
|
||||
return create_component();
|
||||
else if (strcmp(component_id, MAIL_CONFIG_IID) == 0)
|
||||
if (strcmp (component_id, SHELL_COMPONENT_ID) == 0)
|
||||
return create_shell_component();
|
||||
else if (strcmp (component_id, COMPONENT_ID) == 0) {
|
||||
MailComponent *component = mail_component_peek ();
|
||||
|
||||
bonobo_object_ref (BONOBO_OBJECT (component));
|
||||
return BONOBO_OBJECT (component);
|
||||
} else if (strcmp(component_id, MAIL_CONFIG_IID) == 0)
|
||||
return (BonoboObject *)g_object_new (evolution_mail_config_get_type (), NULL);
|
||||
else if (strcmp(component_id, FOLDER_INFO_IID) == 0)
|
||||
return evolution_folder_info_new();
|
||||
|
@ -23,7 +23,8 @@
|
||||
#ifndef COMPONENT_FACTORY_H
|
||||
#define COMPONENT_FACTORY_H
|
||||
|
||||
#define COMPONENT_ID "OAFIID:GNOME_Evolution_Mail_ShellComponent"
|
||||
#define COMPONENT_ID "OAFIID:GNOME_Evolution_Mail_Component2"
|
||||
#define SHELL_COMPONENT_ID "OAFIID:GNOME_Evolution_Mail_ShellComponent"
|
||||
#define SUMMARY_FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ExecutiveSummaryComponentFactory"
|
||||
|
||||
#endif
|
||||
|
@ -101,7 +101,7 @@ composer_destroy_cb (gpointer user_data, GObject *deadbeef)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recipients)
|
||||
ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EABDestination **recipients)
|
||||
{
|
||||
gboolean show_again, res;
|
||||
GConfClient *gconf;
|
||||
@ -117,10 +117,10 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recip
|
||||
str = g_string_new (_("You are sending an HTML-formatted message. Please make sure that\n"
|
||||
"the following recipients are willing and able to receive HTML mail:\n"));
|
||||
for (i = 0; recipients[i] != NULL; ++i) {
|
||||
if (!e_destination_get_html_mail_pref (recipients[i])) {
|
||||
if (!eab_destination_get_html_mail_pref (recipients[i])) {
|
||||
const char *name;
|
||||
|
||||
name = e_destination_get_textrep (recipients[i], FALSE);
|
||||
name = eab_destination_get_textrep (recipients[i], FALSE);
|
||||
|
||||
g_string_append_printf (str, " %s\n", name);
|
||||
}
|
||||
@ -262,7 +262,7 @@ static CamelMimeMessage *
|
||||
composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_object_data)
|
||||
{
|
||||
CamelMimeMessage *message = NULL;
|
||||
EDestination **recipients, **recipients_bcc;
|
||||
EABDestination **recipients, **recipients_bcc;
|
||||
gboolean send_html, confirm_html;
|
||||
CamelInternetAddress *cia;
|
||||
int hidden = 0, shown = 0;
|
||||
@ -286,15 +286,15 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_
|
||||
/* see which ones are visible/present, etc */
|
||||
if (recipients) {
|
||||
for (i = 0; recipients[i] != NULL; i++) {
|
||||
const char *addr = e_destination_get_address (recipients[i]);
|
||||
const char *addr = eab_destination_get_address (recipients[i]);
|
||||
|
||||
if (addr && addr[0]) {
|
||||
camel_address_decode ((CamelAddress *) cia, addr);
|
||||
if (camel_address_length ((CamelAddress *) cia) > 0) {
|
||||
camel_address_remove ((CamelAddress *) cia, -1);
|
||||
num++;
|
||||
if (e_destination_is_evolution_list (recipients[i])
|
||||
&& !e_destination_list_show_addresses (recipients[i])) {
|
||||
if (eab_destination_is_evolution_list (recipients[i])
|
||||
&& !eab_destination_list_show_addresses (recipients[i])) {
|
||||
hidden++;
|
||||
} else {
|
||||
shown++;
|
||||
@ -307,7 +307,7 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_
|
||||
recipients_bcc = e_msg_composer_get_bcc (composer);
|
||||
if (recipients_bcc) {
|
||||
for (i = 0; recipients_bcc[i] != NULL; i++) {
|
||||
const char *addr = e_destination_get_address (recipients_bcc[i]);
|
||||
const char *addr = eab_destination_get_address (recipients_bcc[i]);
|
||||
|
||||
if (addr && addr[0]) {
|
||||
camel_address_decode ((CamelAddress *) cia, addr);
|
||||
@ -318,7 +318,7 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_
|
||||
}
|
||||
}
|
||||
|
||||
e_destination_freev (recipients_bcc);
|
||||
eab_destination_freev (recipients_bcc);
|
||||
}
|
||||
|
||||
camel_object_unref (cia);
|
||||
@ -347,7 +347,7 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_
|
||||
|
||||
if (recipients) {
|
||||
for (i = 0; recipients[i] != NULL && !html_problem; i++) {
|
||||
if (!e_destination_get_html_mail_pref (recipients[i]))
|
||||
if (!eab_destination_get_html_mail_pref (recipients[i]))
|
||||
html_problem = TRUE;
|
||||
}
|
||||
}
|
||||
@ -384,12 +384,12 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_
|
||||
|
||||
/* Get the message recipients and 'touch' them, boosting their use scores */
|
||||
if (recipients)
|
||||
e_destination_touchv (recipients);
|
||||
eab_destination_touchv (recipients);
|
||||
|
||||
finished:
|
||||
|
||||
if (recipients)
|
||||
e_destination_freev (recipients);
|
||||
eab_destination_freev (recipients);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
@ -156,9 +156,8 @@ static void
|
||||
emfb_init(GObject *o)
|
||||
{
|
||||
EMFolderBrowser *emfb = (EMFolderBrowser *)o;
|
||||
RuleContext *search_context = mail_component_peek_search_context (mail_component_peek ());
|
||||
struct _EMFolderBrowserPrivate *p;
|
||||
/* FIXME ... */
|
||||
extern RuleContext *search_context;
|
||||
|
||||
p = emfb->priv = g_malloc0(sizeof(struct _EMFolderBrowserPrivate));
|
||||
|
||||
|
242
mail/em-folder-selection-button.c
Normal file
242
mail/em-folder-selection-button.c
Normal file
@ -0,0 +1,242 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
/* em-folder-selection-button.c
|
||||
*
|
||||
* Copyright (C) 2003 Ximian, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Author: Ettore Perazzoli <ettore@ximian.com>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "em-folder-selection-button.h"
|
||||
|
||||
#include "mail-component.h"
|
||||
#include "em-folder-selector.h"
|
||||
|
||||
#include <gal/util/e-util.h>
|
||||
|
||||
#include <gtk/gtkimage.h>
|
||||
#include <gtk/gtklabel.h>
|
||||
#include <gtk/gtkhbox.h>
|
||||
|
||||
|
||||
#define PARENT_TYPE gtk_button_get_type ()
|
||||
static GtkButtonClass *parent_class = NULL;
|
||||
|
||||
|
||||
struct _EMFolderSelectionButtonPrivate {
|
||||
GtkWidget *icon;
|
||||
GtkWidget *label;
|
||||
|
||||
char *uri;
|
||||
|
||||
char *title;
|
||||
char *caption;
|
||||
};
|
||||
|
||||
enum {
|
||||
SELECTED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
/* Utility functions. */
|
||||
|
||||
static void
|
||||
set_contents_unselected (EMFolderSelectionButton *button)
|
||||
{
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (button->priv->icon), NULL);
|
||||
gtk_label_set_text (GTK_LABEL (button->priv->label), _("<click here to select a folder>"));
|
||||
}
|
||||
|
||||
static void
|
||||
set_contents (EMFolderSelectionButton *button)
|
||||
{
|
||||
EMFolderSelectionButtonPrivate *priv = button->priv;
|
||||
char *path, *tmp, *label;
|
||||
|
||||
if (priv->uri == NULL)
|
||||
goto unset;
|
||||
|
||||
/* We set the button name directly from the storage set path, which is /accountname/path/foldername */
|
||||
path = e_storage_set_get_path_for_physical_uri(mail_component_peek_storage_set(mail_component_peek()), priv->uri);
|
||||
|
||||
if (path == NULL)
|
||||
goto unknown;
|
||||
|
||||
tmp = strchr(path+1, '/');
|
||||
if (tmp == NULL)
|
||||
goto unknown;
|
||||
*tmp++ = 0;
|
||||
|
||||
label = g_strdup_printf(_("\"%s\" in \"%s\""), tmp, path+1);
|
||||
gtk_label_set_text (GTK_LABEL (priv->label), label);
|
||||
g_free (label);
|
||||
|
||||
g_free(path);
|
||||
return;
|
||||
|
||||
unknown:
|
||||
g_free(path);
|
||||
unset:
|
||||
set_contents_unselected(button);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_finalize (GObject *object)
|
||||
{
|
||||
EMFolderSelectionButtonPrivate *priv = EM_FOLDER_SELECTION_BUTTON (object)->priv;
|
||||
|
||||
g_free (priv->title);
|
||||
g_free (priv->caption);
|
||||
g_free(priv->uri);
|
||||
g_free (priv);
|
||||
|
||||
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
emfsb_selector_response(EMFolderSelector *emfs, int response, EMFolderSelectionButton *button)
|
||||
{
|
||||
if (response == GTK_RESPONSE_OK) {
|
||||
const char *uri = em_folder_selector_get_selected_uri(emfs);
|
||||
|
||||
em_folder_selection_button_set_selection(button, uri);
|
||||
g_signal_emit(button, signals[SELECTED], 0);
|
||||
}
|
||||
|
||||
gtk_widget_destroy((GtkWidget *)emfs);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_clicked (GtkButton *button)
|
||||
{
|
||||
EMFolderSelectionButtonPrivate *priv = EM_FOLDER_SELECTION_BUTTON (button)->priv;
|
||||
EStorageSet *ess;
|
||||
GtkWidget *w;
|
||||
GtkWidget *toplevel;
|
||||
|
||||
if (GTK_BUTTON_CLASS (parent_class)->clicked != NULL)
|
||||
(* GTK_BUTTON_CLASS (parent_class)->clicked) (button);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
|
||||
ess = mail_component_peek_storage_set(mail_component_peek());
|
||||
w = em_folder_selector_new(ess, EM_FOLDER_SELECTOR_CAN_CREATE, priv->title, priv->caption);
|
||||
em_folder_selector_set_selected_uri((EMFolderSelector *)w, priv->uri);
|
||||
g_signal_connect(w, "response", G_CALLBACK(emfsb_selector_response), button);
|
||||
gtk_widget_show(w);
|
||||
}
|
||||
#if 0
|
||||
{
|
||||
uri = em_folder_selection_run_dialog_uri((GtkWindow *)toplevel,
|
||||
priv->title,
|
||||
priv->caption,
|
||||
priv->uri);
|
||||
|
||||
em_folder_selection_button_set_selection (EM_FOLDER_SELECTION_BUTTON (button), uri);
|
||||
g_free(uri);
|
||||
|
||||
g_signal_emit (button, signals[SELECTED], 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
class_init (EMFolderSelectionButtonClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkButtonClass *button_class = GTK_BUTTON_CLASS (class);
|
||||
|
||||
object_class->finalize = impl_finalize;
|
||||
|
||||
button_class->clicked = impl_clicked;
|
||||
|
||||
parent_class = g_type_class_peek_parent (class);
|
||||
|
||||
signals[SELECTED] = g_signal_new ("selected",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (EMFolderSelectionButtonClass, selected),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
init (EMFolderSelectionButton *folder_selection_button)
|
||||
{
|
||||
EMFolderSelectionButtonPrivate *priv;
|
||||
GtkWidget *box;
|
||||
|
||||
priv = g_new0 (EMFolderSelectionButtonPrivate, 1);
|
||||
folder_selection_button->priv = priv;
|
||||
|
||||
box = gtk_hbox_new (FALSE, 4);
|
||||
|
||||
priv->icon = gtk_image_new ();
|
||||
gtk_box_pack_start (GTK_BOX (box), priv->icon, FALSE, TRUE, 0);
|
||||
|
||||
priv->label = gtk_label_new ("");
|
||||
gtk_label_set_justify (GTK_LABEL (priv->label), GTK_JUSTIFY_LEFT);
|
||||
gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (box), priv->label, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show_all (box);
|
||||
gtk_container_add (GTK_CONTAINER (folder_selection_button), box);
|
||||
|
||||
set_contents (folder_selection_button);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
em_folder_selection_button_new(const char *title, const char *caption)
|
||||
{
|
||||
EMFolderSelectionButton *button = g_object_new (EM_TYPE_FOLDER_SELECTION_BUTTON, NULL);
|
||||
|
||||
button->priv->title = g_strdup (title);
|
||||
button->priv->caption = g_strdup (caption);
|
||||
|
||||
return GTK_WIDGET (button);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
em_folder_selection_button_set_selection(EMFolderSelectionButton *button, const char *uri)
|
||||
{
|
||||
EMFolderSelectionButtonPrivate *p = button->priv;
|
||||
|
||||
g_return_if_fail(EM_IS_FOLDER_SELECTION_BUTTON(button));
|
||||
|
||||
if (p->uri != uri) {
|
||||
g_free(p->uri);
|
||||
p->uri = g_strdup(uri);
|
||||
}
|
||||
|
||||
set_contents(button);
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
em_folder_selection_button_get_selection(EMFolderSelectionButton *button)
|
||||
{
|
||||
g_return_val_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button), NULL);
|
||||
|
||||
return button->priv->uri;
|
||||
}
|
||||
|
||||
E_MAKE_TYPE (em_folder_selection_button, "EMFolderSelectionButton", EMFolderSelectionButton, class_init, init, PARENT_TYPE)
|
59
mail/em-folder-selection-button.h
Normal file
59
mail/em-folder-selection-button.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
/* em-folder-selection-button.h
|
||||
*
|
||||
* Copyright (C) 2003 Ximian, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Author: Ettore Perazzoli <ettore@ximian.com>
|
||||
*/
|
||||
|
||||
#ifndef _EM_FOLDER_SELECTION_BUTTON_H_
|
||||
#define _EM_FOLDER_SELECTION_BUTTON_H_
|
||||
|
||||
#include <gtk/gtkbutton.h>
|
||||
|
||||
#define EM_TYPE_FOLDER_SELECTION_BUTTON (em_folder_selection_button_get_type ())
|
||||
#define EM_FOLDER_SELECTION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON, EMFolderSelectionButton))
|
||||
#define EM_FOLDER_SELECTION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EM_TYPE_FOLDER_SELECTION_BUTTON, EMFolderSelectionButtonClass))
|
||||
#define EM_IS_FOLDER_SELECTION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON))
|
||||
#define EM_IS_FOLDER_SELECTION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON))
|
||||
|
||||
typedef struct _EMFolderSelectionButton EMFolderSelectionButton;
|
||||
typedef struct _EMFolderSelectionButtonPrivate EMFolderSelectionButtonPrivate;
|
||||
typedef struct _EMFolderSelectionButtonClass EMFolderSelectionButtonClass;
|
||||
|
||||
struct _EMFolderSelectionButton {
|
||||
GtkButton parent;
|
||||
|
||||
EMFolderSelectionButtonPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EMFolderSelectionButtonClass {
|
||||
GtkButtonClass parent_class;
|
||||
|
||||
/* Signals. */
|
||||
|
||||
void (* selected) (EMFolderSelectionButton *button);
|
||||
};
|
||||
|
||||
GType em_folder_selection_button_get_type (void);
|
||||
|
||||
GtkWidget *em_folder_selection_button_new(const char *title, const char *caption);
|
||||
|
||||
void em_folder_selection_button_set_selection(EMFolderSelectionButton *button, const char *uri);
|
||||
const char *em_folder_selection_button_get_selection(EMFolderSelectionButton *button);
|
||||
|
||||
#endif /* _EM_FOLDER_SELECTION_BUTTON_H_ */
|
170
mail/em-folder-selection.c
Normal file
170
mail/em-folder-selection.c
Normal file
@ -0,0 +1,170 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
/* em-folder-selection.c - UI for selecting folders.
|
||||
*
|
||||
* Copyright (C) 2002 Ximian, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Author: Ettore Perazzoli <ettore@ximian.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "em-folder-selection.h"
|
||||
|
||||
#include "mail-component.h"
|
||||
#include "mail-tools.h"
|
||||
|
||||
#include "shell/e-folder-selection-dialog.h"
|
||||
|
||||
|
||||
CamelFolder *
|
||||
em_folder_selection_run_dialog (GtkWindow *parent_window,
|
||||
const char *title,
|
||||
const char *caption,
|
||||
CamelFolder *default_folder)
|
||||
{
|
||||
EStorageSet *storage_set = mail_component_peek_storage_set (mail_component_peek ());
|
||||
char *default_path = NULL;
|
||||
CamelStore *default_store;
|
||||
GtkWidget *dialog;
|
||||
EFolder *selected_e_folder;
|
||||
CamelFolder *selected_camel_folder;
|
||||
int response;
|
||||
|
||||
default_store = camel_folder_get_parent_store (default_folder);
|
||||
if (default_store != NULL) {
|
||||
EStorage *storage = mail_component_lookup_storage (mail_component_peek (), default_store);
|
||||
|
||||
if (storage != NULL) {
|
||||
default_path = g_strconcat ("/",
|
||||
e_storage_get_name (storage),
|
||||
"/",
|
||||
camel_folder_get_full_name (default_folder),
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* EPFIXME: Allowed types? */
|
||||
dialog = e_folder_selection_dialog_new (storage_set, title, caption, default_path, NULL, FALSE);
|
||||
g_free(default_path);
|
||||
response = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
|
||||
if (response != GTK_RESPONSE_OK) {
|
||||
gtk_widget_destroy (dialog);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
selected_e_folder = e_storage_set_get_folder (storage_set,
|
||||
e_folder_selection_dialog_get_selected_path (E_FOLDER_SELECTION_DIALOG (dialog)));
|
||||
if (selected_e_folder == NULL) {
|
||||
gtk_widget_destroy (dialog);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
selected_camel_folder = mail_tool_uri_to_folder (e_folder_get_physical_uri (selected_e_folder), 0, NULL);
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
return selected_camel_folder;
|
||||
}
|
||||
|
||||
/* FIXME: This isn't the way to do it, but then neither is the above, really ... */
|
||||
char *
|
||||
em_folder_selection_run_dialog_uri(GtkWindow *parent_window,
|
||||
const char *title,
|
||||
const char *caption,
|
||||
const char *default_folder_uri)
|
||||
{
|
||||
EStorageSet *storage_set = mail_component_peek_storage_set (mail_component_peek ());
|
||||
char *default_path;
|
||||
GtkWidget *dialog;
|
||||
EFolder *selected_e_folder;
|
||||
int response;
|
||||
|
||||
default_path = e_storage_set_get_path_for_physical_uri(storage_set, default_folder_uri);
|
||||
dialog = e_folder_selection_dialog_new (storage_set, title, caption, default_path, NULL, FALSE);
|
||||
g_free(default_path);
|
||||
response = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
|
||||
if (response != GTK_RESPONSE_OK) {
|
||||
gtk_widget_destroy (dialog);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
selected_e_folder = e_storage_set_get_folder (storage_set,
|
||||
e_folder_selection_dialog_get_selected_path (E_FOLDER_SELECTION_DIALOG (dialog)));
|
||||
gtk_widget_destroy (dialog);
|
||||
if (selected_e_folder == NULL)
|
||||
return NULL;
|
||||
|
||||
return g_strdup(e_folder_get_physical_uri(selected_e_folder));
|
||||
}
|
||||
|
||||
|
||||
struct _select_folder_data {
|
||||
void (*done)(const char *uri, void *data);
|
||||
void *data;
|
||||
};
|
||||
|
||||
static void
|
||||
emfs_folder_selected(GtkWidget *w, const char *path, struct _select_folder_data *d)
|
||||
{
|
||||
const char *uri = NULL;
|
||||
EStorageSet *storage_set = mail_component_peek_storage_set (mail_component_peek ());
|
||||
EFolder *folder;
|
||||
|
||||
folder = e_storage_set_get_folder(storage_set, path);
|
||||
if (folder)
|
||||
uri = e_folder_get_physical_uri(folder);
|
||||
|
||||
gtk_widget_hide(w);
|
||||
|
||||
d->done(uri, d->data);
|
||||
|
||||
gtk_widget_destroy(w);
|
||||
}
|
||||
|
||||
static void
|
||||
emfs_folder_cancelled(GtkWidget *w, struct _select_folder_data *d)
|
||||
{
|
||||
gtk_widget_destroy(w);
|
||||
}
|
||||
|
||||
void
|
||||
em_select_folder(GtkWindow *parent_window, const char *title, const char *text, const char *default_folder_uri, void (*done)(const char *uri, void *data), void *data)
|
||||
{
|
||||
EStorageSet *storage_set = mail_component_peek_storage_set (mail_component_peek ());
|
||||
char *path;
|
||||
GtkWidget *dialog;
|
||||
struct _select_folder_data *d;
|
||||
|
||||
d = g_malloc0(sizeof(*d));
|
||||
d->data = data;
|
||||
d->done = done;
|
||||
|
||||
if (default_folder_uri)
|
||||
path = e_storage_set_get_path_for_physical_uri(storage_set, default_folder_uri);
|
||||
else
|
||||
path = NULL;
|
||||
dialog = e_folder_selection_dialog_new(storage_set, title, text, path, NULL, TRUE);
|
||||
g_free(path);
|
||||
/* ugh, painful api ... */
|
||||
g_signal_connect(dialog, "folder_selected", G_CALLBACK(emfs_folder_selected), d);
|
||||
g_signal_connect(dialog, "cancelled", G_CALLBACK(emfs_folder_cancelled), d);
|
||||
g_object_set_data_full((GObject *)dialog, "emfs_data", d, g_free);
|
||||
gtk_widget_show(dialog);
|
||||
}
|
41
mail/em-folder-selection.h
Normal file
41
mail/em-folder-selection.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
/* em-folder-selection.h - UI for selecting folders.
|
||||
*
|
||||
* Copyright (C) 2002 Ximian, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Author: Ettore Perazzoli <ettore@ximian.com>
|
||||
*/
|
||||
|
||||
#ifndef EM_FOLDER_SELECTION_H
|
||||
#define EM_FOLDER_SELECTION_H
|
||||
|
||||
#include <camel/camel-folder.h>
|
||||
|
||||
#include <gtk/gtkwindow.h>
|
||||
|
||||
CamelFolder *em_folder_selection_run_dialog (GtkWindow *parent_window,
|
||||
const char *title,
|
||||
const char *caption,
|
||||
CamelFolder *default_folder);
|
||||
char *em_folder_selection_run_dialog_uri(GtkWindow *parent_window,
|
||||
const char *title,
|
||||
const char *caption,
|
||||
const char *default_folder_uri);
|
||||
|
||||
void em_select_folder(GtkWindow *parent_window, const char *title, const char *text, const char *default_folder_uri, void (*done)(const char *uri, void *data), void *data);
|
||||
|
||||
#endif /* EM_FOLDER_SELECTION_H */
|
349
mail/em-folder-selector.c
Normal file
349
mail/em-folder-selector.c
Normal file
@ -0,0 +1,349 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
|
||||
*
|
||||
* Copyright(C) 2000, 2001, 2002, 2003 Ximian, Inc.
|
||||
*
|
||||
* Authors: Ettore Perazzoli
|
||||
* Michael Zucchi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "em-folder-selector.h"
|
||||
|
||||
#include "shell/e-storage-set-view.h"
|
||||
#include "shell/e-storage-set.h"
|
||||
|
||||
#include <libgnome/gnome-i18n.h>
|
||||
|
||||
#include <gal/util/e-util.h>
|
||||
#include <gal/widgets/e-gui-utils.h>
|
||||
|
||||
#include <gtk/gtkentry.h>
|
||||
#include <gtk/gtkbox.h>
|
||||
#include <gtk/gtkhbox.h>
|
||||
#include <gtk/gtklabel.h>
|
||||
#include <gtk/gtkscrolledwindow.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
#include <gtk/gtkstock.h>
|
||||
|
||||
#include <camel/camel-url.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define PARENT_TYPE (gtk_dialog_get_type())
|
||||
static GtkDialogClass *parent_class = NULL;
|
||||
|
||||
static gboolean
|
||||
check_folder_type_valid(EMFolderSelector *emfs)
|
||||
{
|
||||
const char *selected;
|
||||
EFolder *folder;
|
||||
|
||||
selected = e_storage_set_view_get_current_folder(emfs->essv);
|
||||
if (selected == NULL)
|
||||
return FALSE;
|
||||
|
||||
folder = e_storage_set_get_folder(emfs->ess, selected);
|
||||
if (folder == NULL)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if 0 /* EPFIXME */
|
||||
static void
|
||||
folder_creation_dialog_result_cb(EShell *shell,
|
||||
EShellFolderCreationDialogResult result,
|
||||
const char *path,
|
||||
void *data)
|
||||
{
|
||||
EMFolderSelector *dialog;
|
||||
|
||||
dialog = EM_FOLDER_SELECTOR(data);
|
||||
|
||||
if (result == E_SHELL_FOLDER_CREATION_DIALOG_RESULT_SUCCESS)
|
||||
e_storage_set_view_set_current_folder(E_STORAGE_SET_VIEW(priv->storage_set_view),
|
||||
path);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
emfs_dispose(GObject *object)
|
||||
{
|
||||
EMFolderSelector *emfs = (EMFolderSelector *)object;
|
||||
|
||||
if (emfs->ess != NULL) {
|
||||
g_object_unref(emfs->ess);
|
||||
emfs->ess = NULL;
|
||||
emfs->essv = NULL;
|
||||
}
|
||||
|
||||
(* G_OBJECT_CLASS(parent_class)->dispose)(object);
|
||||
}
|
||||
|
||||
static void
|
||||
emfs_finalize(GObject *object)
|
||||
{
|
||||
/*EMFolderSelector *emfs = (EMFolderSelector *)object;*/
|
||||
|
||||
(* G_OBJECT_CLASS(parent_class)->finalize)(object);
|
||||
}
|
||||
|
||||
static void
|
||||
emfs_response(GtkDialog *dialog, int response)
|
||||
{
|
||||
EMFolderSelector *emfs = (EMFolderSelector *)dialog;
|
||||
const char *path;
|
||||
|
||||
switch (response) {
|
||||
case EM_FOLDER_SELECTOR_RESPONSE_NEW:
|
||||
path = e_storage_set_view_get_current_folder(emfs->essv);
|
||||
|
||||
printf("create new folder, default parent '%s'\n", path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
emfs_class_init(EMFolderSelectorClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GtkDialogClass *dialog_class;
|
||||
|
||||
parent_class = g_type_class_ref(PARENT_TYPE);
|
||||
object_class = G_OBJECT_CLASS(klass);
|
||||
dialog_class = GTK_DIALOG_CLASS(klass);
|
||||
|
||||
object_class->dispose = emfs_dispose;
|
||||
object_class->finalize = emfs_finalize;
|
||||
|
||||
dialog_class->response = emfs_response;
|
||||
}
|
||||
|
||||
static void
|
||||
emfs_init(EMFolderSelector *emfs)
|
||||
{
|
||||
emfs->flags = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
folder_selected_cb(EStorageSetView *essv, const char *path, EMFolderSelector *emfs)
|
||||
{
|
||||
if (check_folder_type_valid(emfs))
|
||||
gtk_dialog_set_response_sensitive(GTK_DIALOG(emfs), GTK_RESPONSE_OK, TRUE);
|
||||
else
|
||||
gtk_dialog_set_response_sensitive(GTK_DIALOG(emfs), GTK_RESPONSE_OK, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
double_click_cb(EStorageSetView *essv, int row, ETreePath path, int col, GdkEvent *event, EMFolderSelector *emfs)
|
||||
{
|
||||
if (check_folder_type_valid(emfs)) {
|
||||
/*g_signal_emit(emfs, signals[FOLDER_SELECTED], 0,
|
||||
em_folder_selector_get_selected(emfs));*/
|
||||
printf("double clicked!\n");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
em_folder_selector_construct(EMFolderSelector *emfs, EStorageSet *ess, guint32 flags, const char *title, const char *text)
|
||||
{
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *text_label;
|
||||
|
||||
gtk_window_set_default_size(GTK_WINDOW(emfs), 350, 300);
|
||||
gtk_window_set_modal(GTK_WINDOW(emfs), TRUE);
|
||||
gtk_window_set_title(GTK_WINDOW(emfs), title);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(emfs), 6);
|
||||
|
||||
emfs->flags = flags;
|
||||
if (flags & EM_FOLDER_SELECTOR_CAN_CREATE)
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(emfs), GTK_STOCK_NEW, EM_FOLDER_SELECTOR_RESPONSE_NEW, NULL);
|
||||
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(emfs),
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_response_sensitive(GTK_DIALOG(emfs), GTK_RESPONSE_OK, FALSE);
|
||||
gtk_dialog_set_default_response(GTK_DIALOG(emfs), GTK_RESPONSE_OK);
|
||||
|
||||
emfs->ess = ess;
|
||||
g_object_ref(ess);
|
||||
|
||||
emfs->essv = (EStorageSetView *)e_storage_set_create_new_view(ess, NULL);
|
||||
e_storage_set_view_set_allow_dnd(emfs->essv, FALSE);
|
||||
e_storage_set_view_enable_search(emfs->essv, TRUE);
|
||||
|
||||
g_signal_connect(emfs->essv, "double_click", G_CALLBACK(double_click_cb), emfs);
|
||||
g_signal_connect(emfs->essv, "folder_selected", G_CALLBACK(folder_selected_cb), emfs);
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new(NULL, NULL);
|
||||
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN);
|
||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(scrolled_window), (GtkWidget *)emfs->essv);
|
||||
|
||||
gtk_box_pack_end(GTK_BOX(GTK_DIALOG(emfs)->vbox), scrolled_window, TRUE, TRUE, 6);
|
||||
gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(emfs)->vbox), 6);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(emfs)->vbox), 6);
|
||||
|
||||
gtk_widget_show((GtkWidget *)emfs->essv);
|
||||
gtk_widget_show(scrolled_window);
|
||||
|
||||
if (text != NULL) {
|
||||
text_label = gtk_label_new(text);
|
||||
gtk_label_set_justify(GTK_LABEL(text_label), GTK_JUSTIFY_LEFT);
|
||||
gtk_widget_show(text_label);
|
||||
|
||||
gtk_box_pack_end(GTK_BOX(GTK_DIALOG(emfs)->vbox), text_label, FALSE, TRUE, 6);
|
||||
gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(emfs)->vbox), 6);
|
||||
}
|
||||
|
||||
GTK_WIDGET_SET_FLAGS((GtkWidget *)emfs->essv, GTK_CAN_FOCUS);
|
||||
gtk_widget_grab_focus((GtkWidget *)emfs->essv);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
em_folder_selector_new(EStorageSet *ess, guint32 flags, const char *title, const char *text)
|
||||
{
|
||||
EMFolderSelector *emfs;
|
||||
|
||||
g_return_val_if_fail(E_IS_STORAGE_SET(ess), NULL);
|
||||
|
||||
emfs = g_object_new(em_folder_selector_get_type(), NULL);
|
||||
em_folder_selector_construct(emfs, ess, flags, title, text);
|
||||
|
||||
return GTK_WIDGET(emfs);
|
||||
}
|
||||
|
||||
static void
|
||||
emfs_create_name_changed(GtkEntry *entry, EMFolderSelector *emfs)
|
||||
{
|
||||
int active;
|
||||
|
||||
active = e_storage_set_view_get_current_folder(emfs->essv) != NULL
|
||||
&& emfs->name_entry->text_length > 0;
|
||||
|
||||
gtk_dialog_set_response_sensitive((GtkDialog *)emfs, GTK_RESPONSE_OK, active);
|
||||
}
|
||||
|
||||
static void
|
||||
emfs_create_name_activate(GtkEntry *entry, EMFolderSelector *emfs)
|
||||
{
|
||||
printf("entry activated, woop\n");
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
em_folder_selector_create_new(EStorageSet *ess, guint32 flags, const char *title, const char *text)
|
||||
{
|
||||
EMFolderSelector *emfs;
|
||||
GtkWidget *hbox, *w;
|
||||
|
||||
g_return_val_if_fail(E_IS_STORAGE_SET(ess), NULL);
|
||||
|
||||
emfs = g_object_new(em_folder_selector_get_type(), NULL);
|
||||
em_folder_selector_construct(emfs, ess, flags, title, text);
|
||||
|
||||
hbox = gtk_hbox_new(FALSE, 0);
|
||||
w = gtk_label_new_with_mnemonic(_("Folder _name"));
|
||||
gtk_box_pack_start((GtkBox *)hbox, w, FALSE, FALSE, 6);
|
||||
emfs->name_entry = (GtkEntry *)gtk_entry_new();
|
||||
g_signal_connect(emfs->name_entry, "changed", G_CALLBACK(emfs_create_name_changed), emfs);
|
||||
g_signal_connect(emfs->name_entry, "activate", G_CALLBACK(emfs_create_name_activate), emfs);
|
||||
gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)emfs->name_entry, TRUE, FALSE, 6);
|
||||
gtk_widget_show_all(hbox);
|
||||
|
||||
gtk_box_pack_start((GtkBox *)((GtkDialog *)emfs)->vbox, hbox, FALSE, TRUE, 0);
|
||||
|
||||
return GTK_WIDGET(emfs);
|
||||
}
|
||||
|
||||
void
|
||||
em_folder_selector_set_selected(EMFolderSelector *emfs, const char *path)
|
||||
{
|
||||
e_storage_set_view_set_current_folder(emfs->essv, path);
|
||||
}
|
||||
|
||||
void
|
||||
em_folder_selector_set_selected_uri(EMFolderSelector *emfs, const char *uri)
|
||||
{
|
||||
const char *path;
|
||||
|
||||
path = e_storage_set_get_path_for_physical_uri(emfs->ess, uri);
|
||||
if (path)
|
||||
e_storage_set_view_set_current_folder(emfs->essv, path);
|
||||
}
|
||||
|
||||
const char *
|
||||
em_folder_selector_get_selected(EMFolderSelector *emfs)
|
||||
{
|
||||
const char *path;
|
||||
|
||||
path = e_storage_set_view_get_current_folder(emfs->essv);
|
||||
if (emfs->name_entry) {
|
||||
g_free(emfs->selected);
|
||||
emfs->selected = g_strdup_printf("%s/%s", path, gtk_entry_get_text(emfs->name_entry));
|
||||
path = emfs->selected;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
const char *
|
||||
em_folder_selector_get_selected_uri(EMFolderSelector *emfs)
|
||||
{
|
||||
const char *path;
|
||||
EFolder *folder;
|
||||
|
||||
path = e_storage_set_view_get_current_folder(emfs->essv);
|
||||
if (path == NULL) {
|
||||
printf("current folder is null?\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
folder = e_storage_set_get_folder(emfs->ess, path);
|
||||
if (folder == NULL) {
|
||||
printf("path ok, but can't get folder?\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
path = e_folder_get_physical_uri(folder);
|
||||
if (path && emfs->name_entry) {
|
||||
CamelURL *url;
|
||||
char *newpath;
|
||||
|
||||
url = camel_url_new(path, NULL);
|
||||
newpath = g_strdup_printf("%s/%s", url->fragment?url->fragment:url->path, gtk_entry_get_text(emfs->name_entry));
|
||||
if (url->fragment)
|
||||
camel_url_set_fragment(url, newpath);
|
||||
else
|
||||
camel_url_set_path(url, newpath);
|
||||
g_free(emfs->selected_uri);
|
||||
emfs->selected_uri = camel_url_to_string(url, 0);
|
||||
camel_url_free(url);
|
||||
path = emfs->selected_uri;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
E_MAKE_TYPE(em_folder_selector, "EMFolderSelector", EMFolderSelector, emfs_class_init, emfs_init, PARENT_TYPE)
|
96
mail/em-folder-selector.h
Normal file
96
mail/em-folder-selector.h
Normal file
@ -0,0 +1,96 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
/* e-folder-selection-dialog.h
|
||||
*
|
||||
* Copyright (C) 2000, 2001, 2002, 2003 Ximian, Inc.
|
||||
*
|
||||
* Authors: Ettore Perazzoli
|
||||
* Michael Zucchi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EM_FOLDER_SELECTOR_H
|
||||
#define EM_FOLDER_SELECTOR_H
|
||||
|
||||
#include <gtk/gtkdialog.h>
|
||||
|
||||
#ifdef cplusplus
|
||||
extern "C" {
|
||||
#pragma }
|
||||
#endif /* cplusplus */
|
||||
|
||||
#define EM_TYPE_FOLDER_SELECTOR (em_folder_selector_get_type ())
|
||||
#define EM_FOLDER_SELECTOR(obj) (GTK_CHECK_CAST ((obj), E_TYPEM_FOLDER_SELECTOR, EMFolderSelector))
|
||||
#define EM_FOLDER_SELECTOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPEM_FOLDER_SELECTOR, EMFolderSelectorClass))
|
||||
#define EM_IS_FOLDER_SELECTOR(obj) (GTK_CHECK_TYPE ((obj), E_TYPEM_FOLDER_SELECTOR))
|
||||
#define EM_IS_FOLDER_SELECTOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPEM_FOLDER_SELECTOR))
|
||||
|
||||
typedef struct _EMFolderSelector EMFolderSelector;
|
||||
typedef struct _EMFolderSelectorPrivate EMFolderSelectorPrivate;
|
||||
typedef struct _EMFolderSelectorClass EMFolderSelectorClass;
|
||||
|
||||
struct _EStorageSet;
|
||||
struct _EStorageSetView;
|
||||
|
||||
struct _EMFolderSelector {
|
||||
GtkDialog parent;
|
||||
|
||||
guint32 flags;
|
||||
struct _EStorageSet *ess;
|
||||
struct _EStorageSetView *essv;
|
||||
|
||||
struct _GtkEntry *name_entry;
|
||||
char *selected;
|
||||
char *selected_uri;
|
||||
};
|
||||
|
||||
struct _EMFolderSelectorClass {
|
||||
GtkDialogClass parent_class;
|
||||
|
||||
#if 0
|
||||
void (* folder_selected) (EMFolderSelector *folder_selection_dialog,
|
||||
const char *path);
|
||||
void (* cancelled) (EMFolderSelector *folder_selection_dialog);
|
||||
#endif
|
||||
};
|
||||
|
||||
enum {
|
||||
EM_FOLDER_SELECTOR_CAN_CREATE = 1,
|
||||
};
|
||||
|
||||
enum {
|
||||
EM_FOLDER_SELECTOR_RESPONSE_NEW = 1,
|
||||
};
|
||||
|
||||
GtkType em_folder_selector_get_type (void);
|
||||
void em_folder_selector_construct(EMFolderSelector *, struct _EStorageSet *, guint32, const char *, const char *);
|
||||
/* for selecting folders */
|
||||
GtkWidget *em_folder_selector_new (struct _EStorageSet *, guint32, const char *, const char *);
|
||||
|
||||
/* for creating folders */
|
||||
GtkWidget *em_folder_selector_create_new(struct _EStorageSet *ess, guint32 flags, const char *title, const char *text);
|
||||
|
||||
void em_folder_selector_set_selected (EMFolderSelector *emfs, const char *path);
|
||||
void em_folder_selector_set_selected_uri(EMFolderSelector *emfs, const char *uri);
|
||||
|
||||
const char *em_folder_selector_get_selected (EMFolderSelector *emfs);
|
||||
const char *em_folder_selector_get_selected_uri(EMFolderSelector *emfs);
|
||||
|
||||
#ifdef cplusplus
|
||||
}
|
||||
#endif /* cplusplus */
|
||||
|
||||
#endif /* EM_FOLDER_SELECTOR_H */
|
@ -542,16 +542,52 @@ emfv_popup_undelete(GtkWidget *w, EMFolderView *emfv)
|
||||
em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_DELETED, 0);
|
||||
}
|
||||
|
||||
struct _move_data {
|
||||
EMFolderView *emfv;
|
||||
GPtrArray *uids;
|
||||
int delete;
|
||||
};
|
||||
|
||||
static void
|
||||
emfv_popup_move_cb(const char *uri, void *data)
|
||||
{
|
||||
struct _move_data *d = data;
|
||||
|
||||
if (uri)
|
||||
mail_transfer_messages(d->emfv->folder, d->uids, d->delete, uri, 0, NULL, NULL);
|
||||
else
|
||||
em_utils_uids_free(d->uids);
|
||||
|
||||
g_object_unref(d->emfv);
|
||||
g_free(d);
|
||||
}
|
||||
|
||||
static void
|
||||
emfv_popup_move(GtkWidget *w, EMFolderView *emfv)
|
||||
{
|
||||
/* FIXME */
|
||||
struct _move_data *d;
|
||||
|
||||
d = g_malloc(sizeof(*d));
|
||||
d->emfv = emfv;
|
||||
g_object_ref(emfv);
|
||||
d->uids = message_list_get_selected(emfv->list);
|
||||
d->delete = TRUE;
|
||||
|
||||
em_select_folder((GtkWidget *)emfv, _("Select folder"), NULL, NULL, emfv_popup_move_cb, d);
|
||||
}
|
||||
|
||||
static void
|
||||
emfv_popup_copy(GtkWidget *w, EMFolderView *emfv)
|
||||
{
|
||||
/* FIXME */
|
||||
struct _move_data *d;
|
||||
|
||||
d = g_malloc(sizeof(*d));
|
||||
d->emfv = emfv;
|
||||
g_object_ref(emfv);
|
||||
d->uids = message_list_get_selected(emfv->list);
|
||||
d->delete = FALSE;
|
||||
|
||||
em_select_folder((GtkWidget *)emfv, _("Select folder"), NULL, NULL, emfv_popup_move_cb, d);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -62,6 +62,8 @@
|
||||
#include <camel/camel-file-utils.h>
|
||||
|
||||
#include <e-util/e-msgport.h>
|
||||
|
||||
#include "mail-component.h"
|
||||
#include "mail-mt.h"
|
||||
|
||||
#include "em-format-html.h"
|
||||
@ -214,15 +216,15 @@ em_format_html_get_type(void)
|
||||
sizeof(EMFormatHTML), 0,
|
||||
(GInstanceInitFunc)efh_init
|
||||
};
|
||||
extern char *evolution_dir;
|
||||
const char *base_directory = mail_component_peek_base_directory (mail_component_peek ());
|
||||
char *path;
|
||||
|
||||
efh_parent = g_type_class_ref(em_format_get_type());
|
||||
type = g_type_register_static(em_format_get_type(), "EMFormatHTML", &info, 0);
|
||||
|
||||
/* cache expiry - 2 hour access, 1 day max */
|
||||
path = alloca(strlen(evolution_dir)+16);
|
||||
sprintf(path, "%s/cache", evolution_dir);
|
||||
path = alloca(strlen(base_directory)+16);
|
||||
sprintf(path, "%s/cache", base_directory);
|
||||
emfh_http_cache = camel_data_cache_new(path, 0, NULL);
|
||||
camel_data_cache_set_expire_age(emfh_http_cache, 24*60*60);
|
||||
camel_data_cache_set_expire_access(emfh_http_cache, 2*60*60);
|
||||
|
@ -1 +1,2 @@
|
||||
BOOLEAN:BOXED,POINTER,POINTER
|
||||
NONE:POINTER
|
||||
|
@ -353,7 +353,8 @@ em_popup_create_menu_once(EMPopup *emp, EMPopupTarget *target, guint32 hide_mask
|
||||
|
||||
menu = em_popup_create_menu(emp, hide_mask, disable_mask);
|
||||
|
||||
g_signal_connect_swapped(menu, "selection_done", G_CALLBACK(em_popup_target_free), target);
|
||||
if (target)
|
||||
g_signal_connect_swapped(menu, "selection_done", G_CALLBACK(em_popup_target_free), target);
|
||||
g_signal_connect(menu, "selection_done", G_CALLBACK(emp_popup_done), emp);
|
||||
|
||||
return menu;
|
||||
|
@ -69,6 +69,7 @@ enum _em_popup_target_t {
|
||||
EM_POPUP_TARGET_SELECT,
|
||||
EM_POPUP_TARGET_URI,
|
||||
EM_POPUP_TARGET_PART,
|
||||
EM_POPUP_TARGET_FOLDER,
|
||||
};
|
||||
|
||||
/* Flags that describe a TARGET_SELECT */
|
||||
@ -103,6 +104,13 @@ enum {
|
||||
EM_POPUP_PART_IMAGE = 1<<1,
|
||||
};
|
||||
|
||||
/* Flags that describe TARGET_FOLDER */
|
||||
enum {
|
||||
EM_POPUP_FOLDER_LOCAL = 1<<0,
|
||||
EM_POPUP_FOLDER_REMOTE = 1<<1,
|
||||
EM_POPUP_FOLDER_VFOLDER = 1<<2,
|
||||
};
|
||||
|
||||
struct _EMPopupTarget {
|
||||
enum _em_popup_target_t type;
|
||||
guint32 mask; /* depends on type, see above */
|
||||
@ -118,6 +126,9 @@ struct _EMPopupTarget {
|
||||
char *mime_type;
|
||||
struct _CamelMimePart *part;
|
||||
} part;
|
||||
struct {
|
||||
char *folder_uri;
|
||||
} folder;
|
||||
} data;
|
||||
};
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include <filter/filter-editor.h>
|
||||
|
||||
#include "mail-component.h"
|
||||
#include "mail-mt.h"
|
||||
#include "mail-ops.h"
|
||||
#include "mail-tools.h"
|
||||
@ -215,14 +216,14 @@ static GtkWidget *filter_editor = NULL;
|
||||
static void
|
||||
filter_editor_response (GtkWidget *dialog, int button, gpointer user_data)
|
||||
{
|
||||
extern char *evolution_dir;
|
||||
FilterContext *fc;
|
||||
|
||||
if (button == GTK_RESPONSE_ACCEPT) {
|
||||
char *user;
|
||||
|
||||
fc = g_object_get_data ((GObject *) dialog, "context");
|
||||
user = g_strdup_printf ("%s/filters.xml", evolution_dir);
|
||||
user = g_strdup_printf ("%s/filters.xml",
|
||||
mail_component_peek_base_directory (mail_component_peek ()));
|
||||
rule_context_save ((RuleContext *) fc, user);
|
||||
g_free (user);
|
||||
}
|
||||
@ -249,7 +250,7 @@ static const char *filter_source_names[] = {
|
||||
void
|
||||
em_utils_edit_filters (GtkWidget *parent)
|
||||
{
|
||||
extern char *evolution_dir;
|
||||
const char *base_directory = mail_component_peek_base_directory (mail_component_peek ());
|
||||
char *user, *system;
|
||||
FilterContext *fc;
|
||||
|
||||
@ -259,7 +260,7 @@ em_utils_edit_filters (GtkWidget *parent)
|
||||
}
|
||||
|
||||
fc = filter_context_new ();
|
||||
user = g_strdup_printf ("%s/filters.xml", evolution_dir);
|
||||
user = g_strdup_printf ("%s/filters.xml", base_directory);
|
||||
system = EVOLUTION_PRIVDATADIR "/filtertypes.xml";
|
||||
rule_context_load ((RuleContext *) fc, system, user);
|
||||
g_free (user);
|
||||
@ -773,10 +774,10 @@ generate_account_hash (void)
|
||||
return account_hash;
|
||||
}
|
||||
|
||||
static EDestination **
|
||||
static EABDestination **
|
||||
em_utils_camel_address_to_destination (CamelInternetAddress *iaddr)
|
||||
{
|
||||
EDestination *dest, **destv;
|
||||
EABDestination *dest, **destv;
|
||||
int n, i, j;
|
||||
|
||||
if (iaddr == NULL)
|
||||
@ -785,14 +786,14 @@ em_utils_camel_address_to_destination (CamelInternetAddress *iaddr)
|
||||
if ((n = camel_address_length ((CamelAddress *) iaddr)) == 0)
|
||||
return NULL;
|
||||
|
||||
destv = g_malloc (sizeof (EDestination *) * (n + 1));
|
||||
destv = g_malloc (sizeof (EABDestination *) * (n + 1));
|
||||
for (i = 0, j = 0; i < n; i++) {
|
||||
const char *name, *addr;
|
||||
|
||||
if (camel_internet_address_get (iaddr, i, &name, &addr)) {
|
||||
dest = e_destination_new ();
|
||||
e_destination_set_name (dest, name);
|
||||
e_destination_set_email (dest, addr);
|
||||
dest = eab_destination_new ();
|
||||
eab_destination_set_name (dest, name);
|
||||
eab_destination_set_email (dest, addr);
|
||||
|
||||
destv[j++] = dest;
|
||||
}
|
||||
@ -813,7 +814,7 @@ reply_get_composer (GtkWidget *parent, CamelMimeMessage *message, EAccount *acco
|
||||
CamelInternetAddress *to, CamelInternetAddress *cc)
|
||||
{
|
||||
const char *message_id, *references;
|
||||
EDestination **tov, **ccv;
|
||||
EABDestination **tov, **ccv;
|
||||
EMsgComposer *composer;
|
||||
char *subject;
|
||||
|
||||
@ -1211,7 +1212,7 @@ post_reply_to_message (CamelFolder *folder, const char *uid, CamelMimeMessage *m
|
||||
const char *message_id, *references;
|
||||
CamelInternetAddress *to = NULL;
|
||||
GtkWidget *parent = user_data;
|
||||
EDestination **tov = NULL;
|
||||
EABDestination **tov = NULL;
|
||||
EMsgComposer *composer;
|
||||
char *subject, *url;
|
||||
EAccount *account;
|
||||
|
@ -36,6 +36,7 @@ struct _GtkWindow;
|
||||
struct _CamelFolder;
|
||||
struct _CamelStream;
|
||||
struct _CamelMimeMessage;
|
||||
struct _CamelMimePart;
|
||||
struct _GtkSelectionData;
|
||||
struct _GtkAdjustment;
|
||||
struct _EMsgComposer;
|
||||
|
@ -118,14 +118,13 @@ control_destroy_cb (GtkObject *fb, GObject *control)
|
||||
}
|
||||
|
||||
BonoboControl *
|
||||
folder_browser_factory_new_control (const char *uri,
|
||||
const GNOME_Evolution_Shell shell)
|
||||
folder_browser_factory_new_control (const char *uri)
|
||||
{
|
||||
BonoboControl *control;
|
||||
GtkWidget *fb;
|
||||
|
||||
#if 0
|
||||
if (!(fb = folder_browser_new (shell, uri)))
|
||||
if (!(fb = folder_browser_new (uri)))
|
||||
return NULL;
|
||||
|
||||
FOLDER_BROWSER (fb)->pref_master = TRUE; /* save UI settings changed in this FB */
|
||||
|
@ -15,8 +15,7 @@
|
||||
#include "Evolution.h"
|
||||
#include "e-util/e-list.h"
|
||||
|
||||
BonoboControl *folder_browser_factory_new_control (const char *uri,
|
||||
const GNOME_Evolution_Shell shell);
|
||||
BonoboControl *folder_browser_factory_new_control (const char *uri);
|
||||
EList *folder_browser_factory_get_control_list (void);
|
||||
|
||||
struct _EMFolderBrowser *folder_browser_factory_get_browser(const char *uri);
|
||||
|
816
mail/folder-browser-ui.c
Normal file
816
mail/folder-browser-ui.c
Normal file
@ -0,0 +1,816 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Authors: Peter Williams <peterw@ximian.com>
|
||||
* Jeffrey Stedfast <fejj@ximian.com>
|
||||
*
|
||||
* Copyright 2002 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gconf/gconf.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
|
||||
#include <libgnome/gnome-util.h> /* gnome_util_prepend_user_home */
|
||||
|
||||
#include <bonobo/bonobo-exception.h>
|
||||
#include <bonobo/bonobo-ui-component.h>
|
||||
#include <bonobo/bonobo-ui-util.h>
|
||||
|
||||
#include "widgets/misc/e-charset-picker.h"
|
||||
#include "widgets/menus/gal-view-menus.h" /* GalView stuff */
|
||||
#include <gal/menus/gal-view-factory-etable.h>
|
||||
#include <gal/menus/gal-view-etable.h>
|
||||
|
||||
#include "e-util/e-meta.h"
|
||||
|
||||
#include "mail-config.h"
|
||||
#include "mail-callbacks.h" /* almost all the verbs */
|
||||
#include "mail-session.h" /* mail_session_forget_passwords */
|
||||
|
||||
#include "folder-browser-ui.h"
|
||||
|
||||
#include "evolution-shell-component-utils.h" /* Pixmap stuff */
|
||||
|
||||
|
||||
/*
|
||||
* Add with 'folder_browser'
|
||||
*/
|
||||
|
||||
static BonoboUIVerb message_verbs [] = {
|
||||
BONOBO_UI_UNSAFE_VERB ("MailNext", next_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("MailNextFlagged", next_flagged_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("MailNextUnread", next_unread_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("MailNextThread", next_thread),
|
||||
BONOBO_UI_UNSAFE_VERB ("MailPrevious", previous_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("MailPreviousFlagged", previous_flagged_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("MailPreviousUnread", previous_unread_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("AddSenderToAddressbook", add_sender_to_addrbook),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageApplyFilters", apply_filters),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageCopy", copy_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageDelete", delete_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageForward", forward),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageForwardAttached", forward_attached),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageForwardInline", forward_inline),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageForwardQuoted", forward_quoted),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageRedirect", redirect),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsRead", mark_as_seen),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnRead", mark_as_unseen),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsImportant", mark_as_important),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnimportant", mark_as_unimportant),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageFollowUpFlag", flag_for_followup),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageMove", move_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageOpen", open_message),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessagePostReply", post_reply),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageReplyAll", reply_to_all),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageReplyList", reply_to_list),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageReplySender", reply_to_sender),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageResend", resend_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageSaveAs", save_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageSearch", search_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageUndelete", undelete_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("PrintMessage", print_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("TextZoomIn", zoom_in),
|
||||
BONOBO_UI_UNSAFE_VERB ("TextZoomOut", zoom_out),
|
||||
BONOBO_UI_UNSAFE_VERB ("TextZoomReset", zoom_reset),
|
||||
BONOBO_UI_UNSAFE_VERB ("PrintPreviewMessage", print_preview_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("ToolsFilterMailingList", filter_mlist),
|
||||
BONOBO_UI_UNSAFE_VERB ("ToolsFilterRecipient", filter_recipient),
|
||||
BONOBO_UI_UNSAFE_VERB ("ToolsFilterSender", filter_sender),
|
||||
BONOBO_UI_UNSAFE_VERB ("ToolsFilterSubject", filter_subject),
|
||||
BONOBO_UI_UNSAFE_VERB ("ToolsVFolderMailingList", vfolder_mlist),
|
||||
BONOBO_UI_UNSAFE_VERB ("ToolsVFolderRecipient", vfolder_recipient),
|
||||
BONOBO_UI_UNSAFE_VERB ("ToolsVFolderSender", vfolder_sender),
|
||||
BONOBO_UI_UNSAFE_VERB ("ToolsVFolderSubject", vfolder_subject),
|
||||
BONOBO_UI_UNSAFE_VERB ("ViewLoadImages", load_images),
|
||||
/* ViewHeaders stuff is a radio */
|
||||
/* CaretMode is a toggle */
|
||||
|
||||
BONOBO_UI_VERB_END
|
||||
};
|
||||
|
||||
static BonoboUIVerb list_verbs [] = {
|
||||
BONOBO_UI_UNSAFE_VERB ("EditCut", folder_browser_cut),
|
||||
BONOBO_UI_UNSAFE_VERB ("EditCopy", folder_browser_copy),
|
||||
BONOBO_UI_UNSAFE_VERB ("EditPaste", folder_browser_paste),
|
||||
BONOBO_UI_UNSAFE_VERB ("EditInvertSelection", invert_selection),
|
||||
BONOBO_UI_UNSAFE_VERB ("EditSelectAll", select_all),
|
||||
BONOBO_UI_UNSAFE_VERB ("EditSelectThread", select_thread),
|
||||
BONOBO_UI_UNSAFE_VERB ("ChangeFolderProperties", configure_folder),
|
||||
BONOBO_UI_UNSAFE_VERB ("FolderExpunge", expunge_folder),
|
||||
/* HideDeleted is a toggle */
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageMarkAllAsRead", mark_all_as_seen),
|
||||
BONOBO_UI_UNSAFE_VERB ("ViewHideRead", hide_read),
|
||||
BONOBO_UI_UNSAFE_VERB ("ViewHideSelected", hide_selected),
|
||||
BONOBO_UI_UNSAFE_VERB ("ViewShowAll", hide_none),
|
||||
/* ViewThreaded is a toggle */
|
||||
|
||||
BONOBO_UI_VERB_END
|
||||
};
|
||||
|
||||
static BonoboUIVerb global_verbs [] = {
|
||||
BONOBO_UI_UNSAFE_VERB ("EmptyTrash", empty_trash),
|
||||
BONOBO_UI_UNSAFE_VERB ("ForgetPasswords", mail_session_forget_passwords),
|
||||
BONOBO_UI_UNSAFE_VERB ("MailCompose", compose_msg),
|
||||
BONOBO_UI_UNSAFE_VERB ("MailPost", post_message),
|
||||
BONOBO_UI_UNSAFE_VERB ("MailStop", stop_threads),
|
||||
BONOBO_UI_UNSAFE_VERB ("ToolsFilters", filter_edit),
|
||||
BONOBO_UI_UNSAFE_VERB ("ToolsSubscriptions", manage_subscriptions),
|
||||
BONOBO_UI_UNSAFE_VERB ("ToolsVFolders", vfolder_edit_vfolders),
|
||||
/* ViewPreview is a toggle */
|
||||
|
||||
BONOBO_UI_VERB_END
|
||||
};
|
||||
|
||||
static EPixmap message_pixcache [] = {
|
||||
E_PIXMAP ("/commands/PrintMessage", "print.xpm"),
|
||||
E_PIXMAP ("/commands/PrintPreviewMessage", "print-preview.xpm"),
|
||||
E_PIXMAP ("/commands/MessageDelete", "evolution-trash-mini.png"),
|
||||
E_PIXMAP ("/commands/MessageUndelete", "undelete_message-16.png"),
|
||||
E_PIXMAP ("/commands/MessageCopy", "copy_16_message.xpm"),
|
||||
E_PIXMAP ("/commands/MessageMove", "move_message.xpm"),
|
||||
E_PIXMAP ("/commands/MessageReplyAll", "reply_to_all.xpm"),
|
||||
E_PIXMAP ("/commands/MessageReplySender", "reply.xpm"),
|
||||
E_PIXMAP ("/commands/MessageForward", "forward.xpm"),
|
||||
E_PIXMAP ("/commands/MessageApplyFilters", "apply-filters-16.xpm"),
|
||||
E_PIXMAP ("/commands/MessageSearch", "search-16.png"),
|
||||
E_PIXMAP ("/commands/MessageSaveAs", "save-as-16.png"),
|
||||
E_PIXMAP ("/commands/MessageMarkAsRead", "mail-read.xpm"),
|
||||
E_PIXMAP ("/commands/MessageMarkAsUnRead", "mail-new.xpm"),
|
||||
E_PIXMAP ("/commands/MessageMarkAsImportant", "priority-high.xpm"),
|
||||
E_PIXMAP ("/commands/MessageFollowUpFlag", "flag-for-followup-16.png"),
|
||||
|
||||
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageReplySender", "buttons/reply.png"),
|
||||
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageReplyAll", "buttons/reply-to-all.png"),
|
||||
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageForward", "buttons/forward.png"),
|
||||
E_PIXMAP ("/Toolbar/MailMessageToolbar/PrintMessage", "buttons/print.png"),
|
||||
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageMove", "buttons/move-message.png"),
|
||||
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageCopy", "buttons/copy-message.png"),
|
||||
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageDelete", "buttons/delete-message.png"),
|
||||
|
||||
E_PIXMAP ("/Toolbar/MailNextButtons/MailNext", "buttons/next-message.png"),
|
||||
E_PIXMAP ("/Toolbar/MailNextButtons/MailPrevious", "buttons/previous-message.png"),
|
||||
|
||||
E_PIXMAP_END
|
||||
};
|
||||
|
||||
static EPixmap list_pixcache [] = {
|
||||
E_PIXMAP ("/commands/ChangeFolderProperties", "configure_16_folder.xpm"),
|
||||
E_PIXMAP ("/commands/ViewHideRead", "hide_read_messages.xpm"),
|
||||
E_PIXMAP ("/commands/ViewHideSelected", "hide_selected_messages.xpm"),
|
||||
E_PIXMAP ("/commands/ViewShowAll", "show_all_messages.xpm"),
|
||||
|
||||
E_PIXMAP ("/commands/EditCut", "16_cut.png"),
|
||||
E_PIXMAP ("/commands/EditCopy", "16_copy.png"),
|
||||
E_PIXMAP ("/commands/EditPaste", "16_paste.png"),
|
||||
|
||||
E_PIXMAP_END
|
||||
};
|
||||
|
||||
static EPixmap global_pixcache [] = {
|
||||
E_PIXMAP ("/commands/MailCompose", "new-message.xpm"),
|
||||
|
||||
E_PIXMAP_END
|
||||
};
|
||||
|
||||
enum {
|
||||
IS_DRAFTS_FOLDER = (1 << 0),
|
||||
IS_OUTBOX_FOLDER = (1 << 1),
|
||||
IS_SENT_FOLDER = (1 << 2),
|
||||
|
||||
IS_OUTGOING_FOLDER = (IS_DRAFTS_FOLDER | IS_OUTBOX_FOLDER | IS_SENT_FOLDER),
|
||||
IS_INCOMING_FOLDER = (1 << 3),
|
||||
|
||||
IS_ANY_FOLDER = (IS_OUTGOING_FOLDER | IS_INCOMING_FOLDER),
|
||||
|
||||
SELECTION_NONE = (1 << 4),
|
||||
SELECTION_SINGLE = (1 << 5),
|
||||
SELECTION_MULTIPLE = (1 << 6),
|
||||
|
||||
SELECTION_ANYTHING = (SELECTION_SINGLE | SELECTION_MULTIPLE),
|
||||
|
||||
IS_THREADED = (1 << 7),
|
||||
NOT_THREADED = (1<<8),
|
||||
ANY_THREADED = (IS_THREADED|NOT_THREADED),
|
||||
|
||||
HAS_UNDELETED = (1 << 9),
|
||||
HAS_DELETED = (1 << 10),
|
||||
HAS_UNREAD = (1 << 11),
|
||||
HAS_READ = (1 << 12),
|
||||
HAS_UNIMPORTANT = (1 << 13),
|
||||
HAS_IMPORTANT = (1 << 14)
|
||||
};
|
||||
|
||||
#define HAS_FLAGS (HAS_UNDELETED | HAS_DELETED | \
|
||||
HAS_UNREAD | HAS_READ | \
|
||||
HAS_UNIMPORTANT | HAS_IMPORTANT)
|
||||
|
||||
#define IS_1MESSAGE (IS_ANY_FOLDER | SELECTION_SINGLE | ANY_THREADED | HAS_FLAGS)
|
||||
#define IS_0MESSAGE (IS_ANY_FOLDER | SELECTION_ANYTHING | SELECTION_NONE | ANY_THREADED | HAS_FLAGS)
|
||||
#define IS_NMESSAGE (IS_ANY_FOLDER | SELECTION_ANYTHING | ANY_THREADED | HAS_FLAGS)
|
||||
|
||||
struct _UINode {
|
||||
const char *name;
|
||||
guint32 enable_mask;
|
||||
};
|
||||
|
||||
struct _UINode default_ui_nodes[] = {
|
||||
{ "ViewLoadImages", IS_1MESSAGE },
|
||||
{ "ViewFullHeaders", IS_0MESSAGE },
|
||||
{ "ViewNormal", IS_0MESSAGE },
|
||||
{ "ViewSource", IS_0MESSAGE },
|
||||
{ "CaretMode", IS_0MESSAGE },
|
||||
|
||||
{ "AddSenderToAddressbook", IS_INCOMING_FOLDER | SELECTION_SINGLE | ANY_THREADED | HAS_FLAGS },
|
||||
|
||||
{ "MessageResend", IS_SENT_FOLDER | SELECTION_SINGLE | ANY_THREADED | HAS_FLAGS },
|
||||
|
||||
/* actions that work on exactly 1 message */
|
||||
{ "MessagePostReply", IS_1MESSAGE },
|
||||
{ "MessageReplyAll", IS_1MESSAGE },
|
||||
{ "MessageReplyList", IS_1MESSAGE },
|
||||
{ "MessageReplySender", IS_1MESSAGE },
|
||||
{ "MessageForwardInline", IS_1MESSAGE },
|
||||
{ "MessageForwardQuoted", IS_1MESSAGE },
|
||||
{ "MessageRedirect", IS_1MESSAGE },
|
||||
{ "MessageSearch", IS_1MESSAGE },
|
||||
|
||||
{ "PrintMessage", IS_1MESSAGE },
|
||||
{ "PrintPreviewMessage", IS_1MESSAGE },
|
||||
|
||||
{ "ToolsFilterMailingList", IS_1MESSAGE },
|
||||
{ "ToolsFilterRecipient", IS_1MESSAGE },
|
||||
{ "ToolsFilterSender", IS_1MESSAGE },
|
||||
{ "ToolsFilterSubject", IS_1MESSAGE },
|
||||
|
||||
{ "ToolsVFolderMailingList", IS_1MESSAGE },
|
||||
{ "ToolsVFolderRecipient", IS_1MESSAGE },
|
||||
{ "ToolsVFolderSender", IS_1MESSAGE },
|
||||
{ "ToolsVFolderSubject", IS_1MESSAGE },
|
||||
|
||||
/* actions that work on >= 1 message */
|
||||
{ "MessageApplyFilters", IS_NMESSAGE },
|
||||
{ "MessageCopy", IS_NMESSAGE },
|
||||
{ "MessageMove", IS_NMESSAGE },
|
||||
{ "MessageDelete", IS_NMESSAGE },
|
||||
{ "MessageUndelete", IS_NMESSAGE & ~HAS_DELETED },
|
||||
{ "MessageMarkAsRead", IS_NMESSAGE & ~HAS_UNREAD },
|
||||
{ "MessageMarkAsUnRead", IS_NMESSAGE & ~HAS_READ },
|
||||
{ "MessageMarkAsImportant", IS_NMESSAGE & ~HAS_UNIMPORTANT },
|
||||
{ "MessageMarkAsUnimportant", IS_NMESSAGE & ~HAS_IMPORTANT },
|
||||
{ "MessageFollowUpFlag", IS_NMESSAGE },
|
||||
{ "MessageOpen", IS_NMESSAGE },
|
||||
{ "MessageSaveAs", IS_NMESSAGE },
|
||||
{ "MessageForward", IS_NMESSAGE },
|
||||
{ "MessageForwardAttached", IS_NMESSAGE },
|
||||
|
||||
{ "EditCut", IS_NMESSAGE },
|
||||
{ "EditCopy", IS_NMESSAGE },
|
||||
{ "EditPaste", IS_0MESSAGE },
|
||||
{ "EditSelectThread", IS_ANY_FOLDER | SELECTION_ANYTHING | IS_THREADED | HAS_FLAGS},
|
||||
|
||||
{ "ViewHideSelected", IS_NMESSAGE },
|
||||
|
||||
/* FIXME: should these be single-selection? */
|
||||
{ "MailNext", IS_NMESSAGE },
|
||||
{ "MailNextFlagged", IS_NMESSAGE },
|
||||
{ "MailNextUnread", IS_NMESSAGE },
|
||||
{ "MailNextThread", IS_NMESSAGE },
|
||||
{ "MailPrevious", IS_NMESSAGE },
|
||||
{ "MailPreviousFlagged", IS_NMESSAGE },
|
||||
{ "MailPreviousUnread", IS_NMESSAGE },
|
||||
};
|
||||
|
||||
static int num_default_ui_nodes = sizeof (default_ui_nodes) / sizeof (default_ui_nodes[0]);
|
||||
|
||||
|
||||
static void
|
||||
ui_add (FolderBrowser *fb, const char *name, BonoboUIVerb verb[], EPixmap pixcache[])
|
||||
{
|
||||
BonoboUIComponent *uic = fb->uicomp;
|
||||
char *file;
|
||||
|
||||
bonobo_ui_component_add_verb_list_with_data (uic, verb, fb);
|
||||
|
||||
/*bonobo_ui_component_freeze (uic, NULL);*/
|
||||
|
||||
file = g_strconcat (EVOLUTION_UIDIR "/evolution-mail-", name, ".xml", NULL);
|
||||
bonobo_ui_util_set_ui (uic, PREFIX, file, "evolution-mail", NULL);
|
||||
g_free (file);
|
||||
|
||||
e_pixmaps_update (uic, pixcache);
|
||||
|
||||
/*bonobo_ui_component_thaw (uic, NULL);*/
|
||||
}
|
||||
|
||||
/* more complex stuff */
|
||||
|
||||
static void
|
||||
display_view (GalViewInstance *instance, GalView *view, gpointer data)
|
||||
{
|
||||
FolderBrowser *fb = data;
|
||||
|
||||
if (GAL_IS_VIEW_ETABLE (view)) {
|
||||
gal_view_etable_attach_tree (GAL_VIEW_ETABLE (view), fb->message_list->tree);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
folder_browser_ui_setup_view_menus (FolderBrowser *fb)
|
||||
{
|
||||
static GalViewCollection *collection = NULL;
|
||||
char *id;
|
||||
gboolean outgoing;
|
||||
|
||||
if (fb->uicomp == NULL || fb->folder == NULL)
|
||||
return;
|
||||
|
||||
g_assert (fb->view_instance == NULL);
|
||||
g_assert (fb->view_menus == NULL);
|
||||
|
||||
outgoing = folder_browser_is_drafts (fb) ||
|
||||
folder_browser_is_sent (fb) ||
|
||||
folder_browser_is_outbox (fb);
|
||||
|
||||
if (collection == NULL) {
|
||||
ETableSpecification *spec;
|
||||
char *local_dir;
|
||||
GalViewFactory *factory;
|
||||
|
||||
collection = gal_view_collection_new ();
|
||||
|
||||
gal_view_collection_set_title (collection, _("Mail"));
|
||||
|
||||
local_dir = gnome_util_prepend_user_home ("/evolution/views/mail/");
|
||||
gal_view_collection_set_storage_directories (collection,
|
||||
EVOLUTION_GALVIEWSDIR "/mail/",
|
||||
local_dir);
|
||||
g_free (local_dir);
|
||||
|
||||
spec = e_table_specification_new ();
|
||||
e_table_specification_load_from_file (spec, EVOLUTION_ETSPECDIR "/message-list.etspec");
|
||||
|
||||
factory = gal_view_factory_etable_new (spec);
|
||||
g_object_unref (spec);
|
||||
gal_view_collection_add_factory (collection, factory);
|
||||
g_object_unref (factory);
|
||||
|
||||
gal_view_collection_load (collection);
|
||||
}
|
||||
|
||||
id = mail_config_folder_to_safe_url (fb->folder);
|
||||
fb->view_instance = gal_view_instance_new (collection, id);
|
||||
g_free (id);
|
||||
|
||||
if (outgoing)
|
||||
gal_view_instance_set_default_view (fb->view_instance, "As_Sent_Folder");
|
||||
|
||||
if (!gal_view_instance_exists (fb->view_instance)) {
|
||||
char *path;
|
||||
struct stat st;
|
||||
|
||||
gal_view_instance_load (fb->view_instance);
|
||||
|
||||
path = mail_config_folder_to_cachename (fb->folder, "et-header-");
|
||||
if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) {
|
||||
ETableSpecification *spec;
|
||||
ETableState *state;
|
||||
GalView *view;
|
||||
|
||||
spec = e_table_specification_new();
|
||||
e_table_specification_load_from_file (spec, EVOLUTION_ETSPECDIR "/message-list.etspec");
|
||||
view = gal_view_etable_new (spec, "");
|
||||
g_object_unref (spec);
|
||||
|
||||
state = e_table_state_new ();
|
||||
e_table_state_load_from_file (state, path);
|
||||
gal_view_etable_set_state (GAL_VIEW_ETABLE (view), state);
|
||||
g_object_unref (state);
|
||||
|
||||
gal_view_instance_set_custom_view (fb->view_instance, view);
|
||||
g_object_unref (view);
|
||||
}
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
fb->view_menus = gal_view_menus_new (fb->view_instance);
|
||||
gal_view_menus_apply (fb->view_menus, fb->uicomp, NULL);
|
||||
|
||||
/* Due to CORBA reentrancy, the view could be gone now. */
|
||||
if (fb->view_instance == NULL)
|
||||
return;
|
||||
|
||||
g_signal_connect (fb->view_instance, "display_view", G_CALLBACK (display_view), fb);
|
||||
|
||||
display_view (fb->view_instance, gal_view_instance_get_current_view (fb->view_instance), fb);
|
||||
}
|
||||
|
||||
/* Gets rid of the view instance and view menus objects */
|
||||
void
|
||||
folder_browser_ui_discard_view_menus (FolderBrowser *fb)
|
||||
{
|
||||
g_assert (fb->view_instance != NULL);
|
||||
g_assert (fb->view_menus != NULL);
|
||||
|
||||
g_object_unref (fb->view_instance);
|
||||
fb->view_instance = NULL;
|
||||
|
||||
g_object_unref (fb->view_menus);
|
||||
fb->view_menus = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
folder_browser_ui_message_list_focus (FolderBrowser *fb)
|
||||
{
|
||||
g_assert (fb->uicomp != NULL);
|
||||
|
||||
bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditInvertSelection",
|
||||
"sensitive", "1", NULL);
|
||||
/* bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditSelectThread",
|
||||
"sensitive", "1", NULL);*/
|
||||
}
|
||||
|
||||
void
|
||||
folder_browser_ui_message_list_unfocus (FolderBrowser *fb)
|
||||
{
|
||||
g_assert (fb->uicomp != NULL);
|
||||
|
||||
bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditInvertSelection",
|
||||
"sensitive", "0", NULL);
|
||||
/*bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditSelectThread",
|
||||
"sensitive", "0", NULL);*/
|
||||
}
|
||||
|
||||
static void
|
||||
folder_browser_setup_property_menu (FolderBrowser *fb, BonoboUIComponent *uic)
|
||||
{
|
||||
char *name, *base = NULL;
|
||||
CamelURL *url;
|
||||
|
||||
url = camel_url_new (fb->uri, NULL);
|
||||
if (url)
|
||||
base = g_path_get_basename(url->fragment?url->fragment:url->path);
|
||||
|
||||
if (base && base[0] != '\0')
|
||||
name = g_strdup_printf (_("Properties for \"%s\""), base);
|
||||
else
|
||||
name = g_strdup (_("Properties"));
|
||||
|
||||
bonobo_ui_component_set_prop (
|
||||
uic, "/menu/File/Folder/ComponentPlaceholder/ChangeFolderProperties",
|
||||
"label", name, NULL);
|
||||
g_free (name);
|
||||
g_free(base);
|
||||
|
||||
if (url)
|
||||
camel_url_free (url);
|
||||
|
||||
fbui_sensitise_item (fb, "ChangeFolderProperties",
|
||||
(strncmp (fb->uri, "vfolder:", 8) == 0 || strncmp (fb->uri, "file:", 5) == 0));
|
||||
}
|
||||
|
||||
/* Must be in the same order as MailConfigDisplayStyle */
|
||||
/* used in folder-browser.c as well (therefore not static) */
|
||||
char *message_display_styles[] = {
|
||||
"/commands/ViewNormal",
|
||||
"/commands/ViewFullHeaders",
|
||||
"/commands/ViewSource"
|
||||
};
|
||||
|
||||
/* public */
|
||||
|
||||
void
|
||||
folder_browser_ui_add_message (FolderBrowser *fb)
|
||||
{
|
||||
BonoboUIComponent *uic = fb->uicomp;
|
||||
FolderBrowserSelectionState prev_state;
|
||||
GConfClient *gconf;
|
||||
int style;
|
||||
gboolean caret_mode;
|
||||
|
||||
gconf = mail_config_get_gconf_client ();
|
||||
|
||||
if (fb->sensitise_state) {
|
||||
g_hash_table_destroy(fb->sensitise_state);
|
||||
fb->sensitise_state = NULL;
|
||||
}
|
||||
|
||||
ui_add (fb, "message", message_verbs, message_pixcache);
|
||||
|
||||
caret_mode = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/caret_mode", NULL);
|
||||
bonobo_ui_component_set_prop(uic, "/commands/CaretMode", "state", caret_mode?"1":"0", NULL);
|
||||
bonobo_ui_component_add_listener (uic, "CaretMode", folder_browser_toggle_caret_mode, fb);
|
||||
|
||||
/* Display Style */
|
||||
style = gconf_client_get_int (gconf, "/apps/evolution/mail/display/message_style", NULL);
|
||||
style = style >= 0 && style < MAIL_CONFIG_DISPLAY_MAX ? style : 0;
|
||||
bonobo_ui_component_set_prop (uic, message_display_styles[style], "state", "1", NULL);
|
||||
bonobo_ui_component_add_listener (uic, "ViewNormal", folder_browser_set_message_display_style, fb);
|
||||
bonobo_ui_component_add_listener (uic, "ViewFullHeaders", folder_browser_set_message_display_style, fb);
|
||||
bonobo_ui_component_add_listener (uic, "ViewSource", folder_browser_set_message_display_style, fb);
|
||||
if (fb->mail_display->display_style != style) {
|
||||
fb->mail_display->display_style = style;
|
||||
mail_display_redisplay (fb->mail_display, TRUE);
|
||||
}
|
||||
|
||||
/* Resend Message */
|
||||
if (fb->folder && !folder_browser_is_sent (fb))
|
||||
fbui_sensitise_item (fb, "MessageResend", FALSE);
|
||||
|
||||
/* sensitivity of message-specific commands */
|
||||
prev_state = fb->selection_state;
|
||||
fb->selection_state = FB_SELSTATE_UNDEFINED;
|
||||
folder_browser_ui_set_selection_state (fb, prev_state);
|
||||
|
||||
/* Charset picker */
|
||||
e_charset_picker_bonobo_ui_populate (uic, "/menu/View", FB_DEFAULT_CHARSET,
|
||||
folder_browser_charset_changed, fb);
|
||||
}
|
||||
|
||||
void
|
||||
folder_browser_ui_add_list (FolderBrowser *fb)
|
||||
{
|
||||
BonoboUIComponent *uic = fb->uicomp;
|
||||
GConfClient *gconf;
|
||||
int state;
|
||||
|
||||
gconf = mail_config_get_gconf_client ();
|
||||
|
||||
if (fb->sensitise_state) {
|
||||
g_hash_table_destroy (fb->sensitise_state);
|
||||
fb->sensitise_state = NULL;
|
||||
}
|
||||
|
||||
ui_add (fb, "list", list_verbs, list_pixcache);
|
||||
|
||||
/* Hide Deleted */
|
||||
state = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL);
|
||||
bonobo_ui_component_set_prop (uic, "/commands/HideDeleted", "state", state ? "1" : "0", NULL);
|
||||
bonobo_ui_component_add_listener (uic, "HideDeleted", folder_browser_toggle_hide_deleted, fb);
|
||||
if (!(fb->folder && (fb->folder->folder_flags & CAMEL_FOLDER_IS_TRASH)))
|
||||
message_list_set_hidedeleted (fb->message_list, state);
|
||||
else
|
||||
fbui_sensitise_item (fb, "HideDeleted", FALSE);
|
||||
|
||||
/* Threaded toggle */
|
||||
state = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/thread_list", NULL);
|
||||
if (fb->meta)
|
||||
state = e_meta_get_bool(fb->meta, "thread_list", state);
|
||||
|
||||
bonobo_ui_component_set_prop (uic, "/commands/ViewThreaded", "state", state ? "1" : "0", NULL);
|
||||
bonobo_ui_component_add_listener (uic, "ViewThreaded", folder_browser_toggle_threads, fb);
|
||||
message_list_set_threaded (fb->message_list, state);
|
||||
state = fb->selection_state;
|
||||
fb->selection_state = FB_SELSTATE_UNDEFINED;
|
||||
folder_browser_ui_set_selection_state (fb, state);
|
||||
|
||||
/* Property menu */
|
||||
folder_browser_setup_property_menu (fb, fb->uicomp);
|
||||
|
||||
/* View menu */
|
||||
if (fb->view_instance == NULL)
|
||||
folder_browser_ui_setup_view_menus (fb);
|
||||
}
|
||||
|
||||
void
|
||||
folder_browser_ui_rm_list (FolderBrowser *fb)
|
||||
{
|
||||
/* View menu */
|
||||
if (fb->view_instance != NULL)
|
||||
folder_browser_ui_discard_view_menus (fb);
|
||||
}
|
||||
|
||||
void
|
||||
folder_browser_ui_add_global (FolderBrowser *fb)
|
||||
{
|
||||
BonoboUIComponent *uic = fb->uicomp;
|
||||
gboolean show_preview;
|
||||
GConfClient *gconf;
|
||||
int paned_size;
|
||||
|
||||
gconf = mail_config_get_gconf_client ();
|
||||
|
||||
if (fb->sensitise_state) {
|
||||
g_hash_table_destroy (fb->sensitise_state);
|
||||
fb->sensitise_state = NULL;
|
||||
}
|
||||
|
||||
ui_add (fb, "global", global_verbs, global_pixcache);
|
||||
|
||||
/* (Pre)view pane size (do this first because it affects the
|
||||
preview settings - see folder_browser_set_message_preview()
|
||||
internals for details) */
|
||||
paned_size = gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL);
|
||||
g_signal_handler_block (fb->vpaned, fb->paned_resize_id);
|
||||
gtk_paned_set_position (GTK_PANED (fb->vpaned), paned_size);
|
||||
g_signal_handler_unblock (fb->vpaned, fb->paned_resize_id);
|
||||
|
||||
/* (Pre)view toggle */
|
||||
show_preview = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_preview", NULL);
|
||||
if (fb->meta)
|
||||
show_preview = e_meta_get_bool(fb->meta, "show_preview", show_preview);
|
||||
bonobo_ui_component_set_prop (uic, "/commands/ViewPreview", "state", show_preview ? "1" : "0", NULL);
|
||||
folder_browser_set_message_preview (fb, show_preview);
|
||||
|
||||
/* listen for user-changes */
|
||||
bonobo_ui_component_add_listener (uic, "ViewPreview", folder_browser_toggle_preview, fb);
|
||||
|
||||
/* Stop button */
|
||||
/* TODO: Go through cache, but we can't becaus eof mail-mt.c:set_stop at the moment */
|
||||
bonobo_ui_component_set_prop (uic, "/commands/MailStop", "sensitive", "0", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
folder_browser_ui_rm_all (FolderBrowser *fb)
|
||||
{
|
||||
BonoboUIComponent *uic = fb->uicomp;
|
||||
|
||||
if (bonobo_ui_component_get_container (uic) != NULL) {
|
||||
bonobo_ui_component_rm (uic, "/", NULL);
|
||||
bonobo_ui_component_unset_container (uic, NULL);
|
||||
}
|
||||
|
||||
if (fb->sensitise_state) {
|
||||
g_hash_table_destroy (fb->sensitise_state);
|
||||
fb->sensitise_state = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fbui_sensitise_item (FolderBrowser *fb, const char *item, int state)
|
||||
{
|
||||
char *name, *key;
|
||||
gpointer val_ptr;
|
||||
int val;
|
||||
|
||||
/* If this whole caching idea doesn't work, remove it here */
|
||||
if (fb->sensitise_state == NULL)
|
||||
fb->sensitise_state = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
if (g_hash_table_lookup_extended (fb->sensitise_state, item, (void **)&key, &val_ptr)) {
|
||||
val = GPOINTER_TO_INT(val_ptr);
|
||||
if (val == state)
|
||||
return;
|
||||
}
|
||||
|
||||
if (fb->uicomp) {
|
||||
name = g_alloca (strlen (item) + strlen ("/commands/") + 1);
|
||||
sprintf (name, "/commands/%s", item);
|
||||
bonobo_ui_component_set_prop (fb->uicomp, name, "sensitive", state ? "1" : "0", NULL);
|
||||
g_hash_table_insert (fb->sensitise_state, (char *) item, GINT_TO_POINTER(state));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fbui_sensitize_items (FolderBrowser *fb, guint32 enable_mask)
|
||||
{
|
||||
gboolean enable;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_default_ui_nodes; i++) {
|
||||
enable = (default_ui_nodes[i].enable_mask & enable_mask) == enable_mask;
|
||||
fbui_sensitise_item (fb, default_ui_nodes[i].name, enable);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
folder_browser_ui_scan_selection (FolderBrowser *fb)
|
||||
{
|
||||
gboolean outgoing = FALSE;
|
||||
guint32 enable_mask = 0;
|
||||
|
||||
if (fb->selection_state == FB_SELSTATE_SINGLE ||
|
||||
fb->selection_state == FB_SELSTATE_MULTIPLE) {
|
||||
GPtrArray *uids;
|
||||
CamelMessageInfo *info;
|
||||
guint32 temp_mask = 0;
|
||||
int i;
|
||||
|
||||
uids = g_ptr_array_new ();
|
||||
message_list_foreach (fb->message_list, enumerate_msg, uids);
|
||||
|
||||
for (i = 0; i < uids->len; i++) {
|
||||
info = camel_folder_get_message_info (fb->folder, uids->pdata[i]);
|
||||
if (info == NULL)
|
||||
continue;
|
||||
|
||||
if (info->flags & CAMEL_MESSAGE_DELETED)
|
||||
temp_mask |= HAS_DELETED;
|
||||
else
|
||||
temp_mask |= HAS_UNDELETED;
|
||||
|
||||
if (info->flags & CAMEL_MESSAGE_SEEN)
|
||||
temp_mask |= HAS_READ;
|
||||
else
|
||||
temp_mask |= HAS_UNREAD;
|
||||
|
||||
if (info->flags & CAMEL_MESSAGE_FLAGGED)
|
||||
temp_mask |= HAS_IMPORTANT;
|
||||
else
|
||||
temp_mask |= HAS_UNIMPORTANT;
|
||||
|
||||
camel_folder_free_message_info (fb->folder, info);
|
||||
g_free (uids->pdata[i]);
|
||||
}
|
||||
|
||||
g_ptr_array_free (uids, TRUE);
|
||||
|
||||
/* yeah, the naming is a bit backwards, but we need to support
|
||||
* the case when, say, both a deleted and an undeleted message
|
||||
* are selected. Both the Delete and Undelete menu items should
|
||||
* be sensitized, but the only good way to set the flags is as
|
||||
* above. Anyway, the naming is a bit of a lie but it works out
|
||||
* so that it's sensible both above and in the definition of
|
||||
* the UI items, so deal with it.
|
||||
*/
|
||||
|
||||
enable_mask |= (~temp_mask & HAS_FLAGS);
|
||||
}
|
||||
|
||||
if (folder_browser_is_drafts (fb)) {
|
||||
enable_mask |= IS_DRAFTS_FOLDER;
|
||||
outgoing = TRUE;
|
||||
}
|
||||
|
||||
if (folder_browser_is_outbox (fb)) {
|
||||
enable_mask |= IS_OUTBOX_FOLDER;
|
||||
outgoing = TRUE;
|
||||
}
|
||||
|
||||
if (folder_browser_is_sent (fb)) {
|
||||
enable_mask |= IS_SENT_FOLDER;
|
||||
outgoing = TRUE;
|
||||
}
|
||||
|
||||
if (fb->message_list && fb->message_list->threaded)
|
||||
enable_mask |= IS_THREADED;
|
||||
else
|
||||
enable_mask |= NOT_THREADED;
|
||||
|
||||
if (outgoing == FALSE)
|
||||
enable_mask |= IS_INCOMING_FOLDER;
|
||||
|
||||
switch (fb->selection_state) {
|
||||
case FB_SELSTATE_SINGLE:
|
||||
enable_mask |= SELECTION_SINGLE;
|
||||
break;
|
||||
case FB_SELSTATE_MULTIPLE:
|
||||
enable_mask |= SELECTION_MULTIPLE;
|
||||
break;
|
||||
case FB_SELSTATE_NONE:
|
||||
default:
|
||||
enable_mask |= SELECTION_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
fbui_sensitize_items (fb, enable_mask);
|
||||
}
|
||||
|
||||
void
|
||||
folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelectionState state)
|
||||
{
|
||||
/* the state may be the same but with
|
||||
* different messages selected, necessitating
|
||||
* a recheck of the flags of the selected
|
||||
* messages.
|
||||
*/
|
||||
|
||||
if (state == fb->selection_state &&
|
||||
state != FB_SELSTATE_SINGLE &&
|
||||
state != FB_SELSTATE_MULTIPLE)
|
||||
return;
|
||||
|
||||
fb->selection_state = state;
|
||||
folder_browser_ui_scan_selection (fb);
|
||||
}
|
||||
|
||||
void
|
||||
folder_browser_ui_message_loaded (FolderBrowser *fb)
|
||||
{
|
||||
BonoboUIComponent *uic = fb->uicomp;
|
||||
|
||||
if (uic) {
|
||||
fb->selection_state = FB_SELSTATE_NONE;
|
||||
folder_browser_ui_set_selection_state (fb, FB_SELSTATE_SINGLE);
|
||||
}
|
||||
}
|
36
mail/folder-browser-ui.h
Normal file
36
mail/folder-browser-ui.h
Normal file
@ -0,0 +1,36 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* folder-browser-ui.c: Sets up the Bonobo UI for FolderBrowsers
|
||||
*
|
||||
* Author:
|
||||
* Peter Williams <peterw@ximian.com>
|
||||
*
|
||||
* (C) 2001 Ximian, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _FOLDER_BROWSER_UI_H
|
||||
#define _FOLDER_BROWSER_UI_H
|
||||
|
||||
#include "folder-browser.h"
|
||||
|
||||
void folder_browser_ui_add_message (FolderBrowser *fb);
|
||||
void folder_browser_ui_add_list (FolderBrowser *fb);
|
||||
void folder_browser_ui_add_global (FolderBrowser *fb);
|
||||
|
||||
void folder_browser_ui_rm_list (FolderBrowser *fb);
|
||||
void folder_browser_ui_rm_all (FolderBrowser *fb);
|
||||
|
||||
/* these affect the sensitivity of UI elements */
|
||||
void folder_browser_ui_scan_selection (FolderBrowser *fb);
|
||||
void folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelectionState state);
|
||||
void folder_browser_ui_message_loaded (FolderBrowser *fb);
|
||||
|
||||
void folder_browser_ui_discard_view_menus (FolderBrowser *fb);
|
||||
void folder_browser_ui_setup_view_menus (FolderBrowser *fb);
|
||||
/* Set the sensitivity of a single item */
|
||||
void fbui_sensitise_item(FolderBrowser *fb, const char *item, int state);
|
||||
|
||||
void folder_browser_ui_message_list_focus (FolderBrowser *fb);
|
||||
void folder_browser_ui_message_list_unfocus (FolderBrowser *fb);
|
||||
|
||||
#endif /* _FOLDER_BROWSER_UI_H */
|
2679
mail/folder-browser.c
Normal file
2679
mail/folder-browser.c
Normal file
File diff suppressed because it is too large
Load Diff
192
mail/folder-browser.h
Normal file
192
mail/folder-browser.h
Normal file
@ -0,0 +1,192 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
|
||||
|
||||
#ifndef _FOLDER_BROWSER_H_
|
||||
#define _FOLDER_BROWSER_H_
|
||||
|
||||
#include <gtk/gtktable.h>
|
||||
#include "camel/camel-stream.h"
|
||||
#include <bonobo/bonobo-property-bag.h>
|
||||
#include <bonobo/bonobo-ui-component.h>
|
||||
#include <widgets/misc/e-filter-bar.h>
|
||||
#include "widgets/menus/gal-view-menus.h"
|
||||
#include "filter/filter-rule.h"
|
||||
#include "filter/filter-context.h" /*eek*/
|
||||
#include "message-list.h"
|
||||
#include "mail-display.h"
|
||||
#include "mail-types.h"
|
||||
#include "shell/Evolution.h"
|
||||
|
||||
#define FOLDER_BROWSER_TYPE (folder_browser_get_type ())
|
||||
#define FOLDER_BROWSER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), FOLDER_BROWSER_TYPE, FolderBrowser))
|
||||
#define FOLDER_BROWSER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), FOLDER_BROWSER_TYPE, FolderBrowserClass))
|
||||
#define IS_FOLDER_BROWSER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), FOLDER_BROWSER_TYPE))
|
||||
#define IS_FOLDER_BROWSER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), FOLDER_BROWSER_TYPE))
|
||||
|
||||
#define FB_DEFAULT_CHARSET _("Default")
|
||||
|
||||
#define FOLDER_BROWSER_IS_DESTROYED(fb) (!fb || !fb->message_list || !fb->mail_display || !fb->folder)
|
||||
|
||||
typedef enum _FolderBrowserSelectionState {
|
||||
FB_SELSTATE_NONE,
|
||||
FB_SELSTATE_SINGLE,
|
||||
FB_SELSTATE_MULTIPLE,
|
||||
FB_SELSTATE_UNDEFINED
|
||||
} FolderBrowserSelectionState;
|
||||
|
||||
struct _FolderBrowser {
|
||||
GtkTable parent;
|
||||
|
||||
BonoboPropertyBag *properties;
|
||||
|
||||
GNOME_Evolution_ShellView shell_view;
|
||||
|
||||
BonoboUIComponent *uicomp;
|
||||
|
||||
/*
|
||||
* The current URI being displayed by the FolderBrowser
|
||||
*/
|
||||
char *uri;
|
||||
CamelFolder *folder;
|
||||
int unread_count; /* last known unread message count */
|
||||
|
||||
/* async loading stuff */
|
||||
char *loading_uid; /* what uid am i loading now */
|
||||
char *pending_uid; /* what uid should i load next */
|
||||
char *new_uid; /* place to save the next uid during idle timeout */
|
||||
char *loaded_uid; /* what we have loaded */
|
||||
guint loading_id;
|
||||
guint seen_id;
|
||||
|
||||
gulong paned_resize_id;
|
||||
|
||||
/* a folder we are expunging, dont use other than to compare the pointer value */
|
||||
CamelFolder *expunging;
|
||||
int expunge_mlfocussed; /* true if the ml was focussed before we expunged */
|
||||
|
||||
MessageList *message_list;
|
||||
MailDisplay *mail_display;
|
||||
GtkWidget *vpaned;
|
||||
|
||||
EFilterBar *search;
|
||||
FilterRule *search_full; /* if we have a full search active */
|
||||
|
||||
struct _EMeta *meta; /* various per-folder meta-data */
|
||||
|
||||
guint32 preview_shown : 1;
|
||||
guint32 threaded : 1;
|
||||
guint32 pref_master : 1;
|
||||
|
||||
FolderBrowserSelectionState selection_state;
|
||||
GSList *sensitize_changes;
|
||||
GHashTable *sensitise_state; /* the last sent sensitise state, to avoid much bonobo overhead */
|
||||
int sensitize_timeout_id;
|
||||
int update_status_bar_idle_id;
|
||||
|
||||
/* View instance and the menu handler object */
|
||||
GalViewInstance *view_instance;
|
||||
GalViewMenus *view_menus;
|
||||
|
||||
GtkWidget *invisible;
|
||||
GByteArray *clipboard_selection;
|
||||
|
||||
/* for async events */
|
||||
struct _MailAsyncEvent *async_event;
|
||||
|
||||
int get_id; /* for getting folder op */
|
||||
|
||||
/* info used by popup for filter/vfolder */
|
||||
struct _popup_filter_data *popup;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GtkTableClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (*folder_loaded) (FolderBrowser *fb, const char *uri);
|
||||
void (*message_loaded) (FolderBrowser *fb, const char *uid);
|
||||
} FolderBrowserClass;
|
||||
|
||||
struct fb_ondemand_closure {
|
||||
FilterRule *rule;
|
||||
FolderBrowser *fb;
|
||||
gchar *path;
|
||||
};
|
||||
|
||||
GtkType folder_browser_get_type (void);
|
||||
GtkWidget *folder_browser_new (const char *uri);
|
||||
|
||||
void folder_browser_set_folder (FolderBrowser *fb, CamelFolder *folder, const char *uri);
|
||||
|
||||
void folder_browser_set_ui_component (FolderBrowser *fb, BonoboUIComponent *uicomp);
|
||||
void folder_browser_set_shell_view (FolderBrowser *fb, GNOME_Evolution_ShellView shell_view);
|
||||
|
||||
void folder_browser_set_message_preview (FolderBrowser *folder_browser,
|
||||
gboolean show_message_preview);
|
||||
void folder_browser_clear_search (FolderBrowser *fb);
|
||||
|
||||
void folder_browser_cut (GtkWidget *widget, FolderBrowser *fb);
|
||||
void folder_browser_copy (GtkWidget *widget, FolderBrowser *fb);
|
||||
void folder_browser_paste (GtkWidget *widget, FolderBrowser *fb);
|
||||
|
||||
void folder_browser_reload (FolderBrowser *fb);
|
||||
|
||||
/* callbacks for functions on the folder-browser */
|
||||
void vfolder_subject (GtkWidget *w, FolderBrowser *fb);
|
||||
void vfolder_sender (GtkWidget *w, FolderBrowser *fb);
|
||||
void vfolder_recipient (GtkWidget *w, FolderBrowser *fb);
|
||||
void vfolder_mlist (GtkWidget *w, FolderBrowser *fb);
|
||||
|
||||
void filter_subject (GtkWidget *w, FolderBrowser *fb);
|
||||
void filter_sender (GtkWidget *w, FolderBrowser *fb);
|
||||
void filter_recipient (GtkWidget *w, FolderBrowser *fb);
|
||||
void filter_mlist (GtkWidget *w, FolderBrowser *fb);
|
||||
|
||||
void hide_read(GtkWidget *w, FolderBrowser *fb);
|
||||
void hide_deleted(GtkWidget *w, FolderBrowser *fb);
|
||||
void hide_selected(GtkWidget *w, FolderBrowser *fb);
|
||||
void hide_none(GtkWidget *w, FolderBrowser *fb);
|
||||
void hide_subject(GtkWidget *w, FolderBrowser *fb);
|
||||
void hide_sender(GtkWidget *w, FolderBrowser *fb);
|
||||
|
||||
void folder_browser_toggle_preview (BonoboUIComponent *component,
|
||||
const char *path,
|
||||
Bonobo_UIComponent_EventType type,
|
||||
const char *state,
|
||||
gpointer user_data);
|
||||
|
||||
void folder_browser_toggle_threads (BonoboUIComponent *component,
|
||||
const char *path,
|
||||
Bonobo_UIComponent_EventType type,
|
||||
const char *state,
|
||||
gpointer user_data);
|
||||
|
||||
void folder_browser_toggle_hide_deleted (BonoboUIComponent *component,
|
||||
const char *path,
|
||||
Bonobo_UIComponent_EventType type,
|
||||
const char *state,
|
||||
gpointer user_data);
|
||||
|
||||
void folder_browser_toggle_caret_mode (BonoboUIComponent *component,
|
||||
const char *path,
|
||||
Bonobo_UIComponent_EventType type,
|
||||
const char *state,
|
||||
gpointer user_data);
|
||||
|
||||
void folder_browser_set_message_display_style (BonoboUIComponent *component,
|
||||
const char *path,
|
||||
Bonobo_UIComponent_EventType type,
|
||||
const char *state,
|
||||
gpointer user_data);
|
||||
|
||||
void folder_browser_charset_changed (BonoboUIComponent *component,
|
||||
const char *path,
|
||||
Bonobo_UIComponent_EventType type,
|
||||
const char *state,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean folder_browser_is_drafts (FolderBrowser *fb);
|
||||
gboolean folder_browser_is_sent (FolderBrowser *fb);
|
||||
gboolean folder_browser_is_outbox (FolderBrowser *fb);
|
||||
|
||||
#endif /* _FOLDER_BROWSER_H_ */
|
@ -36,17 +36,21 @@
|
||||
#include <e-util/e-account-list.h>
|
||||
#include <e-util/e-dialog-utils.h>
|
||||
|
||||
#include "evolution-folder-selector-button.h"
|
||||
#include "em-folder-selection-button.h"
|
||||
#include "mail-account-gui.h"
|
||||
#include "mail-session.h"
|
||||
#include "mail-send-recv.h"
|
||||
#include "mail-signature-editor.h"
|
||||
#include "mail-component.h"
|
||||
#include "mail-composer-prefs.h"
|
||||
#include "mail-config.h"
|
||||
#include "mail-ops.h"
|
||||
#include "mail-mt.h"
|
||||
#include "mail.h"
|
||||
|
||||
#include "e-storage.h"
|
||||
|
||||
|
||||
#define d(x)
|
||||
|
||||
extern char *default_drafts_folder_uri, *default_sent_folder_uri;
|
||||
@ -1060,16 +1064,13 @@ extract_values (MailAccountGuiService *source, GHashTable *extra_config, CamelUR
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
folder_selected (EvolutionFolderSelectorButton *button,
|
||||
GNOME_Evolution_Folder *corba_folder,
|
||||
gpointer user_data)
|
||||
folder_selected (EMFolderSelectionButton *button, gpointer user_data)
|
||||
{
|
||||
char **folder_name = user_data;
|
||||
|
||||
g_free (*folder_name);
|
||||
*folder_name = g_strdup (corba_folder->physicalUri);
|
||||
*folder_name = g_strdup(em_folder_selection_button_get_selection(button));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1080,14 +1081,12 @@ default_folders_clicked (GtkButton *button, gpointer user_data)
|
||||
/* Drafts folder */
|
||||
g_free (gui->drafts_folder_uri);
|
||||
gui->drafts_folder_uri = g_strdup (default_drafts_folder_uri);
|
||||
evolution_folder_selector_button_set_uri (EVOLUTION_FOLDER_SELECTOR_BUTTON (gui->drafts_folder_button),
|
||||
gui->drafts_folder_uri);
|
||||
em_folder_selection_button_set_selection((EMFolderSelectionButton *)gui->drafts_folder_button, gui->drafts_folder_uri);
|
||||
|
||||
/* Sent folder */
|
||||
g_free (gui->sent_folder_uri);
|
||||
gui->sent_folder_uri = g_strdup (default_sent_folder_uri);
|
||||
evolution_folder_selector_button_set_uri (EVOLUTION_FOLDER_SELECTOR_BUTTON (gui->sent_folder_button),
|
||||
gui->sent_folder_uri);
|
||||
em_folder_selection_button_set_selection((EMFolderSelectionButton *)gui->sent_folder_button, gui->sent_folder_uri);
|
||||
}
|
||||
|
||||
GtkWidget *mail_account_gui_folder_selector_button_new (char *widget_name, char *string1, char *string2, int int1, int int2);
|
||||
@ -1097,7 +1096,7 @@ mail_account_gui_folder_selector_button_new (char *widget_name,
|
||||
char *string1, char *string2,
|
||||
int int1, int int2)
|
||||
{
|
||||
return (GtkWidget *)g_object_new (EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON, NULL);
|
||||
return (GtkWidget *)em_folder_selection_button_new(_("Select Folder"), NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -1410,7 +1409,6 @@ prepare_signatures (MailAccountGui *gui)
|
||||
MailAccountGui *
|
||||
mail_account_gui_new (EAccount *account, MailAccountsTab *dialog)
|
||||
{
|
||||
const char *allowed_types[] = { "mail/*", NULL };
|
||||
MailAccountGui *gui;
|
||||
GtkWidget *button;
|
||||
|
||||
@ -1499,31 +1497,21 @@ mail_account_gui_new (EAccount *account, MailAccountsTab *dialog)
|
||||
|
||||
/* Drafts folder */
|
||||
gui->drafts_folder_button = GTK_BUTTON (glade_xml_get_widget (gui->xml, "drafts_button"));
|
||||
g_signal_connect (gui->drafts_folder_button, "selected",
|
||||
G_CALLBACK (folder_selected), &gui->drafts_folder_uri);
|
||||
g_signal_connect (gui->drafts_folder_button, "selected", G_CALLBACK (folder_selected), &gui->drafts_folder_uri);
|
||||
if (account->drafts_folder_uri)
|
||||
gui->drafts_folder_uri = g_strdup (account->drafts_folder_uri);
|
||||
else
|
||||
gui->drafts_folder_uri = g_strdup (default_drafts_folder_uri);
|
||||
evolution_folder_selector_button_construct (EVOLUTION_FOLDER_SELECTOR_BUTTON (gui->drafts_folder_button),
|
||||
global_shell_client,
|
||||
_("Select Folder"),
|
||||
gui->drafts_folder_uri,
|
||||
allowed_types);
|
||||
em_folder_selection_button_set_selection((EMFolderSelectionButton *)gui->drafts_folder_button, gui->drafts_folder_uri);
|
||||
|
||||
/* Sent folder */
|
||||
gui->sent_folder_button = GTK_BUTTON (glade_xml_get_widget (gui->xml, "sent_button"));
|
||||
g_signal_connect (gui->sent_folder_button, "selected",
|
||||
G_CALLBACK (folder_selected), &gui->sent_folder_uri);
|
||||
g_signal_connect (gui->sent_folder_button, "selected", G_CALLBACK (folder_selected), &gui->sent_folder_uri);
|
||||
if (account->sent_folder_uri)
|
||||
gui->sent_folder_uri = g_strdup (account->sent_folder_uri);
|
||||
else
|
||||
gui->sent_folder_uri = g_strdup (default_sent_folder_uri);
|
||||
evolution_folder_selector_button_construct (EVOLUTION_FOLDER_SELECTOR_BUTTON (gui->sent_folder_button),
|
||||
global_shell_client,
|
||||
_("Select Folder"),
|
||||
gui->sent_folder_uri,
|
||||
allowed_types);
|
||||
em_folder_selection_button_set_selection((EMFolderSelectionButton *)gui->sent_folder_button, gui->sent_folder_uri);
|
||||
|
||||
/* Special Folders "Reset Defaults" button */
|
||||
button = glade_xml_get_widget (gui->xml, "default_folders_button");
|
||||
@ -1842,18 +1830,21 @@ static void
|
||||
add_new_store (char *uri, CamelStore *store, void *user_data)
|
||||
{
|
||||
EAccount *account = user_data;
|
||||
EvolutionStorage *storage;
|
||||
MailComponent *component = mail_component_peek ();
|
||||
EStorage *storage;
|
||||
|
||||
if (store == NULL)
|
||||
return;
|
||||
|
||||
/* EPFIXME: Strange refcounting semantics here?! */
|
||||
|
||||
storage = mail_lookup_storage (store);
|
||||
storage = mail_component_lookup_storage (component, store);
|
||||
if (storage) {
|
||||
/* store is already in the folder tree, so do nothing */
|
||||
bonobo_object_unref (BONOBO_OBJECT (storage));
|
||||
g_object_unref (storage);
|
||||
} else {
|
||||
/* store is *not* in the folder tree, so lets add it. */
|
||||
mail_add_storage (store, account->name, account->source->url);
|
||||
mail_component_add_store (component, store, account->name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1968,7 +1959,7 @@ mail_account_gui_save (MailAccountGui *gui)
|
||||
#define sources_equal(old,new) (new->url && !strcmp (old->url, new->url))
|
||||
if (!sources_equal (account->source, new->source)) {
|
||||
/* Remove the old storage from the folder-tree */
|
||||
mail_remove_storage_by_uri (account->source->url);
|
||||
mail_component_remove_storage_by_uri (mail_component_peek (), account->source->url);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,9 +33,11 @@
|
||||
#include <gtk/gtktreeselection.h>
|
||||
|
||||
#include "mail.h"
|
||||
#include "mail-component.h"
|
||||
#include "mail-config.h"
|
||||
#include "mail-config-druid.h"
|
||||
#include "mail-account-editor.h"
|
||||
#include "mail-ops.h"
|
||||
#include "mail-send-recv.h"
|
||||
|
||||
#include "art/mark.xpm"
|
||||
@ -248,8 +250,8 @@ account_delete_clicked (GtkButton *button, gpointer user_data)
|
||||
|
||||
/* remove it from the folder-tree in the shell */
|
||||
if (account->enabled && account->source && account->source->url)
|
||||
mail_remove_storage_by_uri (account->source->url);
|
||||
|
||||
mail_component_remove_storage_by_uri (mail_component_peek (), account->source->url);
|
||||
|
||||
/* remove it from the config file */
|
||||
mail_config_remove_account (account);
|
||||
accounts = mail_config_get_accounts ();
|
||||
@ -297,6 +299,7 @@ account_default_clicked (GtkButton *button, gpointer user_data)
|
||||
static void
|
||||
account_able_clicked (GtkButton *button, gpointer user_data)
|
||||
{
|
||||
MailComponent *component = mail_component_peek ();
|
||||
MailAccountsTab *prefs = user_data;
|
||||
GtkTreeSelection *selection;
|
||||
EAccount *account = NULL;
|
||||
@ -317,9 +320,11 @@ account_able_clicked (GtkButton *button, gpointer user_data)
|
||||
folder-tree, otherwise add it to the folder-tree */
|
||||
if (account->source->url) {
|
||||
if (account->enabled)
|
||||
mail_load_storage_by_uri (prefs->shell, account->source->url, account->name);
|
||||
mail_component_load_storage_by_uri (component,
|
||||
account->source->url,
|
||||
account->name);
|
||||
else
|
||||
mail_remove_storage_by_uri (account->source->url);
|
||||
mail_component_remove_storage_by_uri (component, account->source->url);
|
||||
}
|
||||
|
||||
mail_autoreceive_setup ();
|
||||
@ -354,17 +359,18 @@ account_able_toggled (GtkCellRendererToggle *renderer, char *arg1, gpointer user
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
if (account) {
|
||||
MailComponent *component = mail_component_peek ();
|
||||
|
||||
/* if the account got disabled, remove it from the
|
||||
folder-tree, otherwise add it to the folder-tree */
|
||||
if (account->source->url) {
|
||||
if (account->enabled)
|
||||
mail_load_storage_by_uri (prefs->shell, account->source->url, account->name);
|
||||
mail_component_load_storage_by_uri (component, account->source->url, account->name);
|
||||
else
|
||||
mail_remove_storage_by_uri (account->source->url);
|
||||
mail_component_remove_storage_by_uri (component, account->source->url);
|
||||
}
|
||||
|
||||
mail_autoreceive_setup ();
|
||||
|
||||
mail_config_write ();
|
||||
}
|
||||
}
|
||||
|
12
mail/mail-accounts.etspec
Normal file
12
mail/mail-accounts.etspec
Normal file
@ -0,0 +1,12 @@
|
||||
<ETableSpecification cursor-mode="line" draw-grid="false" draw-focus="true" selection-mode="single">
|
||||
<ETableColumn model_col= "0" _title="Enabled" pixbuf="enabled" expansion="0.0" minimum_width="18" resizable="false" cell="render_message_status" compare="integer" sortable="false"/>
|
||||
|
||||
<ETableColumn model_col= "1" _title="Account name" expansion="1.6" minimum_width="32" resizable="true" cell="render_text" compare="string"/>
|
||||
|
||||
<ETableColumn model_col= "2" _title="Protocol" expansion="0.8" minimum_width="32" resizable="true" cell="render_text" compare="string"/>
|
||||
|
||||
<ETableState>
|
||||
<column source="0"/> <column source="1"/> <column source="2"/>
|
||||
<grouping> </grouping>
|
||||
</ETableState>
|
||||
</ETableSpecification>
|
@ -51,7 +51,6 @@
|
||||
#include "filter/filter-editor.h"
|
||||
#include "filter/filter-option.h"
|
||||
|
||||
extern char *evolution_dir;
|
||||
|
||||
static void
|
||||
rule_match_recipients (RuleContext *context, FilterRule *rule, CamelInternetAddress *iaddr)
|
||||
@ -313,7 +312,8 @@ filter_gui_add_from_message (CamelMimeMessage *msg, const char *source, int flag
|
||||
g_return_if_fail (msg != NULL);
|
||||
|
||||
fc = filter_context_new ();
|
||||
user = g_strdup_printf ("%s/filters.xml", evolution_dir);
|
||||
user = g_strdup_printf ("%s/filters.xml",
|
||||
mail_component_peek_base_directory (mail_component_peek ()));
|
||||
system = EVOLUTION_PRIVDATADIR "/filtertypes.xml";
|
||||
rule_context_load ((RuleContext *)fc, system, user);
|
||||
rule = filter_rule_from_message (fc, msg, flags);
|
||||
@ -334,7 +334,7 @@ mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri
|
||||
GList *changed;
|
||||
|
||||
fc = filter_context_new ();
|
||||
user = g_strdup_printf ("%s/filters.xml", evolution_dir);
|
||||
user = g_strdup_printf ("%s/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
|
||||
system = EVOLUTION_PRIVDATADIR "/filtertypes.xml";
|
||||
rule_context_load ((RuleContext *)fc, system, user);
|
||||
|
||||
@ -359,7 +359,7 @@ mail_filter_delete_uri(CamelStore *store, const char *uri)
|
||||
GList *deleted;
|
||||
|
||||
fc = filter_context_new ();
|
||||
user = g_strdup_printf ("%s/filters.xml", evolution_dir);
|
||||
user = g_strdup_printf ("%s/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
|
||||
system = EVOLUTION_PRIVDATADIR "/filtertypes.xml";
|
||||
rule_context_load ((RuleContext *)fc, system, user);
|
||||
|
||||
|
3228
mail/mail-callbacks.c
Normal file
3228
mail/mail-callbacks.c
Normal file
File diff suppressed because it is too large
Load Diff
144
mail/mail-callbacks.h
Normal file
144
mail/mail-callbacks.h
Normal file
@ -0,0 +1,144 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Authors: Jeffrey Stedfast <fejj@ximian.com>
|
||||
*
|
||||
* Copyright 2000 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MAIL_CALLBACKS_H
|
||||
#define MAIL_CALLBACKS_H
|
||||
|
||||
#include <camel/camel.h>
|
||||
#include "composer/e-msg-composer.h"
|
||||
#include <mail/mail-types.h>
|
||||
#include "evolution-storage.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#pragma }
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* these are the possible modes for replying */
|
||||
enum {
|
||||
REPLY_SENDER,
|
||||
REPLY_LIST,
|
||||
REPLY_ALL,
|
||||
REPLY_POST,
|
||||
REPLY_NO_QUOTE = 0x80 /* dont quote reply */
|
||||
};
|
||||
|
||||
void enumerate_msg (MessageList *ml, const char *uid, gpointer data);
|
||||
|
||||
void fetch_mail (GtkWidget *widget, gpointer user_data);
|
||||
void send_queued_mail (GtkWidget *widget, gpointer user_data);
|
||||
|
||||
void compose_msg (GtkWidget *widget, gpointer user_data);
|
||||
void send_to_url (const char *url, const char *parent_uri);
|
||||
|
||||
void forward_inline (GtkWidget *widget, gpointer user_data);
|
||||
void forward_quoted (GtkWidget *widget, gpointer user_data);
|
||||
void forward_attached (GtkWidget *widget, gpointer user_data);
|
||||
void forward (GtkWidget *widget, gpointer user_data);
|
||||
|
||||
void post_to_url (const char *url);
|
||||
void post_message (GtkWidget *widget, gpointer user_data);
|
||||
void post_reply (GtkWidget *widget, gpointer user_data);
|
||||
|
||||
void redirect (GtkWidget *widget, gpointer user_data);
|
||||
|
||||
void reply_to_sender (GtkWidget *widget, gpointer user_data);
|
||||
void reply_to_list (GtkWidget *widget, gpointer user_data);
|
||||
void reply_to_all (GtkWidget *widget, gpointer user_data);
|
||||
|
||||
void colour_msg (GtkWidget *widget, gpointer user_data);
|
||||
void delete_msg (GtkWidget *widget, gpointer user_data);
|
||||
void undelete_msg (GtkWidget *widget, gpointer user_data);
|
||||
void move_msg_cb (GtkWidget *widget, gpointer user_data);
|
||||
void copy_msg_cb (GtkWidget *widget, gpointer user_data);
|
||||
void addrbook_sender (GtkWidget *widget, gpointer user_data);
|
||||
void apply_filters (GtkWidget *widget, gpointer user_data);
|
||||
void print_msg (GtkWidget *widget, gpointer user_data);
|
||||
void print_preview_msg (GtkWidget *widget, gpointer user_data);
|
||||
void edit_msg (GtkWidget *widget, gpointer user_data);
|
||||
void open_msg (GtkWidget *widget, gpointer user_data);
|
||||
void save_msg (GtkWidget *widget, gpointer user_data);
|
||||
void view_msg (GtkWidget *widget, gpointer user_data);
|
||||
void view_digest (GtkWidget *widget, gpointer user_data);
|
||||
void view_source (GtkWidget *widget, gpointer user_data);
|
||||
void next_msg (GtkWidget *widget, gpointer user_data);
|
||||
void next_unread_msg (GtkWidget *widget, gpointer user_data);
|
||||
void next_flagged_msg (GtkWidget *widget, gpointer user_data);
|
||||
void next_thread (GtkWidget *widget, gpointer user_data);
|
||||
void previous_msg (GtkWidget *widget, gpointer user_data);
|
||||
void previous_unread_msg (GtkWidget *widget, gpointer user_data);
|
||||
void previous_flagged_msg (GtkWidget *widget, gpointer user_data);
|
||||
void resend_msg (GtkWidget *widget, gpointer user_data);
|
||||
void search_msg (GtkWidget *widget, gpointer user_data);
|
||||
void load_images (GtkWidget *widget, gpointer user_data);
|
||||
|
||||
void add_sender_to_addrbook (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void move_msg (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void copy_msg (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void select_all (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void select_thread (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void invert_selection (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void mark_all_as_seen (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void mark_as_unseen (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void mark_as_unimportant (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void flag_for_followup (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void flag_followup_completed (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void flag_followup_clear (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
|
||||
void zoom_in (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void zoom_out (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void zoom_reset (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
|
||||
void edit_message (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void open_message (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void filter_edit (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void vfolder_edit_vfolders (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
void manage_subscriptions (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
|
||||
void configure_folder (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
|
||||
void stop_threads (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
|
||||
void empty_trash (BonoboUIComponent *uih, void *user_data, const char *path);
|
||||
|
||||
void mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, int mode);
|
||||
|
||||
void composer_send_cb (EMsgComposer *composer, gpointer data);
|
||||
void composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer data);
|
||||
|
||||
void forward_messages (CamelFolder *folder, GPtrArray *uids, gboolean inline);
|
||||
|
||||
/* CamelStore callbacks */
|
||||
void folder_created (CamelStore *store, const char *prefix, CamelFolderInfo *fi);
|
||||
void folder_deleted (CamelStore *store, CamelFolderInfo *fi);
|
||||
|
||||
void mail_storage_create_folder (EvolutionStorage *storage, CamelStore *store, CamelFolderInfo *fi);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* ! MAIL_CALLBACKS_H */
|
104
mail/mail-component-factory.c
Normal file
104
mail/mail-component-factory.c
Normal file
@ -0,0 +1,104 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
/* mail-component-factory.c
|
||||
*
|
||||
* Authors: Ettore Perazzoli <ettore@ximian.com>
|
||||
*
|
||||
* Copyright (C) 2003 Ximian, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "em-utils.h"
|
||||
#include "evolution-composer.h"
|
||||
#include "mail-accounts.h"
|
||||
#include "mail-component.h"
|
||||
#include "mail-composer-prefs.h"
|
||||
#include "mail-config-druid.h"
|
||||
#include "mail-config-factory.h"
|
||||
#include "mail-config.h"
|
||||
#include "mail-mt.h"
|
||||
#include "mail-preferences.h"
|
||||
|
||||
#include <bonobo-activation/bonobo-activation.h>
|
||||
#include <bonobo/bonobo-shlib-factory.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#define FACTORY_ID "OAFIID:GNOME_Evolution_Mail_Factory_2"
|
||||
|
||||
#define COMPONENT_ID "OAFIID:GNOME_Evolution_Mail_Component_2"
|
||||
#define COMPOSER_ID "OAFIID:GNOME_Evolution_Mail_Composer"
|
||||
#define FOLDER_INFO_ID "OAFIID:GNOME_Evolution_FolderInfo"
|
||||
#define MAIL_CONFIG_ID "OAFIID:GNOME_Evolution_MailConfig"
|
||||
#define WIZARD_ID "OAFIID:GNOME_Evolution_Mail_Wizard"
|
||||
|
||||
|
||||
/* EPFIXME: This stuff is here just to get it to compile, it should be moved
|
||||
out of the way (was originally in component-factory.c). */
|
||||
EvolutionShellClient *global_shell_client = NULL;
|
||||
|
||||
static BonoboObject *
|
||||
factory (BonoboGenericFactory *factory,
|
||||
const char *component_id,
|
||||
void *closure)
|
||||
{
|
||||
/* EPFIXME this is messy. The IDs are defined all over the place
|
||||
without a logic... */
|
||||
|
||||
if (strcmp (component_id, COMPONENT_ID) == 0) {
|
||||
MailComponent *component = mail_component_peek ();
|
||||
|
||||
bonobo_object_ref (BONOBO_OBJECT (component));
|
||||
return BONOBO_OBJECT (component);
|
||||
} else if (strcmp(component_id, MAIL_CONFIG_ID) == 0) {
|
||||
return (BonoboObject *)g_object_new (evolution_mail_config_get_type (), NULL);
|
||||
} else if (strcmp(component_id, WIZARD_ID) == 0) {
|
||||
return evolution_mail_config_wizard_new();
|
||||
} else if (strcmp (component_id, MAIL_ACCOUNTS_CONTROL_ID) == 0
|
||||
|| strcmp (component_id, MAIL_PREFERENCES_CONTROL_ID) == 0
|
||||
|| strcmp (component_id, MAIL_COMPOSER_PREFS_CONTROL_ID) == 0) {
|
||||
return mail_config_control_factory_cb (factory, component_id, CORBA_OBJECT_NIL);
|
||||
} else if (strcmp(component_id, COMPOSER_ID) == 0) {
|
||||
/* FIXME: how to remove need for callbacks, probably make the composer more tightly integrated with mail */
|
||||
return (BonoboObject *) evolution_composer_new (em_utils_composer_send_cb, em_utils_composer_save_draft_cb);
|
||||
}
|
||||
|
||||
g_warning (FACTORY_ID ": Don't know what to do with %s", component_id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Bonobo_Unknown
|
||||
make_factory (PortableServer_POA poa, const char *iid, gpointer impl_ptr, CORBA_Environment *ev)
|
||||
{
|
||||
static int init = 0;
|
||||
|
||||
if (!init) {
|
||||
mail_config_init ();
|
||||
mail_msg_init ();
|
||||
init = 1;
|
||||
}
|
||||
|
||||
return bonobo_shlib_factory_std (FACTORY_ID, poa, impl_ptr, factory, NULL, ev);
|
||||
}
|
||||
|
||||
static BonoboActivationPluginObject plugin_list[] = {
|
||||
{ FACTORY_ID, make_factory},
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const BonoboActivationPlugin Bonobo_Plugin_info = {
|
||||
plugin_list, "Evolution Mail component factory"
|
||||
};
|
1625
mail/mail-component.c
Normal file
1625
mail/mail-component.c
Normal file
File diff suppressed because it is too large
Load Diff
99
mail/mail-component.h
Normal file
99
mail/mail-component.h
Normal file
@ -0,0 +1,99 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
/* mail-component.h
|
||||
*
|
||||
* Copyright (C) 2003 Ximian Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Michael Zucchi <notzed@ximian.com>
|
||||
* Jeffrey Stedfast <fejj@ximian.com>
|
||||
* Ettore Perazzoli <ettore@ximian.com>
|
||||
*/
|
||||
|
||||
#ifndef _MAIL_COMPONENT_H_
|
||||
#define _MAIL_COMPONENT_H_
|
||||
|
||||
#include <bonobo/bonobo-object.h>
|
||||
|
||||
#include <camel/camel-store.h>
|
||||
|
||||
#include "e-storage-set.h"
|
||||
#include "Evolution.h"
|
||||
|
||||
#include "filter/rule-context.h"
|
||||
|
||||
|
||||
#define MAIL_TYPE_COMPONENT (mail_component_get_type ())
|
||||
#define MAIL_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAIL_TYPE_COMPONENT, MailComponent))
|
||||
#define MAIL_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAIL_TYPE_COMPONENT, MailComponentClass))
|
||||
#define MAIL_IS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAIL_TYPE_COMPONENT))
|
||||
#define MAIL_IS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), MAIL_TYPE_COMPONENT))
|
||||
|
||||
|
||||
typedef struct _MailComponent MailComponent;
|
||||
typedef struct _MailComponentPrivate MailComponentPrivate;
|
||||
typedef struct _MailComponentClass MailComponentClass;
|
||||
|
||||
struct _MailComponent {
|
||||
BonoboObject parent;
|
||||
|
||||
MailComponentPrivate *priv;
|
||||
};
|
||||
|
||||
struct _MailComponentClass {
|
||||
BonoboObjectClass parent_class;
|
||||
|
||||
POA_GNOME_Evolution_Component__epv epv;
|
||||
};
|
||||
|
||||
|
||||
GType mail_component_get_type (void);
|
||||
|
||||
MailComponent *mail_component_peek (void);
|
||||
|
||||
const char *mail_component_peek_base_directory (MailComponent *component);
|
||||
RuleContext *mail_component_peek_search_context (MailComponent *component);
|
||||
|
||||
void mail_component_add_store (MailComponent *component,
|
||||
CamelStore *store,
|
||||
const char *name);
|
||||
CamelStore *mail_component_load_storage_by_uri (MailComponent *component,
|
||||
const char *uri,
|
||||
const char *name);
|
||||
void mail_component_remove_storage (MailComponent *component,
|
||||
CamelStore *store);
|
||||
void mail_component_remove_storage_by_uri (MailComponent *component,
|
||||
const char *uri);
|
||||
EStorage *mail_component_lookup_storage (MailComponent *component,
|
||||
CamelStore *store);
|
||||
|
||||
int mail_component_get_storage_count (MailComponent *component);
|
||||
EStorageSet *mail_component_peek_storage_set (MailComponent *component);
|
||||
void mail_component_storages_foreach (MailComponent *component,
|
||||
GHFunc func,
|
||||
void *data);
|
||||
|
||||
char *em_uri_from_camel (const char *curi);
|
||||
char *em_uri_to_camel (const char *euri);
|
||||
|
||||
CamelFolder *mail_component_get_folder_from_evomail_uri (MailComponent *component,
|
||||
guint32 flags,
|
||||
const char *evomail_uri,
|
||||
CamelException *ex);
|
||||
char *mail_component_evomail_uri_from_folder (MailComponent *component,
|
||||
CamelFolder *folder);
|
||||
|
||||
#endif /* _MAIL_COMPONENT_H_ */
|
@ -34,8 +34,6 @@
|
||||
|
||||
#define CONFIG_CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ConfigControlFactory"
|
||||
|
||||
static BonoboGenericFactory *factory = NULL;
|
||||
|
||||
|
||||
typedef void (*ApplyFunc) (GtkWidget *prefs);
|
||||
|
||||
|
@ -53,7 +53,9 @@
|
||||
#include <gal/widgets/e-gui-utils.h>
|
||||
#include <e-util/e-url.h>
|
||||
#include <e-util/e-passwords.h>
|
||||
|
||||
#include "mail.h"
|
||||
#include "mail-component.h"
|
||||
#include "mail-config.h"
|
||||
#include "mail-mt.h"
|
||||
#include "mail-tools.h"
|
||||
@ -448,6 +450,8 @@ config_write_style (void)
|
||||
* may not have been set yet
|
||||
*
|
||||
* filename = g_build_filename (evolution_dir, MAIL_CONFIG_RC, NULL);
|
||||
*
|
||||
* EPFIXME this kludge needs to go away.
|
||||
*/
|
||||
filename = g_build_filename (g_get_home_dir (), "evolution", MAIL_CONFIG_RC, NULL);
|
||||
|
||||
@ -528,6 +532,7 @@ mail_config_init (void)
|
||||
mail_config_clear ();
|
||||
|
||||
/*
|
||||
EPFIXME: This kludge needs to go away.
|
||||
filename = g_build_filename (evolution_dir, MAIL_CONFIG_RC, NULL);
|
||||
*/
|
||||
filename = g_build_filename (g_get_home_dir (), "evolution", MAIL_CONFIG_RC, NULL);
|
||||
@ -933,6 +938,7 @@ mail_config_get_default_transport (void)
|
||||
static char *
|
||||
uri_to_evname (const char *uri, const char *prefix)
|
||||
{
|
||||
const char *base_directory = mail_component_peek_base_directory (mail_component_peek ());
|
||||
char *safe;
|
||||
char *tmp;
|
||||
|
||||
@ -940,9 +946,9 @@ uri_to_evname (const char *uri, const char *prefix)
|
||||
e_filename_make_safe (safe);
|
||||
/* blah, easiest thing to do */
|
||||
if (prefix[0] == '*')
|
||||
tmp = g_strdup_printf ("%s/%s%s.xml", evolution_dir, prefix + 1, safe);
|
||||
tmp = g_strdup_printf ("%s/%s%s.xml", base_directory, prefix + 1, safe);
|
||||
else
|
||||
tmp = g_strdup_printf ("%s/%s%s", evolution_dir, prefix, safe);
|
||||
tmp = g_strdup_printf ("%s/%s%s", base_directory, prefix, safe);
|
||||
g_free (safe);
|
||||
return tmp;
|
||||
}
|
||||
@ -1057,7 +1063,10 @@ mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix)
|
||||
char *url, *filename;
|
||||
|
||||
url = mail_config_folder_to_safe_url (folder);
|
||||
filename = g_strdup_printf ("%s/config/%s%s", evolution_dir, prefix, url);
|
||||
filename = g_strdup_printf ("%s/config/%s%s",
|
||||
mail_component_peek_base_directory (mail_component_peek ()),
|
||||
prefix,
|
||||
url);
|
||||
g_free (url);
|
||||
|
||||
return filename;
|
||||
@ -1328,22 +1337,24 @@ mail_config_get_signature_list (void)
|
||||
static char *
|
||||
get_new_signature_filename (void)
|
||||
{
|
||||
const char *base_directory;
|
||||
char *filename, *id;
|
||||
struct stat st;
|
||||
int i;
|
||||
|
||||
filename = g_build_filename (evolution_dir, "/signatures", NULL);
|
||||
|
||||
base_directory = mail_component_peek_base_directory (mail_component_peek ());
|
||||
filename = g_build_filename (base_directory, "signatures", NULL);
|
||||
if (lstat (filename, &st)) {
|
||||
if (errno == ENOENT) {
|
||||
if (mkdir (filename, 0700))
|
||||
g_warning ("Fatal problem creating %s/signatures directory.", evolution_dir);
|
||||
g_warning ("Fatal problem creating %s directory.", filename);
|
||||
} else
|
||||
g_warning ("Fatal problem with %s/signatures directory.", evolution_dir);
|
||||
g_warning ("Fatal problem with %s directory.", filename);
|
||||
}
|
||||
g_free (filename);
|
||||
|
||||
filename = g_malloc (strlen (evolution_dir) + sizeof ("/signatures/signature-") + 12);
|
||||
id = g_stpcpy (filename, evolution_dir);
|
||||
filename = g_malloc (strlen (base_directory) + sizeof ("/signatures/signature-") + 12);
|
||||
id = g_stpcpy (filename, base_directory);
|
||||
id = g_stpcpy (id, "/signatures/signature-");
|
||||
|
||||
for (i = 0; i < (INT_MAX - 1); i++) {
|
||||
@ -1400,7 +1411,8 @@ delete_unused_signature_file (const char *filename)
|
||||
char *signatures_dir;
|
||||
int len;
|
||||
|
||||
signatures_dir = g_strconcat (evolution_dir, "/signatures", NULL);
|
||||
signatures_dir = g_strconcat (mail_component_peek_base_directory (mail_component_peek ()),
|
||||
"/signatures", NULL);
|
||||
|
||||
/* remove signature file if it's in evolution dir and no other signature uses it */
|
||||
len = strlen (signatures_dir);
|
||||
|
104
mail/mail-display-stream.c
Normal file
104
mail/mail-display-stream.c
Normal file
@ -0,0 +1,104 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Authors: Jeffrey Stedfast <fejj@ximian.com>
|
||||
*
|
||||
* Copyright 2001 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "mail-display-stream.h"
|
||||
|
||||
|
||||
static void mail_display_stream_class_init (MailDisplayStreamClass *klass);
|
||||
static void mail_display_stream_init (CamelObject *object);
|
||||
static void mail_display_stream_finalize (CamelObject *object);
|
||||
|
||||
static ssize_t stream_write (CamelStream *stream, const char *buffer, size_t n);
|
||||
|
||||
|
||||
static CamelStreamClass *parent_class = NULL;
|
||||
|
||||
|
||||
CamelType
|
||||
mail_display_stream_get_type (void)
|
||||
{
|
||||
static CamelType type = CAMEL_INVALID_TYPE;
|
||||
|
||||
if (type == CAMEL_INVALID_TYPE) {
|
||||
type = camel_type_register (CAMEL_STREAM_TYPE,
|
||||
"MailDisplayStream",
|
||||
sizeof (MailDisplayStream),
|
||||
sizeof (MailDisplayStreamClass),
|
||||
(CamelObjectClassInitFunc) mail_display_stream_class_init,
|
||||
NULL,
|
||||
(CamelObjectInitFunc) mail_display_stream_init,
|
||||
(CamelObjectFinalizeFunc) mail_display_stream_finalize);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
mail_display_stream_class_init (MailDisplayStreamClass *klass)
|
||||
{
|
||||
CamelStreamClass *stream_class = CAMEL_STREAM_CLASS (klass);
|
||||
|
||||
parent_class = (CamelStreamClass *) CAMEL_STREAM_TYPE;
|
||||
|
||||
/* virtual method overload */
|
||||
stream_class->write = stream_write;
|
||||
}
|
||||
|
||||
static void
|
||||
mail_display_stream_init (CamelObject *object)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
mail_display_stream_finalize (CamelObject *object)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
stream_write (CamelStream *stream, const char *buffer, size_t n)
|
||||
{
|
||||
MailDisplayStream *dstream = MAIL_DISPLAY_STREAM (stream);
|
||||
|
||||
gtk_html_write (dstream->html, dstream->html_stream, buffer, n);
|
||||
|
||||
return (ssize_t) n;
|
||||
}
|
||||
|
||||
|
||||
CamelStream *
|
||||
mail_display_stream_new (GtkHTML *html, GtkHTMLStream *html_stream)
|
||||
{
|
||||
MailDisplayStream *new;
|
||||
|
||||
new = MAIL_DISPLAY_STREAM (camel_object_new (MAIL_DISPLAY_STREAM_TYPE));
|
||||
new->html = html;
|
||||
new->html_stream = html_stream;
|
||||
|
||||
return CAMEL_STREAM (new);
|
||||
}
|
62
mail/mail-display-stream.h
Normal file
62
mail/mail-display-stream.h
Normal file
@ -0,0 +1,62 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Authors: Jeffrey Stedfast <fejj@ximian.com>
|
||||
*
|
||||
* Copyright 2001 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MAIL_DISPLAY_STREAM_H
|
||||
#define MAIL_DISPLAY_STREAM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#pragma }
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <camel/camel-stream.h>
|
||||
#include <gtkhtml/gtkhtml.h>
|
||||
|
||||
#define MAIL_DISPLAY_STREAM_TYPE (mail_display_stream_get_type ())
|
||||
#define MAIL_DISPLAY_STREAM(obj) (CAMEL_CHECK_CAST((obj), MAIL_DISPLAY_STREAM_TYPE, MailDisplayStream))
|
||||
#define MAIL_DISPLAY_STREAM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), MAIL_DISPLAY_STREAM_TYPE, MailDisplayStreamClass))
|
||||
#define MAIL_IS_DISPLAY_STREAM(o) (CAMEL_CHECK_TYPE((o), MAIL_DISPLAY_STREAM_TYPE))
|
||||
|
||||
typedef struct _MailDisplayStream {
|
||||
CamelStream parent_stream;
|
||||
|
||||
GtkHTML *html;
|
||||
GtkHTMLStream *html_stream;
|
||||
} MailDisplayStream;
|
||||
|
||||
typedef struct {
|
||||
CamelStreamClass parent_class;
|
||||
|
||||
} MailDisplayStreamClass;
|
||||
|
||||
|
||||
CamelType mail_display_stream_get_type (void);
|
||||
|
||||
/* Note: stream does not ref these objects! */
|
||||
CamelStream *mail_display_stream_new (GtkHTML *html, GtkHTMLStream *html_stream);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* MAIL_DISPLAY_STREAM_H */
|
2995
mail/mail-display.c
Normal file
2995
mail/mail-display.c
Normal file
File diff suppressed because it is too large
Load Diff
137
mail/mail-display.h
Normal file
137
mail/mail-display.h
Normal file
@ -0,0 +1,137 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Authors: Jeffrey Stedfast <fejj@ximian.com>
|
||||
*
|
||||
* Copyright 2002 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _MAIL_DISPLAY_H_
|
||||
#define _MAIL_DISPLAY_H_
|
||||
|
||||
#include <gtk/gtkvbox.h>
|
||||
#include <gtk/gtkscrolledwindow.h>
|
||||
#include <gtkhtml/gtkhtml.h>
|
||||
#include <gtkhtml/gtkhtml-stream.h>
|
||||
|
||||
#include <camel/camel-stream.h>
|
||||
#include <camel/camel-mime-message.h>
|
||||
#include <camel/camel-medium.h>
|
||||
#include <camel/camel-folder.h>
|
||||
|
||||
#include "mail-types.h"
|
||||
#include "mail-config.h" /*display_style*/
|
||||
#include "mail-display-stream.h"
|
||||
|
||||
#define MAIL_DISPLAY_TYPE (mail_display_get_type ())
|
||||
#define MAIL_DISPLAY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MAIL_DISPLAY_TYPE, MailDisplay))
|
||||
#define MAIL_DISPLAY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), MAIL_DISPLAY_TYPE, MailDisplayClass))
|
||||
#define IS_MAIL_DISPLAY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MAIL_DISPLAY_TYPE))
|
||||
#define IS_MAIL_DISPLAY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MAIL_DISPLAY_TYPE))
|
||||
|
||||
struct _MailDisplay {
|
||||
GtkVBox parent;
|
||||
|
||||
struct _MailDisplayPrivate *priv;
|
||||
|
||||
GtkScrolledWindow *scroll;
|
||||
GtkHTML *html;
|
||||
/* GtkHTMLStream *stream; */
|
||||
gint redisplay_counter;
|
||||
gpointer last_active;
|
||||
guint idle_id;
|
||||
|
||||
char *charset;
|
||||
|
||||
char *selection;
|
||||
|
||||
CamelMimeMessage *current_message;
|
||||
CamelMessageInfo *info;
|
||||
CamelFolder *folder;
|
||||
GData **data;
|
||||
|
||||
/* stack of Content-Location URLs used for combining with a
|
||||
relative URL Content-Location on a leaf part in order to
|
||||
construct the full URL */
|
||||
struct _location_url_stack *urls;
|
||||
|
||||
GHashTable *related; /* related parts not displayed yet */
|
||||
|
||||
/* Sigh. This shouldn't be needed. I haven't figured out why it is
|
||||
though. */
|
||||
GtkWidget *invisible;
|
||||
|
||||
MailConfigDisplayStyle display_style;
|
||||
|
||||
guint printing : 1;
|
||||
guint destroyed: 1;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GtkVBoxClass parent_class;
|
||||
} MailDisplayClass;
|
||||
|
||||
GtkType mail_display_get_type (void);
|
||||
GtkWidget * mail_display_new (void);
|
||||
|
||||
void mail_display_initialize_gtkhtml (MailDisplay *mail_display, GtkHTML *html);
|
||||
|
||||
void mail_display_queue_redisplay (MailDisplay *mail_display);
|
||||
void mail_display_render (MailDisplay *mail_display, GtkHTML *html, gboolean reset_scroll);
|
||||
void mail_display_redisplay (MailDisplay *mail_display, gboolean reset_scroll);
|
||||
void mail_display_redisplay_when_loaded (MailDisplay *md,
|
||||
gconstpointer key,
|
||||
void (*callback)(MailDisplay *, gpointer),
|
||||
GtkHTML *html,
|
||||
gpointer data);
|
||||
void mail_display_stream_write_when_loaded (MailDisplay *md,
|
||||
gconstpointer key,
|
||||
const gchar *url,
|
||||
void (*callback)(MailDisplay *, gpointer),
|
||||
GtkHTML *html,
|
||||
GtkHTMLStream *handle,
|
||||
gpointer data);
|
||||
|
||||
void mail_display_set_message (MailDisplay *mail_display,
|
||||
CamelMedium *medium,
|
||||
CamelFolder *folder,
|
||||
CamelMessageInfo *info);
|
||||
|
||||
void mail_display_set_charset (MailDisplay *mail_display,
|
||||
const char *charset);
|
||||
|
||||
void mail_display_load_images (MailDisplay *mail_display);
|
||||
|
||||
void mail_text_write (MailDisplayStream *stream,
|
||||
MailDisplay *md,
|
||||
CamelMimePart *part,
|
||||
gint idx,
|
||||
gboolean printing,
|
||||
const char *text);
|
||||
void mail_error_printf (MailDisplayStream *stream,
|
||||
const char *format, ...);
|
||||
|
||||
char *mail_display_add_url (MailDisplay *md, const char *kind, char *url, gpointer data);
|
||||
|
||||
const char *mail_display_get_url_for_icon (MailDisplay *md, const char *icon_name);
|
||||
|
||||
void mail_display_push_content_location (MailDisplay *md, const char *location);
|
||||
CamelURL *mail_display_get_content_location (MailDisplay *md);
|
||||
void mail_display_pop_content_location (MailDisplay *md);
|
||||
|
||||
#endif /* _MAIL_DISPLAY_H_ */
|
@ -98,9 +98,7 @@ struct _store_info {
|
||||
|
||||
CamelStore *store; /* the store for these folders */
|
||||
|
||||
/* only 1 should be set */
|
||||
EvolutionStorage *storage;
|
||||
GNOME_Evolution_Storage corba_storage;
|
||||
EStorage *storage;
|
||||
|
||||
/* Outstanding folderinfo requests */
|
||||
EDList folderinfo_updates;
|
||||
@ -109,7 +107,7 @@ struct _store_info {
|
||||
static void folder_changed(CamelObject *o, gpointer event_data, gpointer user_data);
|
||||
static void folder_renamed(CamelObject *o, gpointer event_data, gpointer user_data);
|
||||
static void folder_finalised(CamelObject *o, gpointer event_data, gpointer user_data);
|
||||
|
||||
static void message_changed (CamelObject *o, gpointer event_data, gpointer user_data);
|
||||
|
||||
static guint ping_id = 0;
|
||||
static gboolean ping_cb (gpointer user_data);
|
||||
@ -188,9 +186,7 @@ real_flush_updates(void *o, void *event_data, void *data)
|
||||
{
|
||||
struct _folder_update *up;
|
||||
struct _store_info *si;
|
||||
EvolutionStorage *storage;
|
||||
GNOME_Evolution_Storage corba_storage;
|
||||
CORBA_Environment ev;
|
||||
EStorage *storage;
|
||||
time_t now;
|
||||
|
||||
LOCK(info_lock);
|
||||
@ -199,11 +195,9 @@ real_flush_updates(void *o, void *event_data, void *data)
|
||||
if (si) {
|
||||
storage = si->storage;
|
||||
if (storage)
|
||||
bonobo_object_ref((BonoboObject *)storage);
|
||||
corba_storage = si->corba_storage;
|
||||
g_object_ref (storage);
|
||||
} else {
|
||||
storage = NULL;
|
||||
corba_storage = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
UNLOCK(info_lock);
|
||||
@ -214,7 +208,7 @@ real_flush_updates(void *o, void *event_data, void *data)
|
||||
mail_filter_delete_uri(up->store, up->uri);
|
||||
mail_config_uri_deleted(CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(up->store))->compare_folder_name, up->uri);
|
||||
if (up->unsub)
|
||||
evolution_storage_removed_folder (storage, up->path);
|
||||
e_storage_removed_folder (storage, up->path);
|
||||
} else
|
||||
mail_vfolder_add_uri(up->store, up->uri, TRUE);
|
||||
} else {
|
||||
@ -222,7 +216,7 @@ real_flush_updates(void *o, void *event_data, void *data)
|
||||
if (up->oldpath) {
|
||||
if (storage != NULL) {
|
||||
d(printf("Removing old folder (rename?) '%s'\n", up->oldpath));
|
||||
evolution_storage_removed_folder(storage, up->oldpath);
|
||||
e_storage_removed_folder(storage, up->oldpath);
|
||||
}
|
||||
/* ELSE? Shell supposed to handle the local snot case */
|
||||
}
|
||||
@ -237,24 +231,28 @@ real_flush_updates(void *o, void *event_data, void *data)
|
||||
}
|
||||
|
||||
if (up->name == NULL) {
|
||||
if (storage != NULL) {
|
||||
d(printf("Updating existing folder: %s (%d unread)\n", up->path, up->unread));
|
||||
evolution_storage_update_folder(storage, up->path, up->unread);
|
||||
} else if (corba_storage != CORBA_OBJECT_NIL) {
|
||||
d(printf("Updating existing (local) folder: %s (%d unread)\n", up->path, up->unread));
|
||||
CORBA_exception_init(&ev);
|
||||
GNOME_Evolution_Storage_updateFolder(corba_storage, up->path, up->unread, &ev);
|
||||
CORBA_exception_free(&ev);
|
||||
EFolder *folder = e_storage_get_folder (storage, up->path);
|
||||
|
||||
if (folder != NULL) {
|
||||
d(printf("updating unread count to '%s' to %d\n", up->path, up->unread));
|
||||
e_folder_set_unread_count (folder, up->unread);
|
||||
} else {
|
||||
g_warning ("No folder at %s ?!", up->path);
|
||||
}
|
||||
} else if (storage != NULL) {
|
||||
char *type = (strncmp(up->uri, "vtrash:", 7)==0)?"vtrash":"mail";
|
||||
|
||||
EFolder *new_folder = e_folder_new (up->name, type, NULL);
|
||||
|
||||
d(printf("Adding new folder: %s\n", up->path));
|
||||
evolution_storage_new_folder(storage,
|
||||
up->path, up->name, type, up->uri, up->name, NULL,
|
||||
up->unread,
|
||||
CAMEL_IS_DISCO_STORE(up->store)
|
||||
&& camel_disco_store_can_work_offline((CamelDiscoStore *)up->store), 0);
|
||||
|
||||
e_folder_set_physical_uri (new_folder, up->uri);
|
||||
e_folder_set_unread_count (new_folder, up->unread);
|
||||
if (CAMEL_IS_DISCO_STORE(up->store) && camel_disco_store_can_work_offline((CamelDiscoStore *)up->store))
|
||||
e_folder_set_can_sync_offline (new_folder, TRUE);
|
||||
else
|
||||
e_folder_set_can_sync_offline (new_folder, FALSE);
|
||||
|
||||
e_storage_new_folder(storage, up->path, new_folder);
|
||||
}
|
||||
|
||||
if (!up->olduri && up->add)
|
||||
@ -279,9 +277,9 @@ real_flush_updates(void *o, void *event_data, void *data)
|
||||
notify_idle_id = g_idle_add_full (G_PRIORITY_LOW, notify_idle_cb, NULL, NULL);
|
||||
|
||||
free_update(up);
|
||||
|
||||
if (storage)
|
||||
bonobo_object_unref((BonoboObject *)storage);
|
||||
|
||||
if (storage != NULL)
|
||||
g_object_unref (storage);
|
||||
|
||||
LOCK(info_lock);
|
||||
}
|
||||
@ -307,7 +305,7 @@ unset_folder_info(struct _folder_info *mfi, int delete, int unsub)
|
||||
CamelFolder *folder = mfi->folder;
|
||||
|
||||
camel_object_unhook_event(folder, "folder_changed", folder_changed, mfi);
|
||||
camel_object_unhook_event(folder, "message_changed", folder_changed, mfi);
|
||||
camel_object_unhook_event(folder, "message_changed", message_changed, mfi);
|
||||
camel_object_unhook_event(folder, "renamed", folder_renamed, mfi);
|
||||
camel_object_unhook_event(folder, "finalize", folder_finalised, mfi);
|
||||
}
|
||||
@ -907,17 +905,18 @@ store_online_cb (CamelStore *store, void *data)
|
||||
}
|
||||
|
||||
void
|
||||
mail_note_store(CamelStore *store, CamelOperation *op, EvolutionStorage *storage, GNOME_Evolution_Storage corba_storage,
|
||||
mail_note_store(CamelStore *store, CamelOperation *op, EStorage *storage,
|
||||
void (*done)(CamelStore *store, CamelFolderInfo *info, void *data), void *data)
|
||||
{
|
||||
struct _store_info *si;
|
||||
struct _update_data *ud;
|
||||
const char *buf;
|
||||
guint timeout;
|
||||
|
||||
g_return_if_fail (storage == NULL || E_IS_STORAGE (storage));
|
||||
|
||||
g_assert(CAMEL_IS_STORE(store));
|
||||
g_assert(pthread_self() == mail_gui_thread);
|
||||
g_assert(storage == NULL || corba_storage == CORBA_OBJECT_NIL);
|
||||
|
||||
LOCK(info_lock);
|
||||
|
||||
@ -942,8 +941,7 @@ mail_note_store(CamelStore *store, CamelOperation *op, EvolutionStorage *storage
|
||||
CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name);
|
||||
si->storage = storage;
|
||||
if (storage != NULL)
|
||||
bonobo_object_ref((BonoboObject *)storage);
|
||||
si->corba_storage = corba_storage;
|
||||
g_object_ref (storage);
|
||||
si->store = store;
|
||||
camel_object_ref((CamelObject *)store);
|
||||
g_hash_table_insert(stores, store, si);
|
||||
|
@ -25,14 +25,15 @@
|
||||
#ifndef _MAIL_FOLDER_CACHE_H
|
||||
#define _MAIL_FOLDER_CACHE_H
|
||||
|
||||
#include <shell/evolution-storage.h>
|
||||
#include "e-storage.h"
|
||||
|
||||
/* Add a store whose folders should appear in the shell
|
||||
The folders are scanned from the store, and/or added at
|
||||
runtime via the folder_created event */
|
||||
void
|
||||
mail_note_store(CamelStore *store, CamelOperation *op, EvolutionStorage *storage, GNOME_Evolution_Storage corba_storage,
|
||||
void (*done)(CamelStore *store, CamelFolderInfo *info, void *data), void *data);
|
||||
mail_note_store(CamelStore *store, CamelOperation *op, EStorage *storage,
|
||||
void (*done) (CamelStore *store, CamelFolderInfo *info, void *data),
|
||||
void *data);
|
||||
|
||||
/* de-note a store */
|
||||
void mail_note_store_remove(CamelStore *store);
|
||||
@ -41,7 +42,7 @@ void mail_note_store_remove(CamelStore *store);
|
||||
The folder must have already been created on the store (which has already been noted)
|
||||
before the folder can be opened
|
||||
*/
|
||||
void mail_note_folder(struct _CamelFolder *folder);
|
||||
void mail_note_folder(CamelFolder *folder);
|
||||
|
||||
/* Returns true if a folder is available (yet), and also sets *folderp (if supplied)
|
||||
to a (referenced) copy of the folder if it has already been opened */
|
||||
|
130
mail/mail-font-prefs.c
Normal file
130
mail/mail-font-prefs.c
Normal file
@ -0,0 +1,130 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Authors: Larry Ewing <lewing@ximian.com>
|
||||
*
|
||||
* Copyright 2002 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtkhtml/gtkhtml-propmanager.h>
|
||||
|
||||
#include "mail-font-prefs.h"
|
||||
|
||||
static GtkVBoxClass *parent_class = NULL;
|
||||
|
||||
GtkWidget *
|
||||
mail_font_prefs_new (void)
|
||||
{
|
||||
MailFontPrefs *new;
|
||||
|
||||
new = MAIL_FONT_PREFS (g_object_new (mail_font_prefs_get_type ()), NULL);
|
||||
|
||||
return GTK_WIDGET (new);
|
||||
}
|
||||
|
||||
void
|
||||
mail_font_prefs_apply (MailFontPrefs *prefs)
|
||||
{
|
||||
gtk_html_propmanager_apply (prefs->pman);
|
||||
}
|
||||
|
||||
static void
|
||||
font_prefs_changed (GtkHTMLPropmanager *pman, MailFontPrefs *prefs)
|
||||
{
|
||||
if (prefs->control)
|
||||
evolution_config_control_changed (prefs->control);
|
||||
}
|
||||
|
||||
static void
|
||||
mail_font_prefs_destroy (GtkObject *object)
|
||||
{
|
||||
MailFontPrefs *prefs = (MailFontPrefs *) object;
|
||||
|
||||
if (prefs->pman) {
|
||||
g_object_unref(prefs->pman);
|
||||
g_object_unref(prefs->gui);
|
||||
prefs->pman = NULL;
|
||||
}
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->finalize)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
mail_font_prefs_init (MailFontPrefs *prefs)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
GladeXML *gui;
|
||||
|
||||
gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "font_tab", NULL);
|
||||
prefs->gui = gui;
|
||||
|
||||
prefs->pman = GTK_HTML_PROPMANAGER (gtk_html_propmanager_new (NULL));
|
||||
gtk_html_propmanager_set_gui (prefs->pman, gui, NULL);
|
||||
g_object_ref(prefs->pman);
|
||||
gtk_object_sink (GTK_OBJECT (prefs->pman));
|
||||
|
||||
g_signal_connect(prefs->pman, "changed", font_prefs_changed, prefs);
|
||||
|
||||
/* get our toplevel widget */
|
||||
toplevel = glade_xml_get_widget (gui, "toplevel");
|
||||
|
||||
/* reparent */
|
||||
g_object_ref (toplevel);
|
||||
gtk_container_remove (GTK_CONTAINER (toplevel->parent), toplevel);
|
||||
gtk_container_add (GTK_CONTAINER (prefs), toplevel);
|
||||
g_object_unref (toplevel);
|
||||
}
|
||||
|
||||
static void
|
||||
mail_font_prefs_class_init (MailFontPrefsClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
parent_class = g_type_class_ref(gtk_vbox_get_type ());
|
||||
|
||||
object_class->destroy = mail_font_prefs_destroy;
|
||||
}
|
||||
|
||||
GtkType
|
||||
mail_font_prefs_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type) {
|
||||
GTypeInfo type_info = {
|
||||
sizeof (MailFontPrefsClass),
|
||||
NULL, NULL,
|
||||
(GClassInitFunc) mail_font_prefs_class_init,
|
||||
NULL, NULL,
|
||||
sizeof (MailFontPrefs),
|
||||
0,
|
||||
(GInstanceInitFunc) mail_font_prefs_init,
|
||||
};
|
||||
|
||||
type = g_type_register_static (gtk_vbox_get_type (), "MailFontPrefs", &type_info, 0);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
66
mail/mail-font-prefs.h
Normal file
66
mail/mail-font-prefs.h
Normal file
@ -0,0 +1,66 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Authors: Jeffrey Stedfast <fejj@ximian.com>
|
||||
*
|
||||
* Copyright 2002 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
#ifndef __MAIL_FONT_PREFS_H__
|
||||
#define __MAIL_FONT_PREFS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#pragma }
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtkhtml/gtkhtml-propmanager.h>
|
||||
|
||||
#include <shell/Evolution.h>
|
||||
#include "evolution-config-control.h"
|
||||
|
||||
#define MAIL_FONT_PREFS_TYPE (mail_font_prefs_get_type())
|
||||
#define MAIL_FONT_PREFS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MAIL_FONT_PREFS_TYPE, MailFontPrefs))
|
||||
#define MAIL_FONT_PREFS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), MAIL_FONT_PREFS_TYPE, MailFontPrefsClass))
|
||||
#define IS_MAIL_FONT_PREFS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MAIL_FONT_PREFS_TYPE))
|
||||
#define IS_MAIL_FONT_PREFS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MAIL_FONT_PREFS_TYPE))
|
||||
|
||||
typedef struct _MailFontPrefs MailFontPrefs;
|
||||
typedef struct _MailFontPrefsClass MailFontPrefsClass;
|
||||
|
||||
struct _MailFontPrefs {
|
||||
GtkVBox parent_object;
|
||||
|
||||
GtkHTMLPropmanager *pman;
|
||||
GladeXML *gui;
|
||||
EvolutionConfigControl *control;
|
||||
};
|
||||
|
||||
struct _MailFontPrefsClass {
|
||||
GtkVBoxClass parent_object;
|
||||
};
|
||||
|
||||
GtkType mail_font_prefs_get_type (void);
|
||||
GtkWidget * mail_font_prefs_new (void);
|
||||
void mail_font_prefs_apply (MailFontPrefs *prefs);
|
||||
|
||||
#define MAIL_FONT_PREFS_CONTROL_ID "OAFIID:GNOME_Evolution_Mail_FontPrefs_ConfigControl"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __MAIL_FONT_PREFS_H__ */
|
2131
mail/mail-format.c
Normal file
2131
mail/mail-format.c
Normal file
File diff suppressed because it is too large
Load Diff
71
mail/mail-format.h
Normal file
71
mail/mail-format.h
Normal file
@ -0,0 +1,71 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Authors: Jeffrey Stedfast <fejj@ximian.com>
|
||||
*
|
||||
* Copyright 2003 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __MAIL_FORMAT_H__
|
||||
#define __MAIL_FORMAT_H__
|
||||
|
||||
#include <camel/camel.h>
|
||||
#include <gtkhtml/gtkhtml.h>
|
||||
|
||||
#include "mail-display.h"
|
||||
#include "mail-display-stream.h"
|
||||
|
||||
GByteArray *mail_format_get_data_wrapper_text (CamelDataWrapper *data,
|
||||
MailDisplay *mail_display);
|
||||
|
||||
ssize_t mail_format_data_wrapper_write_to_stream (CamelDataWrapper *wrapper,
|
||||
gboolean decode,
|
||||
MailDisplay *mail_display,
|
||||
CamelStream *stream);
|
||||
|
||||
void mail_format_mime_message (CamelMimeMessage *mime_message,
|
||||
MailDisplay *md, MailDisplayStream *stream);
|
||||
void mail_format_raw_message (CamelMimeMessage *mime_message,
|
||||
MailDisplay *md, MailDisplayStream *stream);
|
||||
|
||||
gboolean mail_content_loaded (CamelDataWrapper *wrapper,
|
||||
MailDisplay *display,
|
||||
gboolean redisplay,
|
||||
const char *url,
|
||||
GtkHTML *html,
|
||||
GtkHTMLStream *handle);
|
||||
|
||||
typedef gboolean (*MailMimeHandlerFn) (CamelMimePart *part, const char *mime_type,
|
||||
MailDisplay *md, MailDisplayStream *stream);
|
||||
typedef struct {
|
||||
Bonobo_ServerInfo *component;
|
||||
GList *applications;
|
||||
MailMimeHandlerFn builtin;
|
||||
guint generic : 1;
|
||||
guint is_bonobo : 1;
|
||||
} MailMimeHandler;
|
||||
|
||||
MailMimeHandler *mail_lookup_handler (const char *mime_type);
|
||||
|
||||
gboolean mail_part_is_inline (CamelMimePart *part);
|
||||
gboolean mail_part_is_displayed_inline (CamelMimePart *part, MailDisplay *md);
|
||||
void mail_part_toggle_displayed (CamelMimePart *part, MailDisplay *md);
|
||||
|
||||
char *mail_get_message_body (CamelDataWrapper *data, gboolean want_plain, gboolean cite);
|
||||
|
||||
#endif /* __MAIL_FORMAT_H__ */
|
130
mail/mail-identify.c
Normal file
130
mail/mail-identify.c
Normal file
@ -0,0 +1,130 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
|
||||
/*
|
||||
* Author :
|
||||
* Dan Winship <danw@ximian.com>
|
||||
*
|
||||
* Copyright 2000, Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <libgnomevfs/gnome-vfs-utils.h>
|
||||
#include <libgnomevfs/gnome-vfs-mime.h>
|
||||
#include <libgnomevfs/gnome-vfs-mime-utils.h>
|
||||
#include "mail.h"
|
||||
|
||||
static const char *identify_by_magic (CamelDataWrapper *data, MailDisplay *md);
|
||||
|
||||
/**
|
||||
* mail_identify_mime_part:
|
||||
* @part: a CamelMimePart
|
||||
* @md: the MailDisplay @part is being shown in
|
||||
*
|
||||
* Try to identify the MIME type of the data in @part (which presumably
|
||||
* doesn't have a useful Content-Type).
|
||||
*
|
||||
* Return value: the MIME type, which the caller must free, or %NULL
|
||||
* if it could not be identified.
|
||||
**/
|
||||
char *
|
||||
mail_identify_mime_part (CamelMimePart *part, MailDisplay *md)
|
||||
{
|
||||
const char *filename, *name_type = NULL, *magic_type = NULL;
|
||||
CamelDataWrapper *data;
|
||||
|
||||
filename = camel_mime_part_get_filename (part);
|
||||
if (filename) {
|
||||
/* GNOME-VFS will misidentify TNEF attachments as MPEG */
|
||||
if (!strcmp (filename, "winmail.dat"))
|
||||
return g_strdup ("application/vnd.ms-tnef");
|
||||
|
||||
name_type = gnome_vfs_mime_type_from_name (filename);
|
||||
}
|
||||
|
||||
data = camel_medium_get_content_object (CAMEL_MEDIUM (part));
|
||||
if (!camel_data_wrapper_is_offline (data))
|
||||
magic_type = identify_by_magic (data, md);
|
||||
|
||||
if (magic_type && name_type) {
|
||||
/* If GNOME-VFS doesn't recognize the data by magic, but it
|
||||
* contains English words, it will call it text/plain. If the
|
||||
* filename-based check came up with something different, use
|
||||
* that instead.
|
||||
*/
|
||||
if (!strcmp (magic_type, "text/plain"))
|
||||
return g_strdup (name_type);
|
||||
|
||||
/* If if returns "application/octet-stream" try to
|
||||
* do better with the filename check.
|
||||
*/
|
||||
if (!strcmp (magic_type, "application/octet-stream"))
|
||||
return g_strdup (name_type);
|
||||
}
|
||||
|
||||
/* If the MIME part data was online, and the magic check
|
||||
* returned something, use that, since it's more reliable.
|
||||
*/
|
||||
if (magic_type)
|
||||
return g_strdup (magic_type);
|
||||
|
||||
/* Otherwise try guessing based on the filename */
|
||||
if (name_type)
|
||||
return g_strdup (name_type);
|
||||
|
||||
/* Another possibility to try is the x-mac-type / x-mac-creator
|
||||
* parameter to Content-Type used by some Mac email clients. That
|
||||
* would require a Mac type to mime type conversion table.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
/* If the data part is offline, then we didn't try magic
|
||||
* before, so force it to be loaded so we can try again later.
|
||||
* FIXME: In a perfect world, we would not load the content
|
||||
* just to identify the MIME type.
|
||||
*/
|
||||
/* This is disabled as it just frustrates users more than it helps,
|
||||
see discussion in bug #11778 */
|
||||
if (camel_data_wrapper_is_offline (data))
|
||||
mail_content_loaded (data, md, TRUE, NULL, NULL, NULL);
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
identify_by_magic (CamelDataWrapper *data, MailDisplay *md)
|
||||
{
|
||||
CamelStreamMem *memstream;
|
||||
const char *type;
|
||||
|
||||
memstream = (CamelStreamMem *)camel_stream_mem_new();
|
||||
if (camel_data_wrapper_write_to_stream (data, (CamelStream *)memstream) > 0)
|
||||
type = gnome_vfs_get_mime_type_for_data(memstream->buffer->data, memstream->buffer->len);
|
||||
else
|
||||
type = NULL;
|
||||
camel_object_unref(memstream);
|
||||
|
||||
return type;
|
||||
}
|
@ -36,12 +36,12 @@
|
||||
#include <camel/camel-exception.h>
|
||||
#include <e-util/e-path.h>
|
||||
|
||||
#include "mail-component.h"
|
||||
#include "mail-importer.h"
|
||||
#include "mail-local.h"
|
||||
#include "mail.h"
|
||||
|
||||
static GList *importer_modules = NULL;
|
||||
extern char *evolution_dir;
|
||||
static GNOME_Evolution_Storage local_storage = NULL;
|
||||
|
||||
void mail_importer_uninit (void);
|
||||
@ -95,7 +95,8 @@ mail_importer_make_local_folder(const char *folderpath)
|
||||
} else {
|
||||
struct _create_data data = { GNOME_Evolution_Storage_GENERIC_ERROR, FALSE };
|
||||
|
||||
tmp = g_strdup_printf("file://%s/local", evolution_dir);
|
||||
tmp = g_strdup_printf("file://%s/local",
|
||||
mail_component_peek_base_directory (mail_component_peek ()));
|
||||
uri = e_path_to_physical(tmp, folderpath);
|
||||
g_free(tmp);
|
||||
tmp = strrchr(uri, '/');
|
||||
|
@ -533,10 +533,11 @@ mlf_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
|
||||
/* CamelObject args */
|
||||
case CAMEL_OBJECT_ARG_DESCRIPTION:
|
||||
if (mlf->description == NULL) {
|
||||
const char *base_directory = mail_component_peek_base_directory (mail_component_peek ());
|
||||
int pathlen;
|
||||
|
||||
/* string to describe a local folder as the location of a message */
|
||||
pathlen = strlen(evolution_dir) + strlen("local") + 1;
|
||||
pathlen = strlen(base_directory) + strlen("local") + 1;
|
||||
if (strlen(folder->full_name) > pathlen)
|
||||
mlf->description = g_strdup_printf(_("Local folders/%s"), folder->full_name+pathlen);
|
||||
else
|
||||
|
@ -28,8 +28,6 @@
|
||||
#include "mail-session.h"
|
||||
#include "mail-mt.h"
|
||||
|
||||
#include "component-factory.h"
|
||||
|
||||
/*#define MALLOC_CHECK*/
|
||||
#define LOG_OPS
|
||||
#define LOG_LOCKS
|
||||
@ -911,10 +909,11 @@ static void do_op_status(struct _mail_msg *mm)
|
||||
what = msg->ops->describe_msg (msg, FALSE);
|
||||
else
|
||||
what = _("Working");
|
||||
|
||||
|
||||
/* EPFIXME: redo activity client stuff. */
|
||||
if (global_shell_client) {
|
||||
activity = evolution_activity_client_new (global_shell_client,
|
||||
COMPONENT_ID,
|
||||
"evolution-mail",
|
||||
progress_icon, what, TRUE,
|
||||
&display);
|
||||
} else {
|
||||
|
@ -27,9 +27,10 @@
|
||||
#endif
|
||||
|
||||
#include "mail-offline-handler.h"
|
||||
#include "mail.h"
|
||||
#include "mail-component.h"
|
||||
#include "mail-ops.h"
|
||||
#include "mail-folder-cache.h"
|
||||
#include "mail.h"
|
||||
|
||||
#include <gtk/gtkmain.h>
|
||||
|
||||
@ -77,10 +78,10 @@ create_connection_list (void)
|
||||
|
||||
list = GNOME_Evolution_ConnectionList__alloc ();
|
||||
list->_length = 0;
|
||||
list->_maximum = mail_storages_count ();
|
||||
list->_maximum = mail_component_get_storage_count (mail_component_peek ());
|
||||
list->_buffer = CORBA_sequence_GNOME_Evolution_Connection_allocbuf (list->_maximum);
|
||||
|
||||
mail_storages_foreach (add_connection, list);
|
||||
mail_component_storages_foreach (mail_component_peek (), add_connection, list);
|
||||
|
||||
return list;
|
||||
}
|
||||
@ -260,7 +261,7 @@ impl_goOffline (PortableServer_Servant servant,
|
||||
|
||||
/* FIXME: If send/receive active, wait for it to finish */
|
||||
|
||||
mail_storages_foreach (storage_go_offline, progress_listener);
|
||||
mail_component_storages_foreach (mail_component_peek (), storage_go_offline, progress_listener);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -270,8 +271,7 @@ storage_go_online (gpointer key, gpointer value, gpointer data)
|
||||
|
||||
if (service_is_relevant (CAMEL_SERVICE (store), FALSE)) {
|
||||
mail_store_set_offline (store, FALSE, NULL, NULL);
|
||||
mail_note_store (store, NULL, NULL, CORBA_OBJECT_NIL,
|
||||
NULL, NULL);
|
||||
mail_note_store (store, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -288,7 +288,7 @@ impl_goOnline (PortableServer_Servant servant,
|
||||
/* Enable auto-mail-checking */
|
||||
camel_session_set_online (session, TRUE);
|
||||
|
||||
mail_storages_foreach (storage_go_online, NULL);
|
||||
mail_component_storages_foreach (mail_component_peek (), storage_go_online, NULL);
|
||||
}
|
||||
|
||||
/* GObject methods. */
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <camel/camel-vtrash-folder.h>
|
||||
#include <camel/camel-vee-store.h>
|
||||
#include "mail.h"
|
||||
#include "mail-component.h"
|
||||
#include "mail-tools.h"
|
||||
#include "mail-ops.h"
|
||||
#include "mail-vfolder.h"
|
||||
@ -229,7 +230,8 @@ uid_cachename_hack (CamelStore *store)
|
||||
url->host);
|
||||
e_filename_make_safe (encoded_url);
|
||||
|
||||
filename = g_strdup_printf ("%s/mail/pop3/cache-%s", evolution_dir, encoded_url);
|
||||
filename = g_strdup_printf ("%s/mail/pop3/cache-%s",
|
||||
mail_component_peek_base_directory (mail_component_peek ()), encoded_url);
|
||||
|
||||
/* lame hack, but we can't expect user's to actually migrate
|
||||
their cache files - brain power requirements are too
|
||||
@ -238,7 +240,9 @@ uid_cachename_hack (CamelStore *store)
|
||||
/* This is either the first time the user has checked
|
||||
mail with this POP provider or else their cache
|
||||
file is in the old location... */
|
||||
old_location = g_strdup_printf ("%s/config/cache-%s", evolution_dir, encoded_url);
|
||||
old_location = g_strdup_printf ("%s/config/cache-%s",
|
||||
mail_component_peek_base_directory (mail_component_peek ()),
|
||||
encoded_url);
|
||||
if (stat (old_location, &st) == -1) {
|
||||
/* old location doesn't exist either so use the new location */
|
||||
g_free (old_location);
|
||||
|
403
mail/mail-search.c
Normal file
403
mail/mail-search.c
Normal file
@ -0,0 +1,403 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Authors: Jon Trowbridge <trow@ximian.com>
|
||||
*
|
||||
* Copyright 2001-2003 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "mail-search.h"
|
||||
#include "e-searching-tokenizer.h"
|
||||
#include <gtkhtml/gtkhtml-search.h>
|
||||
#include <gtkhtml/htmlengine.h>
|
||||
#include <libgnomeui/gnome-window-icon.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
|
||||
static ESearchingTokenizer *mail_search_tokenizer (MailSearch *ms);
|
||||
static void mail_search_redisplay_message (MailSearch *ms);
|
||||
|
||||
|
||||
static GtkObjectClass *parent_class = NULL;
|
||||
|
||||
|
||||
static void
|
||||
mail_search_finalise (GObject *obj)
|
||||
{
|
||||
MailSearch *ms = MAIL_SEARCH (obj);
|
||||
|
||||
g_free (ms->last_search);
|
||||
g_object_weak_unref ((GObject *) ms->mail, (GWeakNotify) gtk_widget_destroy, ms);
|
||||
g_object_unref (ms->mail);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
static void
|
||||
mail_search_destroy (GtkObject *obj)
|
||||
{
|
||||
MailSearch *ms = (MailSearch *) obj;
|
||||
ESearchingTokenizer *st = mail_search_tokenizer (ms);
|
||||
|
||||
if (ms->begin_handler) {
|
||||
g_signal_handler_disconnect (ms->mail->html->engine->ht, ms->begin_handler);
|
||||
ms->begin_handler = 0;
|
||||
g_signal_handler_disconnect (ms->mail->html->engine->ht, ms->match_handler);
|
||||
ms->match_handler = 0;
|
||||
|
||||
e_searching_tokenizer_set_primary_search_string (st, NULL);
|
||||
mail_search_redisplay_message (ms);
|
||||
}
|
||||
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (obj);
|
||||
}
|
||||
|
||||
static void
|
||||
mail_search_class_init (MailSearchClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = (GObjectClass *) klass;
|
||||
GtkObjectClass *gtk_object_class = (GtkObjectClass *) klass;
|
||||
|
||||
parent_class = (GtkObjectClass *) g_type_class_ref (GTK_TYPE_DIALOG);
|
||||
|
||||
object_class->finalize = mail_search_finalise;
|
||||
|
||||
gtk_object_class->destroy = mail_search_destroy;
|
||||
}
|
||||
|
||||
static void
|
||||
mail_search_init (MailSearch *ms)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GtkType
|
||||
mail_search_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type) {
|
||||
static const GTypeInfo info = {
|
||||
sizeof (MailSearchClass),
|
||||
NULL, NULL,
|
||||
(GClassInitFunc) mail_search_class_init,
|
||||
NULL, NULL,
|
||||
sizeof (MailSearch),
|
||||
0,
|
||||
(GInstanceInitFunc) mail_search_init,
|
||||
};
|
||||
|
||||
type = g_type_register_static (GTK_TYPE_DIALOG, "MailSearch", &info, 0);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convenience
|
||||
*/
|
||||
|
||||
static ESearchingTokenizer *
|
||||
mail_search_tokenizer (MailSearch *ms)
|
||||
{
|
||||
return E_SEARCHING_TOKENIZER (ms->mail->html->engine->ht);
|
||||
}
|
||||
|
||||
static void
|
||||
mail_search_redisplay_message (MailSearch *ms)
|
||||
{
|
||||
mail_display_redisplay (ms->mail, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
mail_search_set_subject (MailSearch *ms, const char *subject)
|
||||
{
|
||||
char *utf8_subject = NULL;
|
||||
|
||||
if (subject && *subject) {
|
||||
utf8_subject = g_strdup (subject);
|
||||
|
||||
if (g_utf8_validate (utf8_subject, -1, NULL)) {
|
||||
#define ARBITRARY_CUTOFF 40
|
||||
if (g_utf8_strlen (utf8_subject, -1) > ARBITRARY_CUTOFF + 3) {
|
||||
char *p = g_utf8_offset_to_pointer (utf8_subject, ARBITRARY_CUTOFF);
|
||||
|
||||
strcpy (p, "...");
|
||||
}
|
||||
} else {
|
||||
/* If the subject contains bad utf8, don't show anything in the frame label. */
|
||||
g_free (utf8_subject);
|
||||
utf8_subject = NULL;
|
||||
}
|
||||
} else {
|
||||
utf8_subject = g_strdup (_("(Untitled Message)"));
|
||||
}
|
||||
|
||||
gtk_frame_set_label (GTK_FRAME (ms->msg_frame), utf8_subject);
|
||||
|
||||
g_free (utf8_subject);
|
||||
}
|
||||
|
||||
/*
|
||||
* Construct Objects
|
||||
*/
|
||||
|
||||
static void
|
||||
toggled_case_cb (GtkToggleButton *b, MailSearch *ms)
|
||||
{
|
||||
ms->case_sensitive = gtk_toggle_button_get_active (b);
|
||||
|
||||
e_searching_tokenizer_set_primary_case_sensitivity (mail_search_tokenizer (ms),
|
||||
ms->case_sensitive);
|
||||
mail_search_redisplay_message (ms);
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
toggled_fwd_cb (GtkToggleButton *b, MailSearch *ms)
|
||||
{
|
||||
ms->search_forward = gtk_toggle_button_get_active (b);
|
||||
gtk_html_engine_search_set_forward (ms->mail->html, ms->search_forward);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
dialog_response_cb (GtkWidget *widget, int button, MailSearch *ms)
|
||||
{
|
||||
ESearchingTokenizer *st = mail_search_tokenizer (ms);
|
||||
|
||||
if (button == GTK_RESPONSE_ACCEPT) {
|
||||
char *search_text;
|
||||
|
||||
search_text = gtk_editable_get_chars (GTK_EDITABLE (ms->entry), 0, -1);
|
||||
g_strstrip (search_text);
|
||||
|
||||
if (search_text && *search_text) {
|
||||
if (ms->last_search && !strcmp (ms->last_search, search_text)) {
|
||||
|
||||
if (!gtk_html_engine_search_next (ms->mail->html)) {
|
||||
g_free (ms->last_search);
|
||||
ms->last_search = NULL;
|
||||
}
|
||||
} else {
|
||||
g_free (ms->last_search);
|
||||
ms->last_search = NULL;
|
||||
|
||||
e_searching_tokenizer_set_primary_search_string (st, search_text);
|
||||
e_searching_tokenizer_set_primary_case_sensitivity (st, ms->case_sensitive);
|
||||
|
||||
mail_search_redisplay_message (ms);
|
||||
|
||||
if (gtk_html_engine_search (ms->mail->html, search_text,
|
||||
ms->case_sensitive, ms->search_forward,
|
||||
FALSE)) {
|
||||
ms->last_search = g_strdup (search_text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_free (search_text);
|
||||
} else if (button == GTK_RESPONSE_CLOSE) {
|
||||
gtk_widget_destroy (widget);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
begin_cb (ESearchingTokenizer *st, char *foo, MailSearch *ms)
|
||||
{
|
||||
const char *subject;
|
||||
|
||||
if (ms && ms->mail && ms->mail->current_message) {
|
||||
subject = ms->mail->current_message->subject;
|
||||
|
||||
if (subject == NULL)
|
||||
subject = _("Untitled Message");
|
||||
} else {
|
||||
subject = _("Empty Message");
|
||||
}
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (ms->count_label), "0");
|
||||
mail_search_set_subject (ms, subject);
|
||||
}
|
||||
|
||||
static void
|
||||
match_cb (ESearchingTokenizer *st, MailSearch *ms)
|
||||
{
|
||||
char buf[16];
|
||||
|
||||
g_snprintf (buf, 16, "%d", e_searching_tokenizer_match_count (st));
|
||||
gtk_label_set_text (GTK_LABEL (ms->count_label), buf);
|
||||
}
|
||||
|
||||
static void
|
||||
entry_run_search (GtkWidget *w, MailSearch *ms)
|
||||
{
|
||||
/* run search when enter pressed on widget */
|
||||
gtk_dialog_response ((GtkDialog *) ms, GTK_RESPONSE_ACCEPT);
|
||||
}
|
||||
|
||||
void
|
||||
mail_search_construct (MailSearch *ms, MailDisplay *mail)
|
||||
{
|
||||
GtkWidget *find_hbox;
|
||||
GtkWidget *matches_hbox;
|
||||
GtkWidget *toggles_hbox;
|
||||
GtkWidget *frame_vbox;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *count_label;
|
||||
GtkWidget *case_check;
|
||||
#if 0
|
||||
GtkWidget *fwd_check;
|
||||
#endif
|
||||
GtkWidget *button;
|
||||
GtkWidget *msg_hbox;
|
||||
GtkWidget *msg_frame;
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
g_return_if_fail (ms != NULL && IS_MAIL_SEARCH (ms));
|
||||
g_return_if_fail (mail != NULL && IS_MAIL_DISPLAY (mail));
|
||||
|
||||
/* Basic set-up */
|
||||
|
||||
ms->mail = mail;
|
||||
g_object_ref (mail);
|
||||
|
||||
gtk_window_set_title ((GtkWindow *) ms, _("Find in Message"));
|
||||
|
||||
button = gtk_dialog_add_button ((GtkDialog *) ms, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
|
||||
gtk_dialog_set_default_response ((GtkDialog *) ms, GTK_RESPONSE_ACCEPT);
|
||||
accel_group = gtk_accel_group_new ();
|
||||
gtk_window_add_accel_group (GTK_WINDOW (ms), accel_group);
|
||||
gtk_widget_add_accelerator (button, "activate", accel_group, GDK_Escape, 0, GTK_ACCEL_LOCKED);
|
||||
|
||||
gtk_dialog_add_button ((GtkDialog *) ms, GTK_STOCK_FIND, GTK_RESPONSE_ACCEPT);
|
||||
|
||||
ms->search_forward = TRUE;
|
||||
ms->case_sensitive = FALSE;
|
||||
|
||||
ms->begin_handler = g_signal_connect (ms->mail->html->engine->ht, "begin",
|
||||
G_CALLBACK (begin_cb), ms);
|
||||
ms->match_handler = g_signal_connect (ms->mail->html->engine->ht, "match",
|
||||
G_CALLBACK (match_cb), ms);
|
||||
|
||||
/* Construct the dialog contents. */
|
||||
|
||||
msg_hbox = gtk_hbox_new (FALSE, 3);
|
||||
find_hbox = gtk_hbox_new (FALSE, 3);
|
||||
matches_hbox = gtk_hbox_new (FALSE, 3);
|
||||
toggles_hbox = gtk_hbox_new (FALSE, 3);
|
||||
frame_vbox = gtk_vbox_new (FALSE, 3);
|
||||
gtk_container_set_border_width ((GtkContainer *) frame_vbox, 3);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
count_label = gtk_label_new ("0");
|
||||
|
||||
msg_frame = gtk_frame_new (NULL);
|
||||
gtk_container_set_border_width ((GtkContainer *) msg_frame, 6);
|
||||
|
||||
case_check = gtk_check_button_new_with_label (_("Case Sensitive"));
|
||||
#if 0
|
||||
fwd_check = gtk_check_button_new_with_label (_("Search Forward"));
|
||||
#endif
|
||||
|
||||
ms->entry = entry;
|
||||
ms->count_label = count_label;
|
||||
|
||||
ms->msg_frame = msg_frame;
|
||||
|
||||
if (mail->current_message->subject && *mail->current_message->subject)
|
||||
mail_search_set_subject (ms, mail->current_message->subject);
|
||||
else
|
||||
mail_search_set_subject (ms, NULL);
|
||||
|
||||
#if 0
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fwd_check), ms->search_forward);
|
||||
#endif
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (case_check), ms->case_sensitive);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (msg_hbox), GTK_WIDGET (msg_frame), TRUE, TRUE, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (find_hbox), gtk_label_new (_("Find:")), FALSE, FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (find_hbox), entry, TRUE, TRUE, 3);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (matches_hbox), gtk_hbox_new (FALSE, 0), TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (matches_hbox), gtk_label_new (_("Matches:")), FALSE, FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (matches_hbox), count_label, FALSE, FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (matches_hbox), gtk_hbox_new (FALSE, 0), TRUE, TRUE, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (toggles_hbox), case_check, FALSE, FALSE, 3);
|
||||
|
||||
/*
|
||||
* Disabling the forward/backward search button because there are problems with it
|
||||
* (related to how gtkhtml handles searches), the GUI freeze is upon us, and I
|
||||
* don't know if they'll get resolved for 1.0. Hopefully getting this fixed can
|
||||
* be a 1.1 item.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
gtk_box_pack_start (GTK_BOX (toggles_hbox), fwd_check, FALSE, FALSE, 3);
|
||||
#endif
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (frame_vbox), find_hbox, FALSE, FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (frame_vbox), matches_hbox, FALSE, FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (frame_vbox), toggles_hbox, FALSE, FALSE, 3);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (msg_frame), GTK_WIDGET (frame_vbox));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (ms)->vbox), msg_hbox, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_grab_focus (entry); /* Give focus to entry by default */
|
||||
g_signal_connect (entry, "activate", G_CALLBACK (entry_run_search), ms);
|
||||
gnome_window_icon_set_from_file (GTK_WINDOW (ms), EVOLUTION_ICONSDIR "/find-message.xpm");
|
||||
|
||||
gtk_widget_show_all (msg_hbox);
|
||||
gtk_widget_show_all (find_hbox);
|
||||
gtk_widget_show_all (matches_hbox);
|
||||
gtk_widget_show_all (toggles_hbox);
|
||||
|
||||
/* Hook up signals */
|
||||
|
||||
g_signal_connect (case_check, "toggled", G_CALLBACK (toggled_case_cb), ms);
|
||||
#if 0
|
||||
g_signal_connect (fwd_check, "toggled", G_CALLBACK (toggled_fwd_cb), ms);
|
||||
#endif
|
||||
g_signal_connect (ms, "response", G_CALLBACK (dialog_response_cb), ms);
|
||||
|
||||
g_object_weak_ref ((GObject *) ms->mail, (GWeakNotify) gtk_widget_destroy, ms);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
mail_search_new (MailDisplay *mail)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
g_return_val_if_fail (IS_MAIL_DISPLAY (mail), NULL);
|
||||
|
||||
widget = g_object_new (mail_search_get_type (), NULL);
|
||||
mail_search_construct (MAIL_SEARCH (widget), mail);
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
75
mail/mail-search.h
Normal file
75
mail/mail-search.h
Normal file
@ -0,0 +1,75 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Authors: Jon Trowbridge <trow@ximian.com>
|
||||
*
|
||||
* Copyright 2001-2003 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _MAIL_SEARCH_H_
|
||||
#define _MAIL_SEARCH_H_
|
||||
|
||||
#ifdef _cplusplus
|
||||
extern "C" {
|
||||
#pragma }
|
||||
#endif /* _cplusplus */
|
||||
|
||||
#include <gtk/gtkdialog.h>
|
||||
#include "mail-display.h"
|
||||
|
||||
#define MAIL_SEARCH_TYPE (mail_search_get_type ())
|
||||
#define MAIL_SEARCH(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MAIL_SEARCH_TYPE, MailSearch))
|
||||
#define MAIL_SEARCH_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), MAIL_SEARCH_TYPE, MailSearch))
|
||||
#define IS_MAIL_SEARCH(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MAIL_SEARCH_TYPE))
|
||||
#define IS_MAIL_SEARCH_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MAIL_SEARCH_TYPE))
|
||||
|
||||
typedef struct _MailSearch MailSearch;
|
||||
typedef struct _MailSearchClass MailSearchClass;
|
||||
|
||||
struct _MailSearch {
|
||||
GtkDialog parent;
|
||||
|
||||
MailDisplay *mail;
|
||||
|
||||
GtkWidget *entry;
|
||||
GtkWidget *msg_frame;
|
||||
GtkWidget *count_label;
|
||||
|
||||
gboolean search_forward, case_sensitive;
|
||||
char *last_search;
|
||||
|
||||
guint begin_handler;
|
||||
guint match_handler;
|
||||
};
|
||||
|
||||
struct _MailSearchClass {
|
||||
GtkDialogClass parent_class;
|
||||
|
||||
};
|
||||
|
||||
GtkType mail_search_get_type (void);
|
||||
|
||||
void mail_search_construct (MailSearch *, MailDisplay *);
|
||||
GtkWidget *mail_search_new (MailDisplay *);
|
||||
|
||||
|
||||
#ifdef _cplusplus
|
||||
}
|
||||
#endif /* _cplusplus */
|
||||
|
||||
#endif /* _MAIL_SEARCH_H_ */
|
@ -46,6 +46,7 @@
|
||||
|
||||
#include "mail.h"
|
||||
#include "mail-mt.h"
|
||||
#include "mail-component.h"
|
||||
#include "mail-config.h"
|
||||
#include "mail-session.h"
|
||||
#include "mail-tools.h"
|
||||
@ -167,7 +168,7 @@ static void free_send_info(void *key, struct _send_info *info, void *data)
|
||||
g_free(info->uri);
|
||||
camel_operation_unref(info->cancel);
|
||||
if (info->timeout_id != 0)
|
||||
gtk_timeout_remove(info->timeout_id);
|
||||
g_source_remove(info->timeout_id);
|
||||
g_free(info->what);
|
||||
g_free(info);
|
||||
}
|
||||
@ -207,7 +208,7 @@ static void hide_send_info(void *key, struct _send_info *info, void *data)
|
||||
info->status = NULL;
|
||||
|
||||
if (info->timeout_id != 0) {
|
||||
gtk_timeout_remove (info->timeout_id);
|
||||
g_source_remove (info->timeout_id);
|
||||
info->timeout_id = 0;
|
||||
}
|
||||
}
|
||||
@ -366,7 +367,7 @@ build_dialogue (EAccountList *accounts, CamelFolder *outbox, const char *destina
|
||||
info->keep = source->keep_on_server;
|
||||
info->cancel = camel_operation_new (operation_status, info);
|
||||
info->state = SEND_ACTIVE;
|
||||
info->timeout_id = gtk_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
|
||||
info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
|
||||
|
||||
g_hash_table_insert (data->active, info->uri, info);
|
||||
list = g_list_prepend (list, info);
|
||||
@ -375,7 +376,7 @@ build_dialogue (EAccountList *accounts, CamelFolder *outbox, const char *destina
|
||||
e_iterator_next (iter);
|
||||
continue;
|
||||
} else if (info->timeout_id == 0)
|
||||
info->timeout_id = gtk_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
|
||||
info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
|
||||
|
||||
recv_icon = gtk_image_new_from_file (EVOLUTION_BUTTONSDIR "/receive-24.png");
|
||||
|
||||
@ -423,12 +424,12 @@ build_dialogue (EAccountList *accounts, CamelFolder *outbox, const char *destina
|
||||
info->keep = FALSE;
|
||||
info->cancel = camel_operation_new (operation_status, info);
|
||||
info->state = SEND_ACTIVE;
|
||||
info->timeout_id = gtk_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
|
||||
info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
|
||||
|
||||
g_hash_table_insert (data->active, SEND_URI_KEY, info);
|
||||
list = g_list_prepend (list, info);
|
||||
} else if (info->timeout_id == 0)
|
||||
info->timeout_id = gtk_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
|
||||
info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
|
||||
|
||||
send_icon = gtk_image_new_from_file (EVOLUTION_BUTTONSDIR "/send-24.png");
|
||||
|
||||
@ -663,10 +664,10 @@ receive_update_got_store (char *uri, CamelStore *store, void *data)
|
||||
struct _send_info *info = data;
|
||||
|
||||
if (store) {
|
||||
EvolutionStorage *storage = mail_lookup_storage (store);
|
||||
EStorage *storage = mail_component_lookup_storage (mail_component_peek (), store);
|
||||
|
||||
if (storage) {
|
||||
mail_note_store(store, info->cancel, storage, CORBA_OBJECT_NIL, receive_update_done, info);
|
||||
mail_note_store(store, info->cancel, storage, receive_update_done, info);
|
||||
/*bonobo_object_unref (BONOBO_OBJECT (storage));*/
|
||||
} else {
|
||||
/* If we get here, store must be an external
|
||||
@ -770,7 +771,7 @@ static void auto_clean_set(void *key, struct _auto_data *info, GHashTable *set)
|
||||
{
|
||||
d(printf("removing auto-check for %s %p\n", info->uri, info));
|
||||
g_hash_table_remove(set, info->uri);
|
||||
gtk_timeout_remove(info->timeout_id);
|
||||
g_source_remove(info->timeout_id);
|
||||
g_free(info->uri);
|
||||
g_free(info);
|
||||
}
|
||||
@ -811,15 +812,15 @@ mail_autoreceive_setup (void)
|
||||
info->keep = source->keep_on_server;
|
||||
if (info->period != source->auto_check_time*60) {
|
||||
info->period = source->auto_check_time*60;
|
||||
gtk_timeout_remove(info->timeout_id);
|
||||
info->timeout_id = gtk_timeout_add(info->period*1000, auto_timeout, info);
|
||||
g_source_remove(info->timeout_id);
|
||||
info->timeout_id = g_timeout_add(info->period*1000, auto_timeout, info);
|
||||
}
|
||||
} else {
|
||||
info = g_malloc0(sizeof(*info));
|
||||
info->uri = g_strdup(source->url);
|
||||
info->keep = source->keep_on_server;
|
||||
info->period = source->auto_check_time*60;
|
||||
info->timeout_id = gtk_timeout_add(info->period*1000, auto_timeout, info);
|
||||
info->timeout_id = g_timeout_add(info->period*1000, auto_timeout, info);
|
||||
g_hash_table_insert(auto_active, info->uri, info);
|
||||
/* If we do this at startup, it can cause the logon dialogue to be hidden,
|
||||
so lets not */
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "filter/filter-context.h"
|
||||
#include "filter/filter-filter.h"
|
||||
#include "mail.h"
|
||||
#include "mail-component.h"
|
||||
#include "mail-config.h"
|
||||
#include "mail-session.h"
|
||||
#include "mail-tools.h"
|
||||
@ -593,7 +594,7 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException
|
||||
|
||||
gconf = mail_config_get_gconf_client ();
|
||||
|
||||
user = g_strdup_printf ("%s/filters.xml", evolution_dir);
|
||||
user = g_strdup_printf ("%s/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
|
||||
system = EVOLUTION_PRIVDATADIR "/filtertypes.xml";
|
||||
fc = (RuleContext *) filter_context_new ();
|
||||
rule_context_load (fc, system, user);
|
||||
@ -743,16 +744,16 @@ mail_session_forget_password (const char *key)
|
||||
}
|
||||
|
||||
void
|
||||
mail_session_init (void)
|
||||
mail_session_init (const char *base_directory)
|
||||
{
|
||||
char *camel_dir;
|
||||
|
||||
if (camel_init (evolution_dir, TRUE) != 0)
|
||||
|
||||
if (camel_init (base_directory, TRUE) != 0)
|
||||
exit (0);
|
||||
|
||||
session = CAMEL_SESSION (camel_object_new (MAIL_SESSION_TYPE));
|
||||
|
||||
camel_dir = g_strdup_printf ("%s/mail", evolution_dir);
|
||||
camel_dir = g_strdup_printf ("%s/mail", base_directory);
|
||||
camel_session_construct (session, camel_dir);
|
||||
|
||||
/* The shell will tell us to go online. */
|
||||
|
@ -32,7 +32,7 @@ extern "C" {
|
||||
#pragma }
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void mail_session_init (void);
|
||||
void mail_session_init (const char *base_directory);
|
||||
gboolean mail_session_get_interactive (void);
|
||||
void mail_session_set_interactive (gboolean interactive);
|
||||
char *mail_session_request_dialog (const char *prompt, gboolean secret,
|
||||
|
@ -395,11 +395,11 @@ mail_signature_editor (MailConfigSignature *sig, GtkWindow *parent, gboolean is_
|
||||
EVOLUTION_UIDIR "/evolution-signature-editor.xml",
|
||||
"evolution-signature-editor", NULL);
|
||||
|
||||
editor->control = bonobo_widget_new_control ("OAFIID:GNOME_GtkHTML_Editor:3.0",
|
||||
editor->control = bonobo_widget_new_control ("OAFIID:GNOME_GtkHTML_Editor:3.1",
|
||||
bonobo_ui_component_get_container (component));
|
||||
|
||||
if (editor->control == NULL) {
|
||||
g_warning ("Cannot get 'OAFIID:GNOME_GtkHTML_Editor:3.0'.");
|
||||
g_warning ("Cannot get 'OAFIID:GNOME_GtkHTML_Editor:3.1'.");
|
||||
|
||||
destroy_editor (editor);
|
||||
return;
|
||||
|
@ -72,7 +72,6 @@ typedef struct {
|
||||
|
||||
static int queue_len = 0;
|
||||
|
||||
extern char *evolution_dir;
|
||||
extern EvolutionStorage *vfolder_storage;
|
||||
|
||||
#define MAIN_READER main_compipe[0]
|
||||
@ -295,7 +294,7 @@ generate_folder_summaries (MailSummary *summary)
|
||||
CamelException *ex;
|
||||
int i;
|
||||
|
||||
user = g_strdup_printf ("%s/vfolders.xml", evolution_dir);
|
||||
user = g_strdup_printf ("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
|
||||
system = EVOLUTION_PRIVDATADIR "/vfoldertypes.xml";
|
||||
|
||||
context = vfolder_context_new ();
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "e-util/e-meta.h"
|
||||
|
||||
#include "mail.h" /*session*/
|
||||
#include "mail-component.h"
|
||||
#include "mail-config.h"
|
||||
#include "mail-vfolder.h"
|
||||
#include "mail-tools.h"
|
||||
@ -62,7 +63,8 @@ mail_tool_get_local_inbox (CamelException *ex)
|
||||
CamelFolder *folder;
|
||||
char *url;
|
||||
|
||||
url = g_strdup_printf("file://%s/local/Inbox", evolution_dir);
|
||||
url = g_strdup_printf("file://%s/local/Inbox",
|
||||
mail_component_peek_base_directory (mail_component_peek ()));
|
||||
folder = mail_tool_uri_to_folder (url, 0, ex);
|
||||
g_free (url);
|
||||
|
||||
@ -120,7 +122,9 @@ mail_tool_get_local_movemail_path (const unsigned char *uri)
|
||||
if (strchr ("/:;=|%&#!*^()\\, ", *c) || !isprint ((int) *c))
|
||||
*c = '_';
|
||||
|
||||
path = g_strdup_printf ("%s/local/Inbox/movemail.%s", evolution_dir, safe_uri);
|
||||
path = g_strdup_printf ("%s/local/Inbox/movemail.%s",
|
||||
mail_component_peek_base_directory (mail_component_peek ()),
|
||||
safe_uri);
|
||||
g_free (safe_uri);
|
||||
|
||||
return path;
|
||||
@ -318,7 +322,7 @@ mail_tool_uri_to_folder (const char *uri, guint32 flags, CamelException *ex)
|
||||
store = camel_session_get_store (session, uri + offset, ex);
|
||||
if (store) {
|
||||
const char *name;
|
||||
|
||||
|
||||
/* if we have a fragment, then the path is actually used by the store,
|
||||
so the fragment is the path to the folder instead */
|
||||
if (url->fragment) {
|
||||
@ -412,6 +416,7 @@ mail_tools_folder_to_url (CamelFolder *folder)
|
||||
|
||||
static char *meta_data_key(const char *uri, char **pathp)
|
||||
{
|
||||
const char *base_directory = mail_component_peek_base_directory (mail_component_peek ());
|
||||
CamelURL *url;
|
||||
GString *path;
|
||||
const char *key;
|
||||
@ -421,12 +426,12 @@ static char *meta_data_key(const char *uri, char **pathp)
|
||||
|
||||
if (url == NULL) {
|
||||
g_warning("Trying to retrieve meta-data for unparsable uri: %s", uri);
|
||||
*pathp = g_build_path(evolution_dir, "meta/unknown", NULL);
|
||||
*pathp = g_build_path(base_directory, "meta/unknown", NULL);
|
||||
|
||||
return g_strdup("folder");
|
||||
}
|
||||
|
||||
path = g_string_new(evolution_dir);
|
||||
path = g_string_new(base_directory);
|
||||
g_string_append_printf(path, "/meta/%s/", url->protocol);
|
||||
|
||||
if (url->host && url->host[0]) {
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "evolution-storage.h"
|
||||
|
||||
#include "evolution-shell-component.h"
|
||||
#include "folder-browser.h"
|
||||
#include "mail-component.h"
|
||||
#include "mail-vfolder.h"
|
||||
#include "mail-tools.h"
|
||||
#include "mail-autofilter.h"
|
||||
@ -64,7 +66,6 @@ static GHashTable *vfolder_hash;
|
||||
extern EvolutionShellClient *global_shell_client;
|
||||
|
||||
/* more globals ... */
|
||||
extern char *evolution_dir;
|
||||
extern CamelSession *session;
|
||||
|
||||
static void rule_changed(FilterRule *rule, CamelFolder *folder);
|
||||
@ -471,7 +472,8 @@ mail_vfolder_delete_uri(CamelStore *store, const char *uri)
|
||||
g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
user = g_strdup_printf ("%s/vfolders.xml", evolution_dir);
|
||||
user = g_strdup_printf ("%s/vfolders.xml",
|
||||
mail_component_peek_base_directory (mail_component_peek ()));
|
||||
rule_context_save ((RuleContext *) context, user);
|
||||
g_free (user);
|
||||
}
|
||||
@ -526,7 +528,7 @@ mail_vfolder_rename_uri(CamelStore *store, const char *from, const char *to)
|
||||
char *user;
|
||||
|
||||
d(printf("Vfolders updated from renamed folder\n"));
|
||||
user = g_strdup_printf("%s/vfolders.xml", evolution_dir);
|
||||
user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
|
||||
rule_context_save((RuleContext *)context, user);
|
||||
g_free(user);
|
||||
}
|
||||
@ -646,7 +648,10 @@ static void context_rule_removed(RuleContext *ctx, FilterRule *rule)
|
||||
/* TODO: remove from folder info cache? */
|
||||
|
||||
path = g_strdup_printf("/%s", rule->name);
|
||||
evolution_storage_removed_folder(mail_lookup_storage(vfolder_store), path);
|
||||
|
||||
/* EPFIXME This leaks, the original code was broken too. */
|
||||
e_storage_removed_folder (mail_component_lookup_storage (mail_component_peek (), vfolder_store), path);
|
||||
|
||||
g_free(path);
|
||||
|
||||
LOCK();
|
||||
@ -697,7 +702,7 @@ store_folder_deleted(CamelObject *o, void *event_data, void *data)
|
||||
g_object_unref(rule);
|
||||
g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context);
|
||||
|
||||
user = g_strdup_printf("%s/vfolders.xml", evolution_dir);
|
||||
user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
|
||||
rule_context_save((RuleContext *)context, user);
|
||||
g_free(user);
|
||||
} else {
|
||||
@ -738,7 +743,7 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data)
|
||||
filter_rule_set_name(rule, info->new->full_name);
|
||||
g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), folder);
|
||||
|
||||
user = g_strdup_printf("%s/vfolders.xml", evolution_dir);
|
||||
user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
|
||||
rule_context_save((RuleContext *)context, user);
|
||||
g_free(user);
|
||||
|
||||
@ -750,7 +755,7 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data)
|
||||
}
|
||||
|
||||
void
|
||||
vfolder_load_storage(GNOME_Evolution_Shell shell)
|
||||
vfolder_load_storage(void)
|
||||
{
|
||||
char *user, *storeuri;
|
||||
FilterRule *rule;
|
||||
@ -758,7 +763,7 @@ vfolder_load_storage(GNOME_Evolution_Shell shell)
|
||||
vfolder_hash = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
|
||||
/* first, create the vfolder store, and set it up */
|
||||
storeuri = g_strdup_printf("vfolder:%s/vfolder", evolution_dir);
|
||||
storeuri = g_strdup_printf("vfolder:%s/vfolder", mail_component_peek_base_directory (mail_component_peek ()));
|
||||
vfolder_store = camel_session_get_store(session, storeuri, NULL);
|
||||
if (vfolder_store == NULL) {
|
||||
g_warning("Cannot open vfolder store - no vfolders available");
|
||||
@ -773,10 +778,10 @@ vfolder_load_storage(GNOME_Evolution_Shell shell)
|
||||
(CamelObjectEventHookFunc)store_folder_renamed, NULL);
|
||||
|
||||
d(printf("got store '%s' = %p\n", storeuri, vfolder_store));
|
||||
mail_load_storage_by_uri(shell, storeuri, _("VFolders"));
|
||||
mail_component_load_storage_by_uri(mail_component_peek (), storeuri, _("VFolders"));
|
||||
|
||||
/* load our rules */
|
||||
user = g_strdup_printf ("%s/vfolders.xml", evolution_dir);
|
||||
user = g_strdup_printf ("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
|
||||
context = vfolder_context_new ();
|
||||
if (rule_context_load ((RuleContext *)context,
|
||||
EVOLUTION_PRIVDATADIR "/vfoldertypes.xml", user) != 0) {
|
||||
@ -806,8 +811,7 @@ vfolder_editor_response (GtkWidget *dialog, int button, void *data)
|
||||
{
|
||||
char *user;
|
||||
|
||||
user = alloca(strlen(evolution_dir)+16);
|
||||
sprintf(user, "%s/vfolders.xml", evolution_dir);
|
||||
user = g_strdup_printf ("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
|
||||
|
||||
switch(button) {
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
@ -820,6 +824,8 @@ vfolder_editor_response (GtkWidget *dialog, int button, void *data)
|
||||
vfolder_editor = NULL;
|
||||
|
||||
gtk_widget_destroy(dialog);
|
||||
|
||||
g_free (user);
|
||||
}
|
||||
|
||||
void
|
||||
@ -846,7 +852,7 @@ edit_rule_response(GtkWidget *w, int button, void *data)
|
||||
FilterRule *orig = g_object_get_data (G_OBJECT (w), "orig");
|
||||
|
||||
filter_rule_copy(orig, rule);
|
||||
user = g_strdup_printf("%s/vfolders.xml", evolution_dir);
|
||||
user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
|
||||
rule_context_save((RuleContext *)context, user);
|
||||
g_free(user);
|
||||
}
|
||||
@ -877,7 +883,7 @@ vfolder_edit_rule(const char *uri)
|
||||
GTK_STOCK_OK,
|
||||
GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
gtk_container_set_border_width ((GtkContainer *) gd, 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (gd), 6);
|
||||
gtk_box_set_spacing ((GtkBox *) gd->vbox, 6);
|
||||
gtk_dialog_set_default_response(gd, GTK_RESPONSE_OK);
|
||||
g_object_set(gd, "allow_shrink", FALSE, "allow_grow", TRUE, NULL);
|
||||
@ -925,7 +931,7 @@ new_rule_clicked(GtkWidget *w, int button, void *data)
|
||||
|
||||
g_object_ref(rule);
|
||||
rule_context_add_rule((RuleContext *)context, rule);
|
||||
user = g_strdup_printf("%s/vfolders.xml", evolution_dir);
|
||||
user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
|
||||
rule_context_save((RuleContext *)context, user);
|
||||
g_free(user);
|
||||
}
|
||||
@ -971,7 +977,7 @@ vfolder_gui_add_rule(VfolderRule *rule)
|
||||
GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
gtk_dialog_set_default_response(gd, GTK_RESPONSE_OK);
|
||||
gtk_container_set_border_width ((GtkContainer *) gd, 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (gd), 6);
|
||||
gtk_box_set_spacing ((GtkBox *) gd->vbox, 6);
|
||||
g_object_set(gd, "allow_shrink", FALSE, "allow_grow", TRUE, NULL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (gd), 500, 500);
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "filter/vfolder-rule.h"
|
||||
#include "filter/filter-part.h"
|
||||
|
||||
void vfolder_load_storage(GNOME_Evolution_Shell shell);
|
||||
void vfolder_load_storage(void);
|
||||
|
||||
void vfolder_edit (void);
|
||||
void vfolder_edit_rule(const char *name);
|
||||
|
16
mail/mail.h
16
mail/mail.h
@ -31,23 +31,7 @@
|
||||
#include "mail-session.h"
|
||||
#include "mail-types.h"
|
||||
|
||||
extern char *evolution_dir;
|
||||
|
||||
/* mail-identify */
|
||||
char *mail_identify_mime_part (CamelMimePart *part, MailDisplay *md);
|
||||
|
||||
/* component factory for lack of a better place */
|
||||
void mail_add_storage (CamelStore *store, const char *name, const char *uri);
|
||||
void mail_load_storage_by_uri (GNOME_Evolution_Shell shell, const char *uri, const char *name);
|
||||
/*takes a GSList of MailConfigServices */
|
||||
void mail_load_storages (GNOME_Evolution_Shell shell, EAccountList *sources);
|
||||
|
||||
void mail_hash_storage (CamelService *store, EvolutionStorage *storage);
|
||||
EvolutionStorage *mail_lookup_storage (CamelStore *store);
|
||||
void mail_remove_storage_by_uri (const char *uri);
|
||||
void mail_remove_storage (CamelStore *store);
|
||||
void mail_storages_foreach (GHFunc func, gpointer data);
|
||||
int mail_storages_count (void);
|
||||
|
||||
gboolean evolution_folder_info_factory_init (void);
|
||||
|
||||
|
161
mail/main.c
161
mail/main.c
@ -1,161 +0,0 @@
|
||||
/*
|
||||
* main.c: The core of the mail component
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza (miguel@ximian.com)
|
||||
*
|
||||
* (C) 2000 Ximian, Inc.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include <libgnome/gnome-sound.h>
|
||||
#include <bonobo/bonobo-main.h>
|
||||
#include <bonobo-activation/bonobo-activation-init.h>
|
||||
#include <glade/glade.h>
|
||||
#include <libgnomevfs/gnome-vfs.h>
|
||||
|
||||
#include <gconf/gconf.h>
|
||||
|
||||
#include <gal/widgets/e-gui-utils.h>
|
||||
#include <gal/widgets/e-cursors.h>
|
||||
|
||||
#include "e-util/e-passwords.h"
|
||||
#include "e-util/e-proxy.h"
|
||||
|
||||
#include "component-factory.h"
|
||||
#include "composer/evolution-composer.h"
|
||||
#include "mail.h"
|
||||
#include "mail-mt.h"
|
||||
|
||||
/*#define DO_MCHECK*/
|
||||
|
||||
#ifdef DO_MCHECK
|
||||
static int blowup(int status)
|
||||
{
|
||||
switch(status) {
|
||||
case 1:
|
||||
printf("Double free failure\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("Memory clobbered before block\n");
|
||||
break;
|
||||
case 3:
|
||||
printf("Memory clobbered after block\n");
|
||||
break;
|
||||
}
|
||||
abort();
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The GNOME SEGV handler will lose if it's not run from the main Gtk
|
||||
* thread. So if we crash in another thread, redirect the signal.
|
||||
*/
|
||||
static void (*gnome_segv_handler) (int);
|
||||
|
||||
static GStaticMutex segv_mutex = G_STATIC_MUTEX_INIT;
|
||||
|
||||
static void
|
||||
segv_redirect (int sig)
|
||||
{
|
||||
if (pthread_self () == mail_gui_thread)
|
||||
gnome_segv_handler (sig);
|
||||
else {
|
||||
pthread_kill (mail_gui_thread, sig);
|
||||
/* We can't return from the signal handler or the
|
||||
* thread may SEGV again. But we can't pthread_exit,
|
||||
* because then the thread may get cleaned up before
|
||||
* bug-buddy can get a stack trace. So we block by
|
||||
* trying to lock a mutex we know is already locked.
|
||||
*/
|
||||
g_static_mutex_lock (&segv_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{
|
||||
CORBA_ORB orb;
|
||||
struct sigaction sa, osa;
|
||||
|
||||
/* used to make elfence work */
|
||||
free(malloc (10));
|
||||
#ifdef DO_MCHECK
|
||||
/*mtrace();*/
|
||||
mcheck(blowup);
|
||||
#endif
|
||||
bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
g_thread_init (NULL);
|
||||
|
||||
gnome_init_with_popt_table ("evolution-mail-component", VERSION,
|
||||
argc, argv, bonobo_activation_popt_options, 0, NULL);
|
||||
|
||||
sigaction (SIGSEGV, NULL, &osa);
|
||||
if (osa.sa_handler != SIG_DFL) {
|
||||
sa.sa_flags = 0;
|
||||
sigemptyset (&sa.sa_mask);
|
||||
sa.sa_handler = segv_redirect;
|
||||
sigaction (SIGSEGV, &sa, NULL);
|
||||
sigaction (SIGBUS, &sa, NULL);
|
||||
sigaction (SIGFPE, &sa, NULL);
|
||||
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction (SIGXFSZ, &sa, NULL);
|
||||
gnome_segv_handler = osa.sa_handler;
|
||||
g_static_mutex_lock (&segv_mutex);
|
||||
}
|
||||
|
||||
if (!bonobo_init (&argc, argv)) {
|
||||
g_error ("Mail component could not initialize Bonobo.\n"
|
||||
"If there was a warning message about the "
|
||||
"RootPOA, it probably means\nyou compiled "
|
||||
"Bonobo against GOAD instead of Bonobo Activation.");
|
||||
}
|
||||
|
||||
gconf_init (argc, argv, NULL);
|
||||
|
||||
glade_init ();
|
||||
|
||||
gnome_vfs_init ();
|
||||
|
||||
e_cursors_init ();
|
||||
|
||||
e_proxy_init ();
|
||||
|
||||
mail_config_init ();
|
||||
mail_msg_init ();
|
||||
|
||||
gnome_sound_init ("localhost");
|
||||
|
||||
component_factory_init ();
|
||||
evolution_composer_factory_init (composer_send_cb, composer_save_draft_cb);
|
||||
|
||||
if (gdk_threads_mutex) {
|
||||
g_mutex_free (gdk_threads_mutex);
|
||||
gdk_threads_mutex = NULL;
|
||||
}
|
||||
|
||||
g_print ("Evolution Mail ready and running.\n");
|
||||
|
||||
GDK_THREADS_ENTER ();
|
||||
bonobo_main ();
|
||||
|
||||
mail_msg_cleanup();
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
mail_config_write_on_exit ();
|
||||
|
||||
e_passwords_shutdown ();
|
||||
|
||||
gnome_sound_shutdown ();
|
||||
|
||||
return 0;
|
||||
}
|
402
mail/message-browser.c
Normal file
402
mail/message-browser.c
Normal file
@ -0,0 +1,402 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Authors: Jeffrey Stedfast <fejj@ximian.com>
|
||||
*
|
||||
* Copyright 2001 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gconf/gconf.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
|
||||
#include <gal/util/e-util.h>
|
||||
|
||||
#include <bonobo/bonobo-exception.h>
|
||||
#include <bonobo/bonobo-ui-component.h>
|
||||
#include <bonobo/bonobo-ui-container.h>
|
||||
#include <bonobo/bonobo-ui-util.h>
|
||||
|
||||
#include "message-browser.h"
|
||||
|
||||
#include "mail.h"
|
||||
#include "mail-callbacks.h"
|
||||
#include "mail-tools.h"
|
||||
#include "message-list.h"
|
||||
#include "mail-ops.h"
|
||||
#include "mail-vfolder.h"
|
||||
#include "mail-autofilter.h"
|
||||
#include "mail-mt.h"
|
||||
|
||||
#include "mail-local.h"
|
||||
#include "mail-config.h"
|
||||
|
||||
#include "folder-browser-ui.h"
|
||||
|
||||
#define d(x)
|
||||
|
||||
#define MINIMUM_WIDTH 600
|
||||
#define MINIMUM_HEIGHT 400
|
||||
|
||||
#define PARENT_TYPE BONOBO_TYPE_WINDOW
|
||||
|
||||
/* Size of the window last time it was changed. */
|
||||
static GtkAllocation last_allocation = { 0, 0 };
|
||||
|
||||
static BonoboWindowClass *message_browser_parent_class;
|
||||
|
||||
static void
|
||||
message_browser_destroy (GtkObject *object)
|
||||
{
|
||||
MessageBrowser *message_browser;
|
||||
|
||||
message_browser = MESSAGE_BROWSER (object);
|
||||
|
||||
if (message_browser->ml_built_id) {
|
||||
g_signal_handler_disconnect (message_browser->fb->message_list, message_browser->ml_built_id);
|
||||
message_browser->ml_built_id = 0;
|
||||
}
|
||||
|
||||
if (message_browser->loaded_id) {
|
||||
g_signal_handler_disconnect (message_browser->fb, message_browser->loaded_id);
|
||||
message_browser->loaded_id = 0;
|
||||
}
|
||||
|
||||
if (message_browser->fb) {
|
||||
g_object_unref (message_browser->fb);
|
||||
message_browser->fb = NULL;
|
||||
}
|
||||
|
||||
if (GTK_OBJECT_CLASS (message_browser_parent_class)->destroy)
|
||||
(GTK_OBJECT_CLASS (message_browser_parent_class)->destroy) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
message_browser_class_init (GObjectClass *object_class)
|
||||
{
|
||||
((GtkObjectClass *)object_class)->destroy = message_browser_destroy;
|
||||
|
||||
message_browser_parent_class = g_type_class_ref (PARENT_TYPE);
|
||||
}
|
||||
|
||||
static void
|
||||
message_browser_init (GtkObject *object)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
transfer_msg_done (gboolean ok, void *data)
|
||||
{
|
||||
MessageBrowser *mb = data;
|
||||
|
||||
gtk_widget_destroy ((GtkWidget *) mb);
|
||||
|
||||
g_object_unref (mb);
|
||||
}
|
||||
|
||||
static void
|
||||
transfer_msg (MessageBrowser *mb, int del)
|
||||
{
|
||||
const char *allowed_types[] = { "mail/*", "vtrash", NULL };
|
||||
extern EvolutionShellClient *global_shell_client;
|
||||
GNOME_Evolution_Folder *folder;
|
||||
static char *last_uri = NULL;
|
||||
GPtrArray *uids;
|
||||
char *desc;
|
||||
|
||||
/* if (GTK_OBJECT_DESTROYED(mb))
|
||||
return;*/
|
||||
|
||||
if (last_uri == NULL)
|
||||
last_uri = g_strdup ("");
|
||||
|
||||
if (del)
|
||||
desc = _("Move message(s) to");
|
||||
else
|
||||
desc = _("Copy message(s) to");
|
||||
|
||||
evolution_shell_client_user_select_folder (global_shell_client,
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (mb))),
|
||||
desc, last_uri, allowed_types, &folder);
|
||||
if (!folder)
|
||||
return;
|
||||
|
||||
if (strcmp (last_uri, folder->evolutionUri) != 0) {
|
||||
g_free (last_uri);
|
||||
last_uri = g_strdup (folder->evolutionUri);
|
||||
}
|
||||
|
||||
uids = g_ptr_array_new ();
|
||||
message_list_foreach (mb->fb->message_list, enumerate_msg, uids);
|
||||
|
||||
if (del) {
|
||||
g_object_ref (mb);
|
||||
mail_transfer_messages (mb->fb->folder, uids, del,
|
||||
folder->physicalUri, 0, transfer_msg_done, mb);
|
||||
} else {
|
||||
mail_transfer_messages (mb->fb->folder, uids, del,
|
||||
folder->physicalUri, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
CORBA_free (folder);
|
||||
}
|
||||
|
||||
|
||||
/* UI callbacks */
|
||||
|
||||
static void
|
||||
message_browser_close (BonoboUIComponent *uih, void *user_data, const char *path)
|
||||
{
|
||||
gtk_widget_destroy (GTK_WIDGET (user_data));
|
||||
}
|
||||
|
||||
static void
|
||||
message_browser_move (BonoboUIComponent *uih, void *user_data, const char *path)
|
||||
{
|
||||
transfer_msg (user_data, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
message_browser_copy (BonoboUIComponent *uih, void *user_data, const char *path)
|
||||
{
|
||||
transfer_msg (user_data, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
message_browser_delete (BonoboUIComponent *uih, void *user_data, const char *path)
|
||||
{
|
||||
MessageBrowser *mb = user_data;
|
||||
GPtrArray *uids;
|
||||
int i;
|
||||
|
||||
uids = g_ptr_array_new ();
|
||||
message_list_foreach (mb->fb->message_list, enumerate_msg, uids);
|
||||
camel_folder_freeze (mb->fb->folder);
|
||||
for (i = 0; i < uids->len; i++) {
|
||||
camel_folder_set_message_flags (mb->fb->folder, uids->pdata[i],
|
||||
CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN,
|
||||
CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN);
|
||||
g_free (uids->pdata[i]);
|
||||
}
|
||||
|
||||
camel_folder_thaw (mb->fb->folder);
|
||||
|
||||
g_ptr_array_free (uids, TRUE);
|
||||
|
||||
gtk_widget_destroy ((GtkWidget *) mb);
|
||||
}
|
||||
|
||||
static BonoboUIVerb
|
||||
browser_verbs [] = {
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageBrowserClose", message_browser_close),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageMove", message_browser_move),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageCopy", message_browser_copy),
|
||||
BONOBO_UI_UNSAFE_VERB ("MessageDelete", message_browser_delete),
|
||||
BONOBO_UI_VERB_END
|
||||
};
|
||||
|
||||
/* FB message loading hookups */
|
||||
|
||||
static void
|
||||
message_browser_message_loaded (FolderBrowser *fb, const char *uid, MessageBrowser *mb)
|
||||
{
|
||||
CamelMimeMessage *message;
|
||||
char *subject = NULL;
|
||||
char *title;
|
||||
|
||||
folder_browser_ui_message_loaded(fb);
|
||||
|
||||
message = fb->mail_display->current_message;
|
||||
|
||||
if (message)
|
||||
subject = (char *) camel_mime_message_get_subject (message);
|
||||
|
||||
if (subject == NULL)
|
||||
subject = _("(No subject)");
|
||||
|
||||
title = g_strdup_printf (_("%s - Message"), subject);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (mb), title);
|
||||
|
||||
g_free (title);
|
||||
}
|
||||
|
||||
static void
|
||||
message_browser_message_list_built (MessageList *ml, MessageBrowser *mb)
|
||||
{
|
||||
const char *uid = g_object_get_data (G_OBJECT (mb), "uid");
|
||||
|
||||
g_signal_handler_disconnect (ml, mb->ml_built_id);
|
||||
mb->ml_built_id = 0;
|
||||
|
||||
message_list_select_uid (ml, uid);
|
||||
}
|
||||
|
||||
static void
|
||||
message_browser_folder_loaded (FolderBrowser *fb, const char *uri, MessageBrowser *mb)
|
||||
{
|
||||
g_signal_handler_disconnect (fb, mb->loaded_id);
|
||||
mb->loaded_id = 0;
|
||||
|
||||
mb->ml_built_id = g_signal_connect (fb->message_list, "message_list_built",
|
||||
G_CALLBACK (message_browser_message_list_built), mb);
|
||||
}
|
||||
|
||||
static void
|
||||
message_browser_size_allocate_cb (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
last_allocation = *allocation;
|
||||
}
|
||||
|
||||
/* Construction */
|
||||
|
||||
static void
|
||||
set_default_size (GtkWidget *widget)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
width = MAX (MINIMUM_WIDTH, last_allocation.width);
|
||||
height = MAX (MINIMUM_HEIGHT, last_allocation.height);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (widget), width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
set_bonobo_ui (GtkWidget *widget, FolderBrowser *fb)
|
||||
{
|
||||
BonoboUIContainer *uicont;
|
||||
BonoboUIComponent *uic;
|
||||
CORBA_Environment ev;
|
||||
|
||||
uicont = bonobo_window_get_ui_container (BONOBO_WINDOW (widget));
|
||||
|
||||
uic = bonobo_ui_component_new_default ();
|
||||
bonobo_ui_component_set_container (uic, BONOBO_OBJREF (uicont), NULL);
|
||||
folder_browser_set_ui_component (fb, uic);
|
||||
|
||||
/* Load our UI */
|
||||
|
||||
/*bonobo_ui_component_freeze (uic, NULL);*/
|
||||
bonobo_ui_util_set_ui (uic, PREFIX,
|
||||
EVOLUTION_UIDIR "/evolution-mail-messagedisplay.xml",
|
||||
"evolution-mail", NULL);
|
||||
|
||||
/* Load the appropriate UI stuff from the folder browser */
|
||||
|
||||
folder_browser_ui_add_message (fb);
|
||||
|
||||
/* We just opened the message! We don't need to open it again. */
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
/* remove the broken menus and toolbar items */
|
||||
bonobo_ui_component_rm (uic, "/menu/File/FileOps/MessageOpen", &ev);
|
||||
bonobo_ui_component_rm (uic, "/menu/Actions/ComponentActionsPlaceholder/MailMessageActions/GoTo", &ev);
|
||||
bonobo_ui_component_rm (uic, "/menu/Tools", &ev);
|
||||
bonobo_ui_component_rm (uic, "/Toolbar/MailNextButtons", &ev);
|
||||
CORBA_exception_free (&ev);
|
||||
|
||||
/* Hack around the move/copy/delete commands api's */
|
||||
bonobo_ui_component_remove_listener (uic, "MessageCopy");
|
||||
bonobo_ui_component_remove_listener (uic, "MessageMove");
|
||||
bonobo_ui_component_remove_listener (uic, "MessageDelete");
|
||||
|
||||
/* Add the Close & Move/Copy/Delete items */
|
||||
|
||||
bonobo_ui_component_add_verb_list_with_data (uic, browser_verbs, widget);
|
||||
|
||||
/* Done */
|
||||
|
||||
/*bonobo_ui_component_thaw (uic, NULL);*/
|
||||
}
|
||||
|
||||
static int
|
||||
on_key_press (GtkWidget *widget, GdkEventKey *key, gpointer data)
|
||||
{
|
||||
MessageBrowser *mb = data;
|
||||
|
||||
if (key->state & GDK_CONTROL_MASK)
|
||||
return FALSE;
|
||||
|
||||
switch (key->keyval) {
|
||||
case GDK_Delete:
|
||||
case GDK_KP_Delete:
|
||||
message_browser_delete (NULL, mb, NULL);
|
||||
return TRUE;
|
||||
case GDK_Escape:
|
||||
message_browser_close (NULL, mb, NULL);
|
||||
return TRUE;
|
||||
default:
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
message_browser_new (const char *uri, const char *uid)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
MessageBrowser *new;
|
||||
FolderBrowser *fb;
|
||||
|
||||
new = g_object_new (MESSAGE_BROWSER_TYPE, "title", "Ximian Evolution", NULL);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (new), "uid", g_strdup (uid), g_free);
|
||||
|
||||
fb = FOLDER_BROWSER (folder_browser_new (uri));
|
||||
g_object_ref (fb);
|
||||
gtk_object_sink ((GtkObject *) fb);
|
||||
|
||||
new->fb = fb;
|
||||
|
||||
set_bonobo_ui (GTK_WIDGET (new), fb);
|
||||
|
||||
/* some evil hackery action... */
|
||||
vbox = gtk_vbox_new (TRUE, 0);
|
||||
gtk_widget_ref (GTK_WIDGET (fb->mail_display));
|
||||
gtk_widget_reparent (GTK_WIDGET (fb->mail_display), vbox);
|
||||
/* Note: normally we'd unref the fb->mail_display now, except
|
||||
that if we do then our refcounts will not be in
|
||||
harmony... both the fb *and* the message-browser need to
|
||||
own a ref on the mail_display. */
|
||||
gtk_widget_show (GTK_WIDGET (fb->mail_display));
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
g_signal_connect (new, "size-allocate", G_CALLBACK (message_browser_size_allocate_cb), NULL);
|
||||
|
||||
bonobo_window_set_contents (BONOBO_WINDOW (new), vbox);
|
||||
gtk_widget_grab_focus (GTK_WIDGET (MAIL_DISPLAY (fb->mail_display)->html));
|
||||
|
||||
set_default_size (GTK_WIDGET (new));
|
||||
|
||||
/* more evil hackery... */
|
||||
new->loaded_id = g_signal_connect (fb, "folder_loaded", G_CALLBACK (message_browser_folder_loaded), new);
|
||||
g_signal_connect (fb, "message_loaded", G_CALLBACK (message_browser_message_loaded), new);
|
||||
|
||||
g_signal_connect (new, "key_press_event", G_CALLBACK (on_key_press), new);
|
||||
|
||||
return GTK_WIDGET (new);
|
||||
}
|
||||
|
||||
/* Fin */
|
||||
|
||||
E_MAKE_TYPE (message_browser, "MessageBrowser", MessageBrowser, message_browser_class_init,
|
||||
message_browser_init, PARENT_TYPE);
|
63
mail/message-browser.h
Normal file
63
mail/message-browser.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Authors: Jeffrey Stedfast <fejj@ximian.com>
|
||||
*
|
||||
* Copyright 2001 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MESSAGE_BROWSER_H_
|
||||
#define _MESSAGE_BROWSER_H_
|
||||
|
||||
#include <gnome.h>
|
||||
#include <bonobo/bonobo-window.h>
|
||||
|
||||
#include <camel/camel-folder.h>
|
||||
#include "folder-browser.h"
|
||||
#include "mail-display.h"
|
||||
#include "mail-types.h"
|
||||
|
||||
#define MESSAGE_BROWSER_TYPE (message_browser_get_type ())
|
||||
#define MESSAGE_BROWSER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MESSAGE_BROWSER_TYPE, MessageBrowser))
|
||||
#define MESSAGE_BROWSER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), MESSAGE_BROWSER_TYPE, MessageBrowserClass))
|
||||
#define IS_MESSAGE_BROWSER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MESSAGE_BROWSER_TYPE))
|
||||
#define IS_MESSAGE_BROWSER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MESSAGE_BROWSER_TYPE))
|
||||
|
||||
struct _MessageBrowser {
|
||||
BonoboWindow parent;
|
||||
|
||||
/*
|
||||
* The current URI being displayed by the MessageBrowser
|
||||
*/
|
||||
FolderBrowser *fb;
|
||||
gulong ml_built_id;
|
||||
gulong loaded_id;
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
BonoboWindowClass parent_class;
|
||||
|
||||
} MessageBrowserClass;
|
||||
|
||||
GtkType message_browser_get_type (void);
|
||||
|
||||
GtkWidget *message_browser_new (const char *uri,
|
||||
const char *uid);
|
||||
|
||||
#endif /* _MESSAGE_BROWSER_H_ */
|
||||
|
1669
mail/subscribe-dialog.c
Normal file
1669
mail/subscribe-dialog.c
Normal file
File diff suppressed because it is too large
Load Diff
9
mail/subscribe-dialog.etspec
Normal file
9
mail/subscribe-dialog.etspec
Normal file
@ -0,0 +1,9 @@
|
||||
<ETableSpecification cursor-mode="line" no-headers="true">
|
||||
<ETableColumn model_col="0" pixbuf="subscribed-image" expansion="0.0" minimum_width="16" resizable="false" cell="cell_toggle" compare="integer"/>
|
||||
<ETableColumn model_col="1" _title="Folder" expansion="1.0" minimum_width="20" resizable="true" cell="cell_tree" compare="string"/>
|
||||
<ETableState>
|
||||
<column source="0"/>
|
||||
<column source="1"/>
|
||||
<grouping></grouping>
|
||||
</ETableState>
|
||||
</ETableSpecification>
|
62
mail/subscribe-dialog.h
Normal file
62
mail/subscribe-dialog.h
Normal file
@ -0,0 +1,62 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Authors: Chris Toshok <toshok@ximian.com>
|
||||
* Peter Williams <peterw@ximian.com>
|
||||
*
|
||||
* Copyright 2000 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _SUBSCRIBE_DIALOG_H_
|
||||
#define _SUBSCRIBE_DIALOG_H_
|
||||
|
||||
#include <gtk/gtktable.h>
|
||||
#include <bonobo/bonobo-control.h>
|
||||
#include <bonobo/bonobo-property-bag.h>
|
||||
#include <gal/e-table/e-tree-model.h>
|
||||
#include <gal/e-table/e-table-model.h>
|
||||
#include "shell/evolution-storage.h"
|
||||
#include "mail-types.h"
|
||||
#include "camel/camel-store.h"
|
||||
|
||||
#define SUBSCRIBE_DIALOG_TYPE (subscribe_dialog_get_type ())
|
||||
#define SUBSCRIBE_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SUBSCRIBE_DIALOG_TYPE, SubscribeDialog))
|
||||
#define SUBSCRIBE_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SUBSCRIBE_DIALOG_TYPE, SubscribeDialogClass))
|
||||
#define IS_SUBSCRIBE_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SUBSCRIBE_DIALOG_TYPE))
|
||||
#define IS_SUBSCRIBE_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SUBSCRIBE_DIALOG_TYPE))
|
||||
|
||||
typedef struct _SubscribeDialogPrivate SubscribeDialogPrivate;
|
||||
|
||||
struct _SubscribeDialog {
|
||||
GtkObject parent;
|
||||
|
||||
GtkWidget *app;
|
||||
SubscribeDialogPrivate *priv;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GtkObjectClass parent_class;
|
||||
} SubscribeDialogClass;
|
||||
|
||||
GtkType subscribe_dialog_get_type (void);
|
||||
GtkObject *subscribe_dialog_new (void);
|
||||
|
||||
/* helper macro */
|
||||
#define subscribe_dialog_show(dialog) gtk_widget_show (SUBSCRIBE_DIALOG (dialog)->app)
|
||||
|
||||
#endif /* _SUBSCRIBE_DIALOG_H_ */
|
1169
mail/upgrade-mailer.c
Normal file
1169
mail/upgrade-mailer.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -92,6 +92,7 @@ calendar/gui/dialogs/event-editor.c
|
||||
calendar/gui/dialogs/event-page.c
|
||||
calendar/gui/dialogs/event-page.glade
|
||||
calendar/gui/dialogs/meeting-page.c
|
||||
calendar/gui/dialogs/meeting-page.etspec
|
||||
calendar/gui/dialogs/meeting-page.glade
|
||||
calendar/gui/dialogs/recur-comp.c
|
||||
calendar/gui/dialogs/recurrence-page.c
|
||||
@ -118,6 +119,7 @@ calendar/gui/e-day-view-time-item.c
|
||||
calendar/gui/e-day-view-top-item.c
|
||||
calendar/gui/e-itip-control.c
|
||||
calendar/gui/e-itip-control.glade
|
||||
calendar/gui/e-meeting-model.c
|
||||
calendar/gui/e-meeting-time-sel.c
|
||||
calendar/gui/e-meeting-time-sel.etspec
|
||||
calendar/gui/e-meeting-time-sel-item.c
|
||||
@ -260,7 +262,10 @@ importers/evolution-gnomecard-importer.c
|
||||
importers/netscape-importer.c
|
||||
importers/pine-importer.c
|
||||
mail/component-factory.c
|
||||
mail/folder-browser.c
|
||||
mail/folder-browser-factory.c
|
||||
mail/folder-browser.h
|
||||
mail/folder-browser-ui.c
|
||||
mail/folder-info.c
|
||||
mail/GNOME_Evolution_Mail.server.in.in
|
||||
mail/importers/elm-importer.c
|
||||
@ -275,27 +280,35 @@ mail/local-config.glade
|
||||
mail/mail-account-editor.c
|
||||
mail/mail-account-gui.c
|
||||
mail/mail-accounts.c
|
||||
mail/mail-accounts.etspec
|
||||
mail/mail-autofilter.c
|
||||
mail/mail-callbacks.c
|
||||
mail/mail-composer-prefs.c
|
||||
mail/mail-config.c
|
||||
mail/mail-config-druid.c
|
||||
mail/mail-config.glade
|
||||
mail/mail-crypto.c
|
||||
mail/mail-display.c
|
||||
mail/mail-folder-cache.c
|
||||
mail/mail-format.c
|
||||
mail/mail-local.c
|
||||
mail/mail-mt.c
|
||||
mail/mail-ops.c
|
||||
mail/mail-preferences.c
|
||||
mail/mail-search.c
|
||||
mail/mail-send-recv.c
|
||||
mail/mail-session.c
|
||||
mail/mail-signature-editor.c
|
||||
mail/mail-tools.c
|
||||
mail/mail-vfolder.c
|
||||
mail/message-browser.c
|
||||
mail/message-list.c
|
||||
mail/message-list.etspec
|
||||
mail/message-tag-editor.c
|
||||
mail/message-tag-followup.c
|
||||
mail/message-tags.glade
|
||||
mail/subscribe-dialog.c
|
||||
mail/subscribe-dialog.etspec
|
||||
mail/subscribe-dialog.glade
|
||||
my-evolution/component-factory.c
|
||||
my-evolution/e-summary.c
|
||||
|
@ -3,6 +3,7 @@ addressbook/gui/widgets/test-minicard-view.c
|
||||
addressbook/tools/evolution-addressbook-export-list-cards.c
|
||||
addressbook/tools/evolution-addressbook-export-list-folders.c
|
||||
addressbook/tools/evolution-addressbook-export.c
|
||||
camel/camel-pkcs7-context.c
|
||||
camel/providers/nntp/camel-nntp-auth.c
|
||||
camel/providers/nntp/camel-nntp-folder.c
|
||||
camel/providers/nntp/camel-nntp-grouplist.c
|
||||
|
6455
po/en_AU.po
6455
po/en_AU.po
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user