Check the state of message_style in gconf and set the menus accordingly.
2003-01-13 Jeffrey Stedfast <fejj@ximian.com> * folder-browser-ui.c (folder_browser_ui_add_message): Check the state of message_style in gconf and set the menus accordingly. * folder-browser.c (folder_browser_destroy): Remove listener for message_style change notification. (folder_browser_gui_init): Connect a listener for changes to message_style. svn path=/trunk/; revision=19432
This commit is contained in:

committed by
Jeffrey Stedfast

parent
3c89e1aa02
commit
724b28b7ad
@ -1,5 +1,13 @@
|
||||
2003-01-13 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* folder-browser-ui.c (folder_browser_ui_add_message): Check the
|
||||
state of message_style in gconf and set the menus accordingly.
|
||||
|
||||
* folder-browser.c (folder_browser_destroy): Remove listener for
|
||||
message_style change notification.
|
||||
(folder_browser_gui_init): Connect a listener for changes to
|
||||
message_style.
|
||||
|
||||
* mail-config.c (account_to_xml): Save the auto-check timeout
|
||||
value.
|
||||
(account_new_from_xml): Load the auto-check-timeout value.
|
||||
|
@ -511,9 +511,10 @@ char *message_display_styles[] = {
|
||||
void
|
||||
folder_browser_ui_add_message (FolderBrowser *fb)
|
||||
{
|
||||
int state;
|
||||
BonoboUIComponent *uic = fb->uicomp;
|
||||
FolderBrowserSelectionState prev_state;
|
||||
GConfClient *gconf;
|
||||
int style;
|
||||
|
||||
if (fb->sensitise_state) {
|
||||
g_hash_table_destroy(fb->sensitise_state);
|
||||
@ -522,16 +523,19 @@ folder_browser_ui_add_message (FolderBrowser *fb)
|
||||
|
||||
ui_add (fb, "message", message_verbs, message_pixcache);
|
||||
|
||||
gconf = gconf_client_get_default ();
|
||||
|
||||
/* Display Style */
|
||||
state = fb->mail_display->display_style;
|
||||
bonobo_ui_component_set_prop (uic, message_display_styles[state],
|
||||
"state", "1", NULL);
|
||||
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);
|
||||
/* FIXME: this kind of bypasses bonobo but seems the only way when we change components */
|
||||
folder_browser_set_message_display_style (uic, strrchr (message_display_styles[state], '/') + 1,
|
||||
Bonobo_UIComponent_STATE_CHANGED, "1", 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))
|
||||
@ -544,8 +548,7 @@ folder_browser_ui_add_message (FolderBrowser *fb)
|
||||
|
||||
/* Charset picker */
|
||||
e_charset_picker_bonobo_ui_populate (uic, "/menu/View", FB_DEFAULT_CHARSET,
|
||||
folder_browser_charset_changed,
|
||||
fb);
|
||||
folder_browser_charset_changed, fb);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -213,6 +213,11 @@ folder_browser_destroy (GtkObject *object)
|
||||
folder_browser->hide_deleted_notify_id = 0;
|
||||
}
|
||||
|
||||
if (folder_browser->message_style_notify_id != 0) {
|
||||
gconf_client_notify_remove (gconf, folder_browser->message_style_notify_id);
|
||||
folder_browser->message_style_notify_id = 0;
|
||||
}
|
||||
|
||||
/* wait for all outstanding async events against us */
|
||||
mail_async_event_destroy (folder_browser->async_event);
|
||||
|
||||
@ -1344,8 +1349,6 @@ folder_browser_set_message_display_style (BonoboUIComponent *component
|
||||
GConfClient *gconf;
|
||||
int i;
|
||||
|
||||
/* FIXME: we should listen for changes to this, so when it changes for one folder all folders get updated */
|
||||
|
||||
if (type != Bonobo_UIComponent_STATE_CHANGED
|
||||
|| atoi (state) == 0
|
||||
|| fb->message_list == NULL)
|
||||
@ -1353,6 +1356,8 @@ folder_browser_set_message_display_style (BonoboUIComponent *component
|
||||
|
||||
gconf = gconf_client_get_default ();
|
||||
|
||||
printf ("message display style: %s\n", path);
|
||||
|
||||
for (i = 0; i < MAIL_CONFIG_DISPLAY_MAX; i++) {
|
||||
if (strstr (message_display_styles[i], path)) {
|
||||
fb->mail_display->display_style = i;
|
||||
@ -2383,6 +2388,22 @@ hide_deleted_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpo
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
message_style_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
|
||||
{
|
||||
extern char *message_display_styles[];
|
||||
FolderBrowser *fb = user_data;
|
||||
const char *uipath;
|
||||
int style;
|
||||
|
||||
if (fb->uicomp) {
|
||||
style = gconf_client_get_int (client, "/apps/evolution/mail/display/message_style", NULL);
|
||||
style = style >= 0 && style < MAIL_CONFIG_DISPLAY_MAX ? style : 0;
|
||||
uipath = message_display_styles[style];
|
||||
bonobo_ui_component_set_prop (fb->uicomp, uipath, "state", "1", NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
folder_browser_gui_init (FolderBrowser *fb)
|
||||
{
|
||||
@ -2453,6 +2474,13 @@ folder_browser_gui_init (FolderBrowser *fb)
|
||||
fb->show_preview_notify_id = gconf_client_notify_add (gconf, "/apps/evolution/mail/display/show_preview",
|
||||
show_preview_changed, fb, NULL, NULL);
|
||||
|
||||
/* message display style */
|
||||
gconf_client_add_dir (gconf, "/apps/evolution/mail/display/message_style",
|
||||
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
|
||||
fb->message_style_notify_id = gconf_client_notify_add (gconf, "/apps/evolution/mail/display/message_style",
|
||||
message_style_changed, fb, NULL, NULL);
|
||||
|
||||
/* paned size */
|
||||
gconf_client_add_dir (gconf, "/apps/evolution/mail/display/paned_size",
|
||||
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
|
@ -60,10 +60,11 @@ struct _FolderBrowser {
|
||||
guint seen_id;
|
||||
|
||||
gulong paned_resize_id;
|
||||
guint paned_size_notify_id;
|
||||
|
||||
guint paned_size_notify_id;
|
||||
guint show_preview_notify_id;
|
||||
guint hide_deleted_notify_id;
|
||||
guint message_style_notify_id;
|
||||
|
||||
/* a folder we are expunging, dont use other than to compare the pointer value */
|
||||
CamelFolder *expunging;
|
||||
|
Reference in New Issue
Block a user