aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog21
-rw-r--r--composer/e-msg-composer-hdrs.c13
-rw-r--r--composer/e-msg-composer.c145
-rw-r--r--composer/e-msg-composer.h2
4 files changed, 165 insertions, 16 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 9554b26bb3..c7c7f502f0 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,24 @@
+2003-04-01 Jeffrey Stedfast <fejj@ximian.com>
+
+ * e-msg-composer.c (composer_entry_focus_in_event_cb): Keep track
+ of which entry widget has focus.
+ (composer_entry_focus_out_event_cb): Same.
+ (control_entry_focus_in_event_cb): Same idea, but since this is in
+ another component, tell that component that its widget has focus
+ so it can merge bonoboui cut/copy/paste (and anything else) menus.
+ (control_entry_focus_out_event_cb): Same.
+ (setup_cut_copy_paste): Connect to the focus-in and focus-out
+ events for all the entry widgets and the html editor.
+ (menu_edit_cut_cb): New callback function since the composer will
+ now own the Cut/Copy/Paste menu items sometimes (depending on
+ which widget is in focus... confused yet? good).
+
+ * e-msg-composer-hdrs.c (from_changed): Update the Reply-To entry
+ to be a normal GtkEntry.
+ (create_headers): Same.
+ (e_msg_composer_hdrs_set_reply_to): Here too.
+ (e_msg_composer_hdrs_get_reply_to): And finally here.
+
2003-04-01 Not Zed <NotZed@Ximian.com>
** See bug #40300 & probably others.
diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c
index 2d3a9fccdc..0dc4819efd 100644
--- a/composer/e-msg-composer-hdrs.c
+++ b/composer/e-msg-composer-hdrs.c
@@ -187,7 +187,7 @@ from_changed (GtkWidget *item, gpointer data)
/* we do this rather than calling e_msg_composer_hdrs_set_reply_to()
because we don't want to change the visibility of the header */
reply_to = hdrs->account->id->reply_to;
- e_entry_set_text (E_ENTRY (hdrs->priv->reply_to.entry), reply_to ? reply_to : "");
+ gtk_entry_set_text (GTK_ENTRY (hdrs->priv->reply_to.entry), reply_to ? reply_to : "");
g_signal_emit (hdrs, signals [FROM_CHANGED], 0);
}
@@ -508,12 +508,7 @@ create_headers (EMsgComposerHdrs *hdrs)
* expects the reply_to fields to be initialized.
*/
priv->reply_to.label = gtk_label_new (_("Reply-To:"));
- priv->reply_to.entry = e_entry_new ();
- g_object_set (priv->reply_to.entry,
- "editable", TRUE,
- "use_ellipsis", TRUE,
- "allow_newlines", FALSE,
- NULL);
+ priv->reply_to.entry = gtk_entry_new ();
/*
* From
@@ -1055,7 +1050,7 @@ e_msg_composer_hdrs_set_reply_to (EMsgComposerHdrs *hdrs,
{
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
- e_entry_set_text (E_ENTRY (hdrs->priv->reply_to.entry), reply_to ? reply_to : "");
+ gtk_entry_set_text (GTK_ENTRY (hdrs->priv->reply_to.entry), reply_to ? reply_to : "");
if (reply_to && *reply_to)
set_pair_visibility (hdrs, &hdrs->priv->cc, TRUE);
@@ -1152,7 +1147,7 @@ e_msg_composer_hdrs_get_reply_to (EMsgComposerHdrs *hdrs)
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
- reply_to = e_entry_get_text (E_ENTRY (hdrs->priv->reply_to.entry));
+ reply_to = gtk_entry_get_text (GTK_ENTRY (hdrs->priv->reply_to.entry));
if (!reply_to || *reply_to == '\0')
return NULL;
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 7da1a5d453..3c0a33cdda 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1661,6 +1661,51 @@ menu_file_add_attachment_cb (BonoboUIComponent *uic,
}
static void
+menu_edit_cut_cb (BonoboUIComponent *uic, void *data, const char *path)
+{
+ EMsgComposer *composer = data;
+
+ g_return_if_fail (composer->focused_entry != NULL);
+
+ if (GTK_IS_ENTRY (composer->focused_entry)) {
+ gtk_editable_cut_clipboard (GTK_EDITABLE (composer->focused_entry));
+ } else {
+ /* happy happy joy joy, an EEntry. */
+ g_assert_not_reached ();
+ }
+}
+
+static void
+menu_edit_copy_cb (BonoboUIComponent *uic, void *data, const char *path)
+{
+ EMsgComposer *composer = data;
+
+ g_return_if_fail (composer->focused_entry != NULL);
+
+ if (GTK_IS_ENTRY (composer->focused_entry)) {
+ gtk_editable_copy_clipboard (GTK_EDITABLE (composer->focused_entry));
+ } else {
+ /* happy happy joy joy, an EEntry. */
+ g_assert_not_reached ();
+ }
+}
+
+static void
+menu_edit_paste_cb (BonoboUIComponent *uic, void *data, const char *path)
+{
+ EMsgComposer *composer = data;
+
+ g_return_if_fail (composer->focused_entry != NULL);
+
+ if (GTK_IS_ENTRY (composer->focused_entry)) {
+ gtk_editable_paste_clipboard (GTK_EDITABLE (composer->focused_entry));
+ } else {
+ /* happy happy joy joy, an EEntry. */
+ g_assert_not_reached ();
+ }
+}
+
+static void
menu_edit_delete_all_cb (BonoboUIComponent *uic, void *data, const char *path)
{
CORBA_Environment ev;
@@ -1851,17 +1896,21 @@ menu_changed_charset_cb (BonoboUIComponent *component,
static BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("FileOpen", menu_file_open_cb),
- BONOBO_UI_VERB ("FileSave", menu_file_save_cb),
+ BONOBO_UI_VERB ("FileOpen", menu_file_open_cb),
+ BONOBO_UI_VERB ("FileSave", menu_file_save_cb),
BONOBO_UI_VERB ("FileSaveAs", menu_file_save_as_cb),
BONOBO_UI_VERB ("FileSaveDraft", menu_file_save_draft_cb),
- BONOBO_UI_VERB ("FileClose", menu_file_close_cb),
+ BONOBO_UI_VERB ("FileClose", menu_file_close_cb),
- BONOBO_UI_VERB ("FileAttach", menu_file_add_attachment_cb),
+ BONOBO_UI_VERB ("FileAttach", menu_file_add_attachment_cb),
- BONOBO_UI_VERB ("FileSend", menu_file_send_cb),
+ BONOBO_UI_VERB ("FileSend", menu_file_send_cb),
- BONOBO_UI_VERB ("DeleteAll", menu_edit_delete_all_cb),
+ BONOBO_UI_VERB ("EditCut", menu_edit_cut_cb),
+ BONOBO_UI_VERB ("EditCopy", menu_edit_copy_cb),
+ BONOBO_UI_VERB ("EditPaste", menu_edit_paste_cb),
+
+ BONOBO_UI_VERB ("DeleteAll", menu_edit_delete_all_cb),
BONOBO_UI_VERB_END
};
@@ -2579,6 +2628,8 @@ init (EMsgComposer *composer)
composer->extra_hdr_names = g_ptr_array_new ();
composer->extra_hdr_values = g_ptr_array_new ();
+ composer->focused_entry = NULL;
+
composer->editor = NULL;
composer->address_dialog = NULL;
@@ -2746,6 +2797,84 @@ composer_key_pressed (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
return FALSE; /* Not handled. */
}
+
+/* All this snot is so that Cut/Copy/Paste work. */
+static gboolean
+composer_entry_focus_in_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
+{
+ EMsgComposer *composer = user_data;
+
+ composer->focused_entry = widget;
+
+ return FALSE;
+}
+
+static gboolean
+composer_entry_focus_out_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
+{
+ EMsgComposer *composer = user_data;
+
+ g_assert (composer->focused_entry == widget);
+ composer->focused_entry = NULL;
+
+ return FALSE;
+}
+
+static gboolean
+control_entry_focus_in_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
+{
+ EMsgComposer *composer = user_data;
+
+ g_assert (composer->focused_entry == NULL);
+
+ bonobo_control_frame_control_activate (bonobo_widget_get_control_frame (BONOBO_WIDGET (widget)));
+
+ return FALSE;
+}
+
+static gboolean
+control_entry_focus_out_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
+{
+ EMsgComposer *composer = user_data;
+
+ g_assert (composer->focused_entry == NULL);
+
+ bonobo_control_frame_control_deactivate (bonobo_widget_get_control_frame (BONOBO_WIDGET (widget)));
+
+ return FALSE;
+}
+
+static void
+setup_cut_copy_paste (EMsgComposer *composer)
+{
+ EMsgComposerHdrs *hdrs;
+ GtkWidget *entry;
+
+ hdrs = (EMsgComposerHdrs *) composer->hdrs;
+
+ entry = e_msg_composer_hdrs_get_subject_entry (hdrs);
+ g_signal_connect (entry, "focus-in-event", G_CALLBACK (composer_entry_focus_in_event_cb), composer);
+ g_signal_connect (entry, "focus-out-event", G_CALLBACK (composer_entry_focus_out_event_cb), composer);
+
+ entry = e_msg_composer_hdrs_get_reply_to_entry (hdrs);
+ g_signal_connect (entry, "focus-in-event", G_CALLBACK (composer_entry_focus_in_event_cb), composer);
+ g_signal_connect (entry, "focus-out-event", G_CALLBACK (composer_entry_focus_out_event_cb), composer);
+
+ entry = e_msg_composer_hdrs_get_to_entry (hdrs);
+ g_signal_connect (entry, "focus-in-event", G_CALLBACK (control_entry_focus_in_event_cb), composer);
+ g_signal_connect (entry, "focus-out-event", G_CALLBACK (control_entry_focus_out_event_cb), composer);
+
+ entry = e_msg_composer_hdrs_get_cc_entry (hdrs);
+ g_signal_connect (entry, "focus-in-event", G_CALLBACK (control_entry_focus_in_event_cb), composer);
+ g_signal_connect (entry, "focus-out-event", G_CALLBACK (control_entry_focus_out_event_cb), composer);
+
+ entry = e_msg_composer_hdrs_get_bcc_entry (hdrs);
+ g_signal_connect (entry, "focus-in-event", G_CALLBACK (control_entry_focus_in_event_cb), composer);
+ g_signal_connect (entry, "focus-out-event", G_CALLBACK (control_entry_focus_out_event_cb), composer);
+
+ /* FIXME: do the same for the gtkhtml editor */
+}
+
static EMsgComposer *
create_composer (int visible_mask)
{
@@ -2880,7 +3009,9 @@ create_composer (int visible_mask)
gtk_object_destroy (GTK_OBJECT (composer));
return NULL;
}
-
+
+ setup_cut_copy_paste (composer);
+
g_signal_connect (composer, "map", (GCallback) map_default_cb, NULL);
if (am == NULL)
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index 07fd96f1f8..4f9a8c6652 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -59,6 +59,8 @@ struct _EMsgComposer {
GtkWidget *hdrs;
GPtrArray *extra_hdr_names, *extra_hdr_values;
+ GtkWidget *focused_entry;
+
GtkWidget *editor;
GtkWidget *attachment_bar;