diff options
author | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-06-03 02:12:08 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-06-03 02:12:08 +0800 |
commit | e4bdc1e6a762058e4e289d6d7710dcadda1caca1 (patch) | |
tree | db6d05298cebb7b0a359665f796992acdbfda264 | |
parent | a2e4f2a688b391cd9b0a7800ea6bb86e9194c1db (diff) | |
download | gsoc2013-evolution-e4bdc1e6a762058e4e289d6d7710dcadda1caca1.tar gsoc2013-evolution-e4bdc1e6a762058e4e289d6d7710dcadda1caca1.tar.gz gsoc2013-evolution-e4bdc1e6a762058e4e289d6d7710dcadda1caca1.tar.bz2 gsoc2013-evolution-e4bdc1e6a762058e4e289d6d7710dcadda1caca1.tar.lz gsoc2013-evolution-e4bdc1e6a762058e4e289d6d7710dcadda1caca1.tar.xz gsoc2013-evolution-e4bdc1e6a762058e4e289d6d7710dcadda1caca1.tar.zst gsoc2013-evolution-e4bdc1e6a762058e4e289d6d7710dcadda1caca1.zip |
Added support for Vertical View in Evolution Mailer with custom message list.
svn path=/trunk/; revision=32071
-rw-r--r-- | mail/ChangeLog | 29 | ||||
-rw-r--r-- | mail/em-folder-browser.c | 106 | ||||
-rw-r--r-- | mail/em-folder-browser.h | 1 | ||||
-rw-r--r-- | mail/em-folder-view.c | 38 | ||||
-rw-r--r-- | mail/em-folder-view.h | 1 | ||||
-rw-r--r-- | mail/evolution-mail.schemas.in.in | 42 | ||||
-rw-r--r-- | mail/message-list.c | 139 | ||||
-rw-r--r-- | mail/message-list.etspec | 9 | ||||
-rw-r--r-- | mail/message-list.h | 3 | ||||
-rw-r--r-- | ui/ChangeLog | 8 | ||||
-rw-r--r-- | ui/evolution-mail-global.xml | 16 | ||||
-rw-r--r-- | ui/evolution-mail-list.xml | 3 | ||||
-rw-r--r-- | ui/evolution-mail-message.xml | 4 | ||||
-rw-r--r-- | ui/evolution.xml | 8 | ||||
-rw-r--r-- | views/ChangeLog | 10 | ||||
-rw-r--r-- | views/mail/Makefile.am | 2 | ||||
-rw-r--r-- | views/mail/Wide_View_Normal.galview | 7 | ||||
-rw-r--r-- | views/mail/Wide_View_Sent.galview | 7 | ||||
-rw-r--r-- | views/mail/galview.xml | 2 | ||||
-rw-r--r-- | widgets/ChangeLog | 16 | ||||
-rw-r--r-- | widgets/table/Makefile.am | 2 | ||||
-rw-r--r-- | widgets/table/e-cell-hbox.c | 323 | ||||
-rw-r--r-- | widgets/table/e-cell-hbox.h | 74 | ||||
-rw-r--r-- | widgets/table/e-cell-text.c | 21 | ||||
-rw-r--r-- | widgets/table/e-cell-tree.c | 7 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.c | 76 |
26 files changed, 917 insertions, 37 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 4db84b06ba..d33a0b4442 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,32 @@ +2006-06-02 Srinivasa Ragavan <sragavan@novell.com> + + ** Added support for Vertical View in evolution in addition to the + existing classical view. It also supports a composite headers to be + shown in a multilined column. + + * em-folder-browser.c: (emfb_pane_realised), + (emfb_pane_button_release_event), (emfb_init), + (em_folder_browser_show_preview), (em_folder_browser_show_wide), + (emfb_show_next), (emfb_show_below), (emfb_activate): Added code to + handle the new wide mode in Evolution. + * em-folder-browser.h: + * em-folder-view.c: (emfv_setup_view_instance), + (em_folder_view_setup_view_instance): Added code to handle the default + view in the wide mode for normal and sent/draft folders. + * em-folder-view.h: + * evolution-mail.schemas.in.in: Added schema for hpane size, showing + email in the composite headers and toggling wide more. + + * message-list.c: (ml_duplicate_value), (ml_free_value), + (ml_initialize_value), (ml_value_is_empty), (ml_value_to_string), + (sanitize_recipients), (ml_tree_value_at), (create_composite_cell), + (message_list_create_extras): Added a new composite header + render_composite_from/recipient which shows the headers in a + multilined column. + * message-list.etspec: Added three new columns, Recipent, Messages + column for normal folders and Messages column for sent/draft folders. + * message-list.h: + 2006-05-30 Li Yuan <li.yuan@sun.com> Fix for #341381. diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index 56f7a9b3f6..830e2a287d 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -35,6 +35,7 @@ #include <gtk/gtkscrolledwindow.h> #include <gtk/gtkbutton.h> #include <gtk/gtkvpaned.h> +#include <gtk/gtkhpaned.h> #include <gtkhtml/gtkhtml.h> #include <gdk/gdkkeysyms.h> #include <gconf/gconf-client.h> @@ -114,6 +115,8 @@ struct _EMFolderBrowserPrivate { char *select_uid; guint folder_changed_id; + int show_wide:1; + EMMenu *menu; /* toplevel menu manager */ }; @@ -154,7 +157,11 @@ emfb_pane_realised(GtkWidget *w, EMFolderBrowser *emfb) GConfClient *gconf; gconf = mail_config_get_gconf_client (); - gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int(gconf, "/apps/evolution/mail/display/paned_size", NULL)); + + if (emfb->priv->show_wide) + gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int(gconf, "/apps/evolution/mail/display/hpaned_size", NULL)); + else + gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int(gconf, "/apps/evolution/mail/display/paned_size", NULL)); } static gboolean @@ -162,9 +169,15 @@ emfb_pane_button_release_event(GtkWidget *w, GdkEventButton *e, EMFolderBrowser { GConfClient *gconf = mail_config_get_gconf_client (); - if (GTK_WIDGET_REALIZED (w)) - gconf_client_set_int(gconf, "/apps/evolution/mail/display/paned_size", - gtk_paned_get_position(GTK_PANED(w)), NULL); + if (GTK_WIDGET_REALIZED (w)) { + if (emfb->priv->show_wide) + gconf_client_set_int(gconf, "/apps/evolution/mail/display/hpaned_size", + gtk_paned_get_position(GTK_PANED(w)), NULL); + else + gconf_client_set_int(gconf, "/apps/evolution/mail/display/paned_size", + gtk_paned_get_position(GTK_PANED(w)), NULL); + + } return FALSE; } @@ -221,7 +234,9 @@ emfb_init(GObject *o) gtk_box_pack_start((GtkBox *)emfb, (GtkWidget *)emfb->search, FALSE, TRUE, 0); } - emfb->vpane = gtk_vpaned_new(); + emfb->priv->show_wide = gconf_client_get_bool(mail_config_get_gconf_client(), "/apps/evolution/mail/display/show_wide", NULL); + emfb->vpane = emfb->priv->show_wide?gtk_hpaned_new():gtk_vpaned_new(); + g_signal_connect(emfb->vpane, "realize", G_CALLBACK(emfb_pane_realised), emfb); emfb->priv->vpane_resize_id = g_signal_connect(emfb->vpane, "button_release_event", G_CALLBACK(emfb_pane_button_release_event), emfb); @@ -345,7 +360,7 @@ void em_folder_browser_show_preview(EMFolderBrowser *emfb, gboolean state) GConfClient *gconf = mail_config_get_gconf_client (); int paned_size /*, y*/; - paned_size = gconf_client_get_int(gconf, "/apps/evolution/mail/display/paned_size", NULL); + paned_size = gconf_client_get_int(gconf, emfb->priv->show_wide ? "/apps/evolution/mail/display/hpaned_size":"/apps/evolution/mail/display/paned_size", NULL); /*y = save_cursor_pos (emfb);*/ gtk_paned_set_position (GTK_PANED (emfb->vpane), paned_size); @@ -376,6 +391,39 @@ void em_folder_browser_show_preview(EMFolderBrowser *emfb, gboolean state) /* FIXME: need to update menu's to reflect ui changes */ } +void em_folder_browser_show_wide(EMFolderBrowser *emfb, gboolean state) +{ + GtkWidget *w; + + if ((emfb->priv->show_wide && state) + || emfb->view.list == NULL + || emfb->view.preview_active == 0) { + emfb->priv->show_wide = state; + return; + } + + emfb->priv->show_wide = state; + + w = emfb->priv->show_wide?gtk_hpaned_new():gtk_vpaned_new(); + + g_signal_handler_disconnect(emfb->vpane, emfb->priv->vpane_resize_id); + g_signal_connect(w, "realize", G_CALLBACK(emfb_pane_realised), emfb); + emfb->priv->vpane_resize_id = g_signal_connect(w, "button_release_event", G_CALLBACK(emfb_pane_button_release_event), emfb); + + gtk_widget_show(w); + if (emfb->priv->show_wide) + gtk_paned_set_position((GtkPaned *)w, gconf_client_get_int(mail_config_get_gconf_client (), "/apps/evolution/mail/display/hpaned_size", NULL)); + else + gtk_paned_set_position((GtkPaned *)w, gconf_client_get_int(mail_config_get_gconf_client (), "/apps/evolution/mail/display/paned_size", NULL)); + gtk_box_pack_start_defaults((GtkBox *)emfb, w); + gtk_widget_reparent((GtkWidget *)emfb->view.list, w); + gtk_widget_reparent((GtkWidget *)emfb->priv->preview, w); + gtk_widget_destroy(emfb->vpane); + emfb->vpane = w; + if (((EMFolderView *)emfb)->folder) + em_folder_view_setup_view_instance ((EMFolderView *) emfb); +} + /* ********************************************************************** */ /* FIXME: Need to separate system rules from user ones */ @@ -945,6 +993,36 @@ emfb_view_preview(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_E } static void +emfb_show_next(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data) +{ + GConfClient *gconf; + EMFolderBrowser *emfb = data; + + if (type != Bonobo_UIComponent_STATE_CHANGED) + return; + + gconf = mail_config_get_gconf_client (); + gconf_client_set_bool(gconf, "/apps/evolution/mail/display/show_wide", state[0] != '0', NULL); + + em_folder_browser_show_wide(emfb, state[0] != '0'); +} + +static void +emfb_show_below(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data) +{ + GConfClient *gconf; + EMFolderBrowser *emfb = data; + + if (type != Bonobo_UIComponent_STATE_CHANGED) + return; + + gconf = mail_config_get_gconf_client (); + gconf_client_set_bool(gconf, "/apps/evolution/mail/display/show_wide", state[0] == '0', NULL); + + em_folder_browser_show_wide(emfb, state[0] == '0'); +} + +static void emfb_list_scrolled (MessageList *ml, EMFolderBrowser *emfb) { EMFolderView *emfv = (EMFolderView *) emfb; @@ -1173,7 +1251,7 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) preview settings - see folder_browser_set_message_preview() internals for details) */ g_signal_handler_block(emfb->vpane, emfb->priv->vpane_resize_id); - gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL)); + gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int (gconf, emfb->priv->show_wide ? "/apps/evolution/mail/display/hpaned_size": "/apps/evolution/mail/display/paned_size", NULL)); g_signal_handler_unblock(emfb->vpane, emfb->priv->vpane_resize_id); /* (Pre)view toggle */ @@ -1222,6 +1300,20 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) bonobo_ui_component_add_listener(uic, "ViewThreaded", emfb_view_threaded, emfv); message_list_set_threaded(emfv->list, state); + /* Show wide display */ + state = gconf_client_get_bool(gconf, "/apps/evolution/mail/display/show_wide", NULL); + if (state) { + bonobo_ui_component_set_prop(uic, "/commands/ViewAfter", "state", "1", NULL); + bonobo_ui_component_set_prop(uic, "/commands/ViewBelow", "state", "0", NULL); + } else { + bonobo_ui_component_set_prop(uic, "/commands/ViewAfter", "state", "0", NULL); + bonobo_ui_component_set_prop(uic, "/commands/ViewBelow", "state", "1", NULL); + } + + bonobo_ui_component_add_listener(uic, "ViewAfter", emfb_show_next, emfv); + bonobo_ui_component_add_listener(uic, "ViewBelow", emfb_show_below, emfv); + /* em_folder_browser_show_wide((EMFolderBrowser *)emfv, state); */ + /* FIXME: Selection state */ /* FIXME: property menu customisation */ diff --git a/mail/em-folder-browser.h b/mail/em-folder-browser.h index b414a19489..f31f78fd93 100644 --- a/mail/em-folder-browser.h +++ b/mail/em-folder-browser.h @@ -51,6 +51,7 @@ GType em_folder_browser_get_type(void); GtkWidget *em_folder_browser_new(void); void em_folder_browser_show_preview(EMFolderBrowser *emfv, gboolean state); +void em_folder_browser_show_wide(EMFolderBrowser *emfv, gboolean state); #ifdef __cplusplus } diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 7add999ec3..5b002cdaa9 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -29,6 +29,7 @@ #include <glib.h> #include <glib/gstdio.h> +#include <libgnome/gnome-util.h> #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> @@ -501,7 +502,8 @@ emfv_setup_view_instance(EMFolderView *emfv) char *id; static GalViewCollection *collection = NULL; CamelFolderInfo *fi = NULL; - + gboolean show_wide = gconf_client_get_bool (mail_config_get_gconf_client (), "/apps/evolution/mail/display/show_wide", NULL); + g_assert(emfv->folder); g_assert(emfv->folder_uri); @@ -558,21 +560,44 @@ emfv_setup_view_instance(EMFolderView *emfv) /* TODO: should this go through mail-config api? */ id = mail_config_folder_to_safe_url (emfv->folder); p->view_instance = gal_view_instance_new (collection, id); + + if (show_wide) { + char *safe_id, *filename; + + /* Force to use the wide view */ + g_free (p->view_instance->custom_filename); + g_free (p->view_instance->current_view_filename); + safe_id = g_strdup (id); + e_filename_make_safe (safe_id); + filename = g_strdup_printf ("custom_wide_view-%s.xml", safe_id); + p->view_instance->custom_filename = g_concat_dir_and_file (collection->local_dir, filename); + g_free (filename); + filename = g_strdup_printf ("current_wide_view-%s.xml", safe_id); + p->view_instance->current_view_filename = g_concat_dir_and_file (collection->local_dir, filename); + g_free (safe_id); + } g_free (id); fi = camel_store_get_folder_info (emfv->folder->parent_store, emfv->folder->full_name, CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, NULL); - if (outgoing || (fi && ((fi->flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_SENT))) - gal_view_instance_set_default_view(p->view_instance, "As_Sent_Folder"); + if (outgoing || (fi && ((fi->flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_SENT))) { + if (show_wide) + gal_view_instance_set_default_view(p->view_instance, "Wide_View_Sent"); + else + gal_view_instance_set_default_view(p->view_instance, "As_Sent_Folder"); + } else if (show_wide){ + gal_view_instance_set_default_view(p->view_instance, "Wide_View_Normal"); + } + gal_view_instance_load(p->view_instance); if (!gal_view_instance_exists(p->view_instance)) { struct stat st; char *path; - + path = mail_config_folder_to_cachename (emfv->folder, "et-header-"); if (path && g_stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) { ETableSpecification *spec; @@ -610,6 +635,11 @@ emfv_setup_view_instance(EMFolderView *emfv) } } +void em_folder_view_setup_view_instance (EMFolderView *emfv) +{ + emfv_setup_view_instance (emfv); +} + /* ********************************************************************** */ static void diff --git a/mail/em-folder-view.h b/mail/em-folder-view.h index 87dff43634..8c8669c897 100644 --- a/mail/em-folder-view.h +++ b/mail/em-folder-view.h @@ -138,6 +138,7 @@ guint32 em_folder_view_disable_mask(EMFolderView *emfv); void em_folder_view_set_statusbar(EMFolderView *emfv, gboolean statusbar); void em_folder_view_set_hide_deleted(EMFolderView *emfv, gboolean status); +void em_folder_view_setup_view_instance (EMFolderView *emfv); #ifdef __cplusplus } diff --git a/mail/evolution-mail.schemas.in.in b/mail/evolution-mail.schemas.in.in index f4466ac44e..ce437bbd80 100644 --- a/mail/evolution-mail.schemas.in.in +++ b/mail/evolution-mail.schemas.in.in @@ -318,6 +318,20 @@ </schema> <schema> + <key>/schemas/apps/evolution/mail/display/show_email</key> + <applyto>/apps/evolution/mail/display/show_email</applyto> + <owner>evolution-mail</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Show the sender email in the messages column in the message list</short> + <long> + Show the email of the sender in the messages composite column in the message list + </long> + </locale> + </schema> + + <schema> <key>/schemas/apps/evolution/mail/display/mark_seen_timeout</key> <applyto>/apps/evolution/mail/display/mark_seen_timeout</applyto> <owner>evolution-mail</owner> @@ -374,6 +388,34 @@ </schema> <schema> + <key>/schemas/apps/evolution/mail/display/hpaned_size</key> + <applyto>/apps/evolution/mail/display/hpaned_size</applyto> + <owner>evolution-mail</owner> + <type>int</type> + <default>450</default> + <locale name="C"> + <short>Width of the message-list pane</short> + <long> + Width of the message-list pane. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/mail/display/show_wide</key> + <applyto>/apps/evolution/mail/display/show_wide</applyto> + <owner>evolution-mail</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Use side-by-side or wide layout</short> + <long> + If the "Preview" pane is on, then show it side-by-side rather than vertically. + </long> + </locale> + </schema> + + <schema> <key>/schemas/apps/evolution/mail/display/fonts/variable</key> <applyto>/apps/evolution/mail/display/fonts/variable</applyto> <owner>evolution-mail</owner> diff --git a/mail/message-list.c b/mail/message-list.c index 999fef410c..3358e75833 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -900,7 +900,10 @@ ml_duplicate_value (ETreeModel *etm, int col, const void *value, void *data) case COL_FROM: case COL_SUBJECT: case COL_TO: - case COL_SENDER: + case COL_SENDER: + case COL_RECIPIENTS: + case COL_MIXED_SENDER: + case COL_MIXED_RECIPIENTS: case COL_FOLLOWUP_FLAG: case COL_LOCATION: return g_strdup (value); @@ -932,7 +935,10 @@ ml_free_value (ETreeModel *etm, int col, void *value, void *data) case COL_TO: case COL_FOLLOWUP_FLAG: case COL_LOCATION: - case COL_SENDER: + case COL_SENDER: + case COL_RECIPIENTS: + case COL_MIXED_SENDER: + case COL_MIXED_RECIPIENTS: g_free (value); break; default: @@ -963,6 +969,9 @@ ml_initialize_value (ETreeModel *etm, int col, void *data) case COL_FOLLOWUP_FLAG: case COL_LOCATION: case COL_SENDER: + case COL_RECIPIENTS: + case COL_MIXED_SENDER: + case COL_MIXED_RECIPIENTS: return g_strdup (""); default: g_assert_not_reached (); @@ -993,7 +1002,10 @@ ml_value_is_empty (ETreeModel *etm, int col, const void *value, void *data) case COL_TO: case COL_FOLLOWUP_FLAG: case COL_LOCATION: - case COL_SENDER: + case COL_SENDER: + case COL_RECIPIENTS: + case COL_MIXED_SENDER: + case COL_MIXED_RECIPIENTS: return !(value && *(char *)value); default: g_assert_not_reached (); @@ -1058,7 +1070,10 @@ ml_value_to_string (ETreeModel *etm, int col, const void *value, void *data) case COL_TO: case COL_FOLLOWUP_FLAG: case COL_LOCATION: - case COL_SENDER: + case COL_SENDER: + case COL_RECIPIENTS: + case COL_MIXED_SENDER: + case COL_MIXED_RECIPIENTS: return g_strdup (value); default: g_assert_not_reached (); @@ -1146,6 +1161,49 @@ subtree_earliest(MessageList *ml, ETreePath node, int sent) return earliest; } +static gchar * +sanitize_recipients (const gchar *string) +{ + GString *gstring; + gboolean quoted = FALSE; + const gchar *p; + GString *recipients = g_string_new (""); + char *single_add; + char **name; + + if (!string || !*string) + return ""; + + gstring = g_string_new (""); + + for (p = string; *p; p = g_utf8_next_char (p)) { + gunichar c = g_utf8_get_char (p); + + if (c == '"') + quoted = ~quoted; + else if (c == ',' && !quoted) { + single_add = g_string_free (gstring, FALSE); + name = g_strsplit(single_add,"<",2); + g_string_append (recipients, *name); + g_string_append (recipients, ","); + g_free (single_add); + g_strfreev (name); + gstring = g_string_new (""); + continue; + } + + g_string_append_unichar (gstring, c); + } + + single_add = g_string_free (gstring, FALSE); + name = g_strsplit(single_add,"<",2); + g_string_append (recipients, *name); + g_free (single_add); + g_strfreev (name); + + return g_string_free (recipients, FALSE); +} + static void * ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) { @@ -1296,17 +1354,23 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) camel_object_get(folder, NULL, CAMEL_OBJECT_DESCRIPTION, &name, 0); return name; } - case COL_SENDER:{ + case COL_MIXED_RECIPIENTS: + case COL_RECIPIENTS:{ char **sender_name; + str = camel_message_info_to (msg_info); + + return sanitize_recipients(str); + } + case COL_MIXED_SENDER: + case COL_SENDER:{ + char **sender_name = NULL; str = camel_message_info_from (msg_info); if(str!=""){ sender_name=g_strsplit(str,"<",2); return (void *)(*sender_name); } else - return (void *)(""); - - g_strfreev(sender_name); + return (void *)(""); } default: g_assert_not_reached (); @@ -1408,6 +1472,56 @@ filter_date (time_t date) return g_strdup (buf); } +static ECell * create_composite_cell (int col) +{ + ECell *cell_vbox, *cell_hbox, *cell_sub, *cell_date, *cell_from, *cell_tree, *cell_attach; + GdkPixbuf *images [7]; + GConfClient *gconf; + char *fixed_name = NULL; + gboolean show_email; + int i; + int alt_col = (col == COL_FROM) ? COL_SENDER : COL_RECIPIENTS; + + gconf = mail_config_get_gconf_client (); + fixed_name = gconf_client_get_string (gconf, "/desktop/gnome/interface/monospace_font_name", NULL); + show_email = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_email", NULL); + + cell_vbox = e_cell_vbox_new (); + + cell_hbox = e_cell_hbox_new (); + + for (i = 0; i < 2; i++) + images [i] = states_pixmaps [i + 5].pixbuf; + cell_attach = e_cell_toggle_new (0, 2, images); + + cell_date = e_cell_date_new(NULL, GTK_JUSTIFY_RIGHT); + g_object_set (G_OBJECT (cell_date), + "bold_column", COL_UNREAD, + "color_column", COL_COLOUR, + NULL); + + cell_from = e_cell_text_new(NULL, GTK_JUSTIFY_LEFT); + g_object_set (G_OBJECT (cell_from), + "bold_column", COL_UNREAD, + "color_column", COL_COLOUR, + NULL); + + e_cell_hbox_append (cell_hbox, cell_from, show_email ? col : alt_col, 68); + e_cell_hbox_append (cell_hbox, cell_attach, COL_ATTACHMENT, 5); + e_cell_hbox_append (cell_hbox, cell_date, COL_SENT, 27); + + cell_sub = e_cell_text_new(fixed_name? fixed_name:NULL, GTK_JUSTIFY_LEFT); + g_object_set (G_OBJECT (cell_sub), +/* "bold_column", COL_UNREAD, */ + "color_column", COL_COLOUR, + NULL); + cell_tree = e_cell_tree_new (NULL, NULL, TRUE, cell_sub); + e_cell_vbox_append (cell_vbox, cell_hbox, COL_FROM); + e_cell_vbox_append (cell_vbox, cell_tree, COL_SUBJECT); + + return cell_vbox; +} + static ETableExtras * message_list_create_extras (void) { @@ -1415,7 +1529,7 @@ message_list_create_extras (void) GdkPixbuf *images [7]; ETableExtras *extras; ECell *cell; - + extras = e_table_extras_new (); e_table_extras_add_pixbuf (extras, "status", states_pixmaps [0].pixbuf); e_table_extras_add_pixbuf (extras, "score", states_pixmaps [13].pixbuf); @@ -1475,6 +1589,13 @@ message_list_create_extras (void) NULL); e_table_extras_add_cell (extras, "render_size", cell); + /* Composite cell for wide view */ + cell = create_composite_cell (COL_FROM); + e_table_extras_add_cell (extras, "render_composite_from", cell); + + cell = create_composite_cell (COL_TO); + e_table_extras_add_cell (extras, "render_composite_to", cell); + return extras; } diff --git a/mail/message-list.etspec b/mail/message-list.etspec index 2bb1ecf0c4..84587e367f 100644 --- a/mail/message-list.etspec +++ b/mail/message-list.etspec @@ -7,15 +7,15 @@ <ETableColumn model_col="3" _title="Attachment" pixbuf="attachment" expansion="0.0" minimum_width="18" resizable="false" cell="render_attachment" compare="integer" sortable="false"/> - <ETableColumn model_col="4" compare_col="15" _title="From" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare" search="string" priority="10"/> + <ETableColumn model_col="4" compare_col="18" _title="From" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare" search="string" priority="10"/> - <ETableColumn model_col="5" compare_col="16" _title="Subject" expansion="1.6" minimum_width="32" resizable="true" cell="render_tree" compare="string" search="string"/> + <ETableColumn model_col="5" compare_col="19" _title="Subject" expansion="1.6" minimum_width="32" resizable="true" cell="render_tree" compare="string" search="string"/> <ETableColumn model_col="6" _title="Date" expansion="0.4" minimum_width="32" resizable="true" cell="render_date" compare="integer"/> <ETableColumn model_col="7" _title="Received" expansion="0.4" minimum_width="32" resizable="true" cell="render_date" compare="integer"/> - <ETableColumn model_col="8" compare_col="17" _title="To" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare" search="string" priority="5"/> + <ETableColumn model_col="8" compare_col="20" _title="To" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare" search="string" priority="5"/> <ETableColumn model_col="9" _title="Size" expansion="0.2" minimum_width="32" resizable="true" cell="render_size" compare="integer"/> @@ -28,6 +28,9 @@ <ETableColumn model_col="13" _title="Original Location" expansion="0.2" minimum_width="32" resizable="true" cell="render_text" compare="string"/> <ETableColumn model_col="14" _title="Sender" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare" search="string" priority="10"/> + <ETableColumn model_col="15" _title="Recipients" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare" search="string" priority="10"/> + <ETableColumn model_col="16" _title="Messages" expansion="1.0" minimum_width="32" resizable="true" cell="render_composite_from" compare="address_compare" search="string" priority="10" sortable="false"/> + <ETableColumn model_col="17" _title="Sent Messages" expansion="1.0" minimum_width="32" resizable="true" cell="render_composite_to" compare="address_compare" search="string" priority="10" sortable="false"/> <ETableState> <column source="0"/> <column source="3"/> <column source="1"/> diff --git a/mail/message-list.h b/mail/message-list.h index 4033d037a5..2b77d0b96b 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -57,6 +57,9 @@ enum { COL_FOLLOWUP_DUE_BY, COL_LOCATION, /* vfolder location? */ COL_SENDER, + COL_RECIPIENTS, + COL_MIXED_SENDER, + COL_MIXED_RECIPIENTS, /* normalised strings */ COL_FROM_NORM, diff --git a/ui/ChangeLog b/ui/ChangeLog index 267361de95..6e66fe9f9a 100644 --- a/ui/ChangeLog +++ b/ui/ChangeLog @@ -1,3 +1,11 @@ +2006-06-02 Srinivasa Ragavan <sragavan@novell.com> + + * evolution-mail-global.xml: Added menu item for wide view. + * evolution-mail-list.xml: Adjusted the separator for threads + * evolution-mail-message.xml: Combined the zoom option to a submenu. + * evolution.xml: Combined the side bar/toolbar/status bar to a submenu + to avoid the large growing View menu. + 2006-04-27 Rodney Dawes <dobey@novell.com> * evolution-mail-global.xml: Don't set gtk-delete as the stock icon diff --git a/ui/evolution-mail-global.xml b/ui/evolution-mail-global.xml index 9626907c47..fd1d514167 100644 --- a/ui/evolution-mail-global.xml +++ b/ui/evolution-mail-global.xml @@ -35,6 +35,12 @@ accel="*Control*m" type="toggle"/> + <cmd name="ViewBelow" _label="_Classic View" + type="radio" group="preview_display" _tip="Show message preview below the message list"/> + + <cmd name="ViewAfter" _label="_Vertical View" + type="radio" group="preview_display" _tip="Show message preview side-by-side with the message list"/> + </commands> <keybindings> @@ -50,10 +56,14 @@ </submenu> <submenu name="View" _label="_View"> - <placeholder name="ViewPreview"> - <menuitem name="ViewPreview" verb="" _label="Message _Preview"/> + <placeholder name="ViewPreview"> + <submenu name="Preview" _label="_Preview"> + <menuitem name="ViewPreview" verb="" _label="Show Message _Preview"/> + <separator name="previewsep"/> + <menuitem name="ViewBelow" id="ViewBelow" _label="_Classic View"/> + <menuitem name="ViewAfter" id="ViewAfter" _label="_Vertical View"/> + </submenu> </placeholder> - <separator f="" name="emailglobal"/> <placeholder name="MailMessageFilter"/> <placeholder name="MailMessageView"/> diff --git a/ui/evolution-mail-list.xml b/ui/evolution-mail-list.xml index 5d75bb9d96..e95147510e 100644 --- a/ui/evolution-mail-list.xml +++ b/ui/evolution-mail-list.xml @@ -77,9 +77,8 @@ <menuitem name="ViewThreaded" verb="" _label="_Group By Threads"/> <menuitem name="ViewThreadsExpandAll" verb="" _label="E_xpand All Threads"/> <menuitem name="ViewThreadsCollapseAll" verb="" _label="Collapse All _Threads"/> - - <menuitem name="HideDeleted" verb="" _label="Hide _Deleted Messages"/> <separator f="" name="emaillist"/> + <menuitem name="HideDeleted" verb="" _label="Hide _Deleted Messages"/> <menuitem name="ViewHideSelected" verb="" _label="Hide S_elected Messages"/> <menuitem name="ViewHideRead" verb="" _label="Hide _Read Messages"/> <menuitem name="ViewShowAll" verb="" _label="Sh_ow Hidden Messages"/> diff --git a/ui/evolution-mail-message.xml b/ui/evolution-mail-message.xml index e3003fa9d9..0bc0867aea 100644 --- a/ui/evolution-mail-message.xml +++ b/ui/evolution-mail-message.xml @@ -286,7 +286,7 @@ <submenu name="View"> <placeholder name="MailMessageZoom"> - <separator f="" name="emaillist"/> + <submenu name="zoom" _label="_Zoom"> <menuitem name="TextZoomIn" verb="" _label="_Zoom In" pixtype="stock" pixname="gtk-zoom-in"/> <menuitem name="TextZoomOut" verb="" _label="Zoom _Out" @@ -294,7 +294,7 @@ <menuitem name="TextZoomReset" verb="" _label="_Normal Size" pixtype="stock" pixname="gtk-zoom-100"/> - + </submenu> </placeholder> <placeholder name="MailViewType"> diff --git a/ui/evolution.xml b/ui/evolution.xml index d23903b4b4..18102e461a 100644 --- a/ui/evolution.xml +++ b/ui/evolution.xml @@ -25,13 +25,13 @@ <cmd name="ViewButtonsHide" _label="_Hide buttons" type="toggle" _tip="Hide window buttons"/> - <cmd name="ViewToolbar" _label="Tool_bar" type="toggle" + <cmd name="ViewToolbar" _label="Show _Toolbar" type="toggle" _tip="Change the visibility of the toolbar" state="1"/> - <cmd name="ViewStatusBar" _label="Status _Bar" type="toggle" + <cmd name="ViewStatusBar" _label="Show _Status Bar" type="toggle" _tip="View/Hide the Status Bar" state="1"/> - <cmd name="ViewSideBar" _label="Side _Bar" type="toggle" + <cmd name="ViewSideBar" _label="Show Side _Bar" type="toggle" _tip="View/Hide the Side Bar" state="1"/> <cmd name="HelpSubmitBug" _label="Submit Bug Report" @@ -114,9 +114,11 @@ <submenu name="View" _label="_View"> <placeholder name="ViewBegin"/> <submenu name="Window" _label="_Window"/> + <submenu name="layout" _label="La_yout"> <menuitem name="ViewToolbar" id="ViewToolbar" verb=""/> <menuitem name="ViewStatusBar" id="ViewStatusBar"/> <menuitem name="ViewSideBar" id="ViewSideBar"/> + </submenu> <placeholder name="ViewPreview"/> <submenu name="Buttons" _label="_Switcher Appearance"> <menuitem name="ViewButtonsIconText" id="ViewButtonsIconText" verb=""/> diff --git a/views/ChangeLog b/views/ChangeLog index bb9b541de3..8e0463770c 100644 --- a/views/ChangeLog +++ b/views/ChangeLog @@ -1,3 +1,13 @@ +2006-06-02 Srinivasa Ragavan <sragavan@novell.com> + + * mail/Makefile.am: Added two new views Wide_View_Sent.galview + and Wide_View_Normal.galview to help views in wide mode. + * mail/galview.xml: Added them to views menu. + * mail/Wide_View_Normal.galview: Added a new default galview with + composite headers for normal folders. + * mail/Wide_View_Sent.galview: Added a new default galview with + composite headers for sent/draft folders. + 2005-10-19 Harish Krishnaswamy <kharish@novell.com> Committing for Nathan Owens <pianocomp81@yahoo.com> diff --git a/views/mail/Makefile.am b/views/mail/Makefile.am index 6a99b39500..add64a19a9 100644 --- a/views/mail/Makefile.am +++ b/views/mail/Makefile.am @@ -1,3 +1,3 @@ mailviewsdir = $(viewsdir)/mail -mailviews_DATA = As_Sent_Folder.galview By_Sender.galview By_Status.galview By_Subject.galview Messages.galview By_Follow_Up_Flag.galview galview.xml +mailviews_DATA = As_Sent_Folder.galview By_Sender.galview By_Status.galview By_Subject.galview Messages.galview By_Follow_Up_Flag.galview galview.xml Wide_View_Normal.galview Wide_View_Sent.galview EXTRA_DIST = $(mailviews_DATA) diff --git a/views/mail/Wide_View_Normal.galview b/views/mail/Wide_View_Normal.galview new file mode 100644 index 0000000000..9baed882a6 --- /dev/null +++ b/views/mail/Wide_View_Normal.galview @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<ETableState state-version="0.100000000000000"> + <column source="0"/> + <column source="1"/> + <column source="16"/> + <grouping/> +</ETableState> diff --git a/views/mail/Wide_View_Sent.galview b/views/mail/Wide_View_Sent.galview new file mode 100644 index 0000000000..1f1e488550 --- /dev/null +++ b/views/mail/Wide_View_Sent.galview @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<ETableState state-version="0.100000000000000"> + <column source="0"/> + <column source="1"/> + <column source="17"/> + <grouping/> +</ETableState> diff --git a/views/mail/galview.xml b/views/mail/galview.xml index 6a5d1e1ac4..11fe5fc61d 100644 --- a/views/mail/galview.xml +++ b/views/mail/galview.xml @@ -6,4 +6,6 @@ <GalView id="By_Sender" _title="By Se_nder" filename="By_Sender.galview" type="etable"/> <GalView id="By_Status" _title="By S_tatus" filename="By_Status.galview" type="etable"/> <GalView id="By_Follow_Up_Flag" _title="By _Follow Up Flag" filename="By_Follow_Up_Flag.galview" type="etable"/> + <GalView id="Wide_View_Normal" _title="For _Wide View" filename="Wide_View_Normal.galview" type="etable"/> + <GalView id="Wide_View_Sent" _title="As Sent Folder for Wi_de View" filename="Wide_View_Sent.galview" type="etable"/> </GalViewCollection> diff --git a/widgets/ChangeLog b/widgets/ChangeLog index d350d41d9e..f563b60caf 100644 --- a/widgets/ChangeLog +++ b/widgets/ChangeLog @@ -1,3 +1,19 @@ +2006-06-02 Srinivasa Ragavan <sragavan@novell.com> + + ** Added a new hbox cell renderer and a new Sort By menu to e-table to + sort by columns not shown in the table. + + * table/Makefile.am: + * table/e-cell-text.c: (build_layout): Added support for font + rendering in cell + * table/e-cell-tree.c: (ect_event): Fixed a bug where the expander + animates in arbitary position. + * table/e-table-header-item.c: (ethi_popup_customize_view), + (sort_by_id), (popup_custom), (ethi_header_context_menu), + (ethi_event): Added a new Sort by menu, to the e-table headers, which + helps to easily sort by columns without adding that column. + * table/e-cell-hbox.[ch]: Added a new hbox renderer. + 2006-01-30 Kjartan Maraas <kmaraas@gnome.org> * e-timezone-dialog/e-timezone-dialog.c: (get_zone_from_point): diff --git a/widgets/table/Makefile.am b/widgets/table/Makefile.am index 2732ee6c6c..72a804a445 100644 --- a/widgets/table/Makefile.am +++ b/widgets/table/Makefile.am @@ -35,6 +35,7 @@ libetable_la_SOURCES = \ e-cell-toggle.c \ e-cell-tree.c \ e-cell-vbox.c \ + e-cell-hbox.c \ e-table-click-to-add.c \ e-table-col.c \ e-table-column-specification.c \ @@ -98,6 +99,7 @@ libetableinclude_HEADERS = \ e-cell-toggle.h \ e-cell-tree.h \ e-cell-vbox.h \ + e-cell-hbox.h \ e-table-click-to-add.h \ e-table-col-dnd.h \ e-table-col.h \ diff --git a/widgets/table/e-cell-hbox.c b/widgets/table/e-cell-hbox.c new file mode 100644 index 0000000000..722f1eb507 --- /dev/null +++ b/widgets/table/e-cell-hbox.c @@ -0,0 +1,323 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * e-cell-hbox.c - Hbox cell object. + * Copyright 2006 Novell, Inc. + * + * Authors: + * Srinivasa Ragavan <sragavan@novell.com> + * + * A majority of code taken from: + * + * the ECellText renderer. + * Copyright 1999, 2000, Ximian, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License, version 2, as published by the Free Software Foundation. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include <config.h> + +#include <ctype.h> +#include <math.h> +#include <stdio.h> + +#include <gtk/gtk.h> + +/* #include "a11y/e-table/gal-a11y-e-cell-registry.h" */ +/* #include "a11y/e-table/gal-a11y-e-cell-vbox.h" */ +#include "e-util/e-util.h" + +#include "e-cell-hbox.h" +#include "e-table-item.h" + +#define PARENT_TYPE e_cell_get_type () + +static ECellClass *parent_class; + +#define INDENT_AMOUNT 16 +#define MAX_CELL_SIZE 25 + +/* + * ECell::new_view method + */ +static ECellView * +ecv_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) +{ + ECellHbox *ecv = E_CELL_HBOX (ecell); + ECellHboxView *hbox_view = g_new0 (ECellHboxView, 1); + int i; + + hbox_view->cell_view.ecell = ecell; + hbox_view->cell_view.e_table_model = table_model; + hbox_view->cell_view.e_table_item_view = e_table_item_view; + + /* create our subcell view */ + hbox_view->subcell_view_count = ecv->subcell_count; + hbox_view->subcell_views = g_new (ECellView *, hbox_view->subcell_view_count); + hbox_view->model_cols = g_new (int, hbox_view->subcell_view_count); + hbox_view->def_size_cols = g_new (int, hbox_view->subcell_view_count); + + for (i = 0; i < hbox_view->subcell_view_count; i++) { + hbox_view->subcell_views[i] = e_cell_new_view (ecv->subcells[i], table_model, e_table_item_view /* XXX */); + hbox_view->model_cols[i] = ecv->model_cols[i]; + hbox_view->def_size_cols[i] = ecv->def_size_cols[i]; + } + + return (ECellView *)hbox_view; +} + +/* + * ECell::kill_view method + */ +static void +ecv_kill_view (ECellView *ecv) +{ + ECellHboxView *hbox_view = (ECellHboxView *) ecv; + int i; + + /* kill our subcell view */ + for (i = 0; i < hbox_view->subcell_view_count; i++) + e_cell_kill_view (hbox_view->subcell_views[i]); + + g_free (hbox_view->model_cols); + g_free (hbox_view->def_size_cols); + g_free (hbox_view->subcell_views); + g_free (hbox_view); +} + +/* + * ECell::realize method + */ +static void +ecv_realize (ECellView *ecell_view) +{ + ECellHboxView *hbox_view = (ECellHboxView *) ecell_view; + int i; + + /* realize our subcell view */ + for (i = 0; i < hbox_view->subcell_view_count; i++) + e_cell_realize (hbox_view->subcell_views[i]); + + if (parent_class->realize) + (* parent_class->realize) (ecell_view); +} + +/* + * ECell::unrealize method + */ +static void +ecv_unrealize (ECellView *ecv) +{ + ECellHboxView *hbox_view = (ECellHboxView *) ecv; + int i; + + /* unrealize our subcell view. */ + for (i = 0; i < hbox_view->subcell_view_count; i++) + e_cell_unrealize (hbox_view->subcell_views[i]); + + if (parent_class->unrealize) + (* parent_class->unrealize) (ecv); +} + +/* + * ECell::draw method + */ +static void +ecv_draw (ECellView *ecell_view, GdkDrawable *drawable, + int model_col, int view_col, int row, ECellFlags flags, + int x1, int y1, int x2, int y2) +{ + ECellHboxView *hbox_view = (ECellHboxView *)ecell_view; + + int subcell_offset = 0; + int i; + int allotted_width = x2-x1; + + for (i = 0; i < hbox_view->subcell_view_count; i++) { + /* Now cause our subcells to draw their contents, + shifted by subcell_offset pixels */ + int width = allotted_width * hbox_view->def_size_cols[i] / 100; + //e_cell_max_width_by_row (hbox_view->subcell_views[i], hbox_view->model_cols[i], view_col, row); +// if (width < hbox_view->def_size_cols[i]) + // width = hbox_view->def_size_cols[i]; +// printf("width of %d %d of %d\n", width,hbox_view->def_size_cols[i], allotted_width ); + e_cell_draw (hbox_view->subcell_views[i], drawable, + hbox_view->model_cols[i], view_col, row, flags, + x1 + subcell_offset , y1, x1 + subcell_offset + width, y2); + + subcell_offset += width; //e_cell_max_width_by_row (hbox_view->subcell_views[i], hbox_view->model_cols[i], view_col, row); + } +} + +/* + * ECell::event method + */ +static gint +ecv_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions) +{ + ECellHboxView *hbox_view = (ECellHboxView *)ecell_view; + int y = 0; + int i; + int subcell_offset = 0; + + switch (event->type) { + case GDK_BUTTON_PRESS: + case GDK_BUTTON_RELEASE: + case GDK_2BUTTON_PRESS: + case GDK_3BUTTON_PRESS: + y = event->button.y; + break; + case GDK_MOTION_NOTIFY: + y = event->motion.y; + break; + default: + /* nada */ + break; + } + + for (i = 0; i < hbox_view->subcell_view_count; i++) { + int width = e_cell_max_width_by_row (hbox_view->subcell_views[i], hbox_view->model_cols[i], view_col, row); + if (width < hbox_view->def_size_cols[i]) + width = hbox_view->def_size_cols[i]; + if (y < subcell_offset + width) + return e_cell_event(hbox_view->subcell_views[i], event, hbox_view->model_cols[i], view_col, row, flags, actions); + subcell_offset += width; + } + return 0; +} + +/* + * ECell::height method + */ +static int +ecv_height (ECellView *ecell_view, int model_col, int view_col, int row) +{ + ECellHboxView *hbox_view = (ECellHboxView *)ecell_view; + int height = 0, max_height = 0; + int i; + + for (i = 0; i < hbox_view->subcell_view_count; i++) { + height = e_cell_height (hbox_view->subcell_views[i], hbox_view->model_cols[i], view_col, row); + max_height = MAX(max_height, height); + } + return max_height; +} + +/* + * ECell::max_width method + */ +static int +ecv_max_width (ECellView *ecell_view, int model_col, int view_col) +{ + ECellHboxView *hbox_view = (ECellHboxView *)ecell_view; + int width = 0; + int i; + + for (i = 0; i < hbox_view->subcell_view_count; i++) { + int cell_width = e_cell_max_width (hbox_view->subcell_views[i], hbox_view->model_cols[i], view_col); + + if (cell_width < hbox_view->def_size_cols[i]) + cell_width = hbox_view->def_size_cols[i]; + width += cell_width; + } + + return width; +} + +/* + * GObject::dispose method + */ +static void +ecv_dispose (GObject *object) +{ + ECellHbox *ecv = E_CELL_HBOX (object); + int i; + + /* destroy our subcell */ + for (i = 0; i < ecv->subcell_count; i++) + if (ecv->subcells[i]) + g_object_unref (ecv->subcells[i]); + g_free (ecv->subcells); + ecv->subcells = NULL; + ecv->subcell_count = 0; + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static void +e_cell_hbox_class_init (GObjectClass *object_class) +{ + ECellClass *ecc = (ECellClass *) object_class; + + object_class->dispose = ecv_dispose; + + ecc->new_view = ecv_new_view; + ecc->kill_view = ecv_kill_view; + ecc->realize = ecv_realize; + ecc->unrealize = ecv_unrealize; + ecc->draw = ecv_draw; + ecc->event = ecv_event; + ecc->height = ecv_height; + + ecc->max_width = ecv_max_width; + + parent_class = g_type_class_ref (PARENT_TYPE); + +/* gal_a11y_e_cell_registry_add_cell_type (NULL, E_CELL_HBOX_TYPE, gal_a11y_e_cell_hbox_new); */ +} + +static void +e_cell_hbox_init (GtkObject *object) +{ + ECellHbox *ecv = E_CELL_HBOX (object); + + ecv->subcells = NULL; + ecv->subcell_count = 0; +} + +E_MAKE_TYPE(e_cell_hbox, "ECellHbox", ECellHbox, e_cell_hbox_class_init, e_cell_hbox_init, PARENT_TYPE) + +/** + * e_cell_hbox_new: + * + * Creates a new ECell renderer that can be used to render multiple + * child cells. + * + * Return value: an ECell object that can be used to render multiple + * child cells. + **/ +ECell * +e_cell_hbox_new (void) +{ + ECellHbox *ecv = g_object_new (E_CELL_HBOX_TYPE, NULL); + + return (ECell *) ecv; +} + +void +e_cell_hbox_append (ECellHbox *hbox, ECell *subcell, int model_col, int size) +{ + hbox->subcell_count ++; + + hbox->subcells = g_renew (ECell *, hbox->subcells, hbox->subcell_count); + hbox->model_cols = g_renew (int, hbox->model_cols, hbox->subcell_count); + hbox->def_size_cols = g_renew (int, hbox->def_size_cols, hbox->subcell_count); + + hbox->subcells[hbox->subcell_count - 1] = subcell; + hbox->model_cols[hbox->subcell_count - 1] = model_col; + hbox->def_size_cols[hbox->subcell_count - 1] = size; + + if (subcell) + g_object_ref (subcell); +} diff --git a/widgets/table/e-cell-hbox.h b/widgets/table/e-cell-hbox.h new file mode 100644 index 0000000000..9a5148d3f2 --- /dev/null +++ b/widgets/table/e-cell-hbox.h @@ -0,0 +1,74 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * e-cell-hbox.h - Hbox cell object. + * Copyright 2006, Novell, Inc. + * + * Authors: + * Srinivasa Ragavan <sragavan@novell.com> + * + * A majority of code taken from: + * + * the ECellText renderer. + * Copyright 1999, 2000, Ximian, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License, version 2, as published by the Free Software Foundation. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef _E_CELL_HBOX_H_ +#define _E_CELL_HBOX_H_ + +#include <libgnomecanvas/gnome-canvas.h> +#include <table/e-cell.h> + +G_BEGIN_DECLS + +#define E_CELL_HBOX_TYPE (e_cell_hbox_get_type ()) +#define E_CELL_HBOX(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_HBOX_TYPE, ECellHbox)) +#define E_CELL_HBOX_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_HBOX_TYPE, ECellHboxClass)) +#define E_IS_CELL_HBOX(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_HBOX_TYPE)) +#define E_IS_CELL_HBOX_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_HBOX_TYPE)) + +typedef struct { + ECell parent; + + int subcell_count; + ECell **subcells; + int *model_cols; + int *def_size_cols; +} ECellHbox; + +typedef struct { + ECellView cell_view; + int subcell_view_count; + ECellView **subcell_views; + int *model_cols; + int *def_size_cols; +} ECellHboxView; + +typedef struct { + ECellClass parent_class; +} ECellHboxClass; + +GType e_cell_hbox_get_type (void); +ECell *e_cell_hbox_new (void); +void e_cell_hbox_append (ECellHbox *vbox, + ECell *subcell, + int model_col, + int size); + + +G_END_DECLS + +#endif /* _E_CELL_HBOX_H_ */ diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index a446a69522..6a3ec19945 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -581,6 +581,27 @@ build_layout (ECellTextView *text_view, int row, const char *text, gint width) if (text_view->edit || width <= 0) return layout; + if (ect->font_name) + { + PangoFontDescription *desc = NULL, *fixed_desc = NULL; + char *fixed_family = NULL; + gint fixed_size; + + fixed_desc = pango_font_description_from_string (ect->font_name); + if (fixed_desc) { + fixed_family = pango_font_description_get_family (fixed_desc); + fixed_size = pango_font_description_get_size (fixed_desc); + } + + desc = pango_font_description_copy (gtk_widget_get_style (GTK_WIDGET (((GnomeCanvasItem *)ecell_view->e_table_item_view)->canvas))->font_desc); + pango_font_description_set_family (desc, fixed_family); + pango_font_description_set_size (desc, fixed_size); +/* pango_font_description_set_style (desc, PANGO_STYLE_OBLIQUE); */ + pango_layout_set_font_description (layout, desc); + pango_font_description_free (desc); + pango_font_description_free (fixed_desc); + } + pango_layout_set_width (layout, width * PANGO_SCALE); pango_layout_set_wrap (layout, PANGO_WRAP_CHAR); diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c index d42a067931..133254dd4b 100644 --- a/widgets/table/e-cell-tree.c +++ b/widgets/table/e-cell-tree.c @@ -483,9 +483,16 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, gint tmp_row = row; GdkRectangle area; animate_closure_t *closure = g_new0 (animate_closure_t, 1); + int hgt; + e_table_item_get_cell_geometry (tree_view->cell_view.e_table_item_view, &tmp_row, &view_col, &area.x, &area.y, NULL, &area.height); area.width = offset - 2; + hgt = e_cell_height (ecell_view, model_col, view_col, row); + + if (hgt != area.height) /* Composite cells */ + area.height += hgt; + draw_expander (tree_view, GTK_LAYOUT (tree_view->canvas)->bin_window, expanded ? GTK_EXPANDER_SEMI_EXPANDED : GTK_EXPANDER_SEMI_COLLAPSED, GTK_STATE_NORMAL, &area); diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 7f340f990a..74332dc61c 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -25,6 +25,7 @@ #include <config.h> #include <string.h> +#include <glib.h> #include <gtk/gtk.h> #include <libgnomecanvas/gnome-canvas.h> @@ -1449,7 +1450,7 @@ ethi_popup_customize_view(GtkWidget *widget, EthiHeaderInfo *info) ETableHeaderItem *ethi = info->ethi; ETableState *state; ETableSpecification *spec; - + if (ethi->config) e_table_config_raise (E_TABLE_CONFIG (ethi->config)); else { @@ -1502,11 +1503,37 @@ static EPopupMenu ethi_context_menu [] = { }; static void +sort_by_id (GtkWidget *menu_item, ETableHeaderItem *ethi) +{ + int col = GPOINTER_TO_INT (g_object_get_data(menu_item, "col-number")); + ETableCol *ecol; + + if (!gtk_check_menu_item_get_active(menu_item)) + return; + + ecol = e_table_header_get_column (ethi->full_header, col); + ethi_change_sort_state (ethi, ecol); +} + +static void +popup_custom (GtkWidget *menu_item, EthiHeaderInfo *info) +{ + if (!gtk_check_menu_item_get_active(menu_item)) + return; + + ethi_popup_customize_view(menu_item, info); +} +static void ethi_header_context_menu (ETableHeaderItem *ethi, GdkEventButton *event) { EthiHeaderInfo *info = g_new(EthiHeaderInfo, 1); ETableCol *col; - GtkMenu *popup; + GtkMenu *popup, *sub_menu;; + int ncol, sort_count, sort_col; + GtkWidget *menu_item; + GSList *group = NULL; + ETableSortColumn column; + info->ethi = ethi; info->col = ethi_find_col_by_x (ethi, event->x); col = e_table_header_get_column (ethi->eth, info->col); @@ -1518,6 +1545,49 @@ ethi_header_context_menu (ETableHeaderItem *ethi, GdkEventButton *event) ((e_table_header_count (ethi->eth) > 1) ? 0 : 8), ((e_table_sort_info_get_can_group (ethi->sort_info)) ? 0 : 16) + 128, info, E_I18N_DOMAIN); + + menu_item = gtk_menu_item_new_with_label (_("Sort By")); + gtk_widget_show (menu_item); + sub_menu = gtk_menu_new (); + gtk_widget_show (sub_menu); + gtk_menu_item_set_submenu (menu_item, sub_menu); + gtk_menu_shell_prepend (GTK_MENU_SHELL (popup), menu_item); + + sort_count = e_table_sort_info_sorting_get_count(ethi->sort_info); + + if (sort_count > 1 || sort_count < 1) + sort_col = -1; /* Custom sorting */ + else { + column = e_table_sort_info_sorting_get_nth(ethi->sort_info, 0); + sort_col = column.column; + } + + /* Custom */ + menu_item = gtk_radio_menu_item_new_with_label (group, _("Custom")); + group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menu_item)); + gtk_widget_show (menu_item); + gtk_menu_shell_prepend (GTK_MENU_SHELL (sub_menu), menu_item); + if (sort_col == -1) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE); + g_signal_connect (menu_item, "toggled", G_CALLBACK (popup_custom), info); + + /* Show a seperator */ + menu_item = gtk_separator_menu_item_new (); + gtk_widget_show (menu_item); + gtk_menu_shell_prepend (GTK_MENU_SHELL (sub_menu), menu_item); + /* Headers */ + for (ncol = 0; ncol<ethi->full_header->col_count; ncol++) + { + menu_item = gtk_radio_menu_item_new_with_label (group, ethi->full_header->columns[ncol]->text); + gtk_widget_show (menu_item); + gtk_menu_shell_prepend (GTK_MENU_SHELL (sub_menu), menu_item); + + if (ncol == sort_col) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE); + g_object_set_data (menu_item, "col-number", GINT_TO_POINTER (ncol)); + g_signal_connect (menu_item, "toggled", G_CALLBACK (sort_by_id), ethi); + } + g_object_ref (popup); gtk_object_sink (GTK_OBJECT (popup)); g_signal_connect (popup, "selection-done", @@ -1718,7 +1788,7 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e) ethi_end_resize (ethi); } else if (was_maybe_drag && ethi->sort_info) { ETableCol *ecol; - + ecol = e_table_header_get_column (ethi->eth, ethi_find_col_by_x (ethi, e->button.x)); ethi_change_sort_state (ethi, ecol); } |