Fix SSL receive; Fix clipboard menu hotkeys
authorThorsten Maerz <torte@netztorte.de>
Tue, 27 Jan 2004 20:48:32 +0000 (20:48 +0000)
committerThorsten Maerz <torte@netztorte.de>
Tue, 27 Jan 2004 20:48:32 +0000 (20:48 +0000)
ChangeLog-gtk2
src/common/socket.c
src/compose.c

index ea772dc..ef66ed6 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-27 Thorsten Maerz <torte@netztorte.de>
+       * src/common/socket.c
+               Fix SSL receive
+       * src/compose.c
+               Fix clipboard menu hotkeys
+
 2004-01-25 Thorsten Maerz <torte@netztorte.de>
        * src/gtk/gtkaspell.[ch]
          src/compose.c
index 7eadf54..9b1b620 100644 (file)
@@ -352,6 +352,7 @@ guint sock_add_watch(SockInfo *sock, GIOCondition condition, SockFunc func,
                g_source_set_priority(source, G_PRIORITY_DEFAULT);
                g_source_set_can_recurse(source, FALSE);
                sock->g_source = g_source_attach(source, NULL);
+               return g_source_attach(source, NULL);
        }
 #endif
 
index 024824b..e798534 100644 (file)
@@ -4651,6 +4651,8 @@ static void compose_create_header_entry(Compose *compose)
        gtk_combo_set_popdown_strings(GTK_COMBO(combo), combo_list);
        g_list_free(combo_list);
        gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO(combo)->entry), TRUE);
+       g_signal_connect(G_OBJECT(GTK_COMBO(combo)->entry), "grab_focus",
+                        G_CALLBACK(compose_grab_focus_cb), compose);
        gtk_widget_show(combo);
        gtk_table_attach(GTK_TABLE(compose->header_table), combo, 0, 1, compose->header_nextrow, compose->header_nextrow+1, GTK_SHRINK, GTK_FILL, 0, 0);
        if (compose->header_last) {     
@@ -4685,6 +4687,8 @@ static void compose_create_header_entry(Compose *compose)
         gtk_signal_connect(GTK_OBJECT(entry), "key-press-event", GTK_SIGNAL_FUNC(compose_headerentry_key_press_event_cb), headerentry);
        gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(compose_headerentry_changed_cb), headerentry);
        gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(text_activated), compose);
+       g_signal_connect(G_OBJECT(entry), "grab_focus",
+                        G_CALLBACK(compose_grab_focus_cb), compose);
 
        address_completion_register_entry(GTK_ENTRY(entry));
 
@@ -4929,6 +4933,8 @@ static GtkWidget *compose_create_others(Compose *compose)
        gtk_widget_show(savemsg_entry);
        gtk_table_attach_defaults(GTK_TABLE(table), savemsg_entry, 1, 2, rowcount, rowcount + 1);
        gtk_editable_set_editable(GTK_EDITABLE(savemsg_entry), prefs_common.savemsg);
+       g_signal_connect(G_OBJECT(savemsg_entry), "grab_focus",
+                        G_CALLBACK(compose_grab_focus_cb), compose);
        if (account_get_special_folder(compose->account, F_OUTBOX)) {
                folderidentifier = folder_item_get_identifier(account_get_special_folder
                                  (compose->account, F_OUTBOX));
@@ -5100,6 +5106,8 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        subject_entry = gtk_entry_new();
        gtk_box_pack_start(GTK_BOX(subject), subject_entry, TRUE, TRUE, 2);
        gtk_signal_connect(GTK_OBJECT(subject_entry), "activate", GTK_SIGNAL_FUNC(text_activated), compose);
+       g_signal_connect(G_OBJECT(subject_entry), "grab_focus",
+                        G_CALLBACK(compose_grab_focus_cb), compose);
        gtk_widget_show(subject_entry);
        compose->subject_entry = subject_entry;
        gtk_container_add(GTK_CONTAINER(subject_frame), subject);
@@ -6734,28 +6742,77 @@ static void compose_redo_cb(Compose *compose)
        undo_redo(compose->undostruct);
 }
 
+static void entry_cut_clipboard(GtkWidget *entry) {
+       if (GTK_IS_EDITABLE(entry))
+               gtk_editable_cut_clipboard
+                       (GTK_EDITABLE(entry));
+       else if (GTK_IS_TEXT_VIEW(entry))
+               gtk_text_buffer_cut_clipboard(
+                       gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry)),
+                       gtk_clipboard_get(GDK_NONE),
+                       TRUE);
+}
+
+static void entry_copy_clipboard(GtkWidget *entry) {
+       if (GTK_IS_EDITABLE(entry))
+               gtk_editable_copy_clipboard
+                       (GTK_EDITABLE(entry));
+       else if (GTK_IS_TEXT_VIEW(entry))
+               gtk_text_buffer_copy_clipboard(
+                       gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry)),
+                       gtk_clipboard_get(GDK_NONE));
+}
+
+static void entry_paste_clipboard(GtkWidget *entry) {
+       if (GTK_IS_EDITABLE(entry))
+               gtk_editable_paste_clipboard
+                       (GTK_EDITABLE(entry));
+       else if (GTK_IS_TEXT_VIEW(entry))
+               gtk_text_buffer_paste_clipboard(
+                       gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry)),
+                       gtk_clipboard_get(GDK_NONE),
+                       NULL, TRUE);
+}
+
+static void entry_allsel(GtkWidget *entry) {
+       if (GTK_IS_EDITABLE(entry))
+               gtk_editable_select_region
+                       (GTK_EDITABLE(entry), 0, -1);
+       else if (GTK_IS_TEXT_VIEW(entry)) {
+               GtkTextIter startiter, enditer;
+               GtkTextBuffer *textbuf;
+
+               textbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry));
+               gtk_text_buffer_get_start_iter(textbuf, &startiter);
+               gtk_text_buffer_get_end_iter(textbuf, &enditer);
+
+               gtk_text_buffer_move_mark_by_name(textbuf, 
+                       "selection_bound", &startiter);
+               gtk_text_buffer_move_mark_by_name(textbuf, 
+                       "insert", &enditer);
+       }
+}
+
+
 static void compose_cut_cb(Compose *compose)
 {
        if (compose->focused_editable &&
            GTK_WIDGET_HAS_FOCUS(compose->focused_editable))
-               gtk_editable_cut_clipboard
-                       (GTK_EDITABLE(compose->focused_editable));
+               entry_cut_clipboard(compose->focused_editable);
 }
 
 static void compose_copy_cb(Compose *compose)
 {
        if (compose->focused_editable &&
            GTK_WIDGET_HAS_FOCUS(compose->focused_editable))
-               gtk_editable_copy_clipboard
-                       (GTK_EDITABLE(compose->focused_editable));
+               entry_copy_clipboard(compose->focused_editable);
 }
 
 static void compose_paste_cb(Compose *compose)
 {
        if (compose->focused_editable &&
            GTK_WIDGET_HAS_FOCUS(compose->focused_editable))
-               gtk_editable_paste_clipboard
-                       (GTK_EDITABLE(compose->focused_editable));
+               entry_paste_clipboard(compose->focused_editable);
 }
 
 static void compose_paste_as_quote_cb(Compose *compose)
@@ -6772,8 +6829,7 @@ static void compose_paste_as_quote_cb(Compose *compose)
                gtk_object_set_data(GTK_OBJECT(compose->focused_editable),
                                    "paste_as_quotation",
                                    GINT_TO_POINTER(paste_as_quotation + 1));
-               gtk_editable_paste_clipboard
-                       (GTK_EDITABLE(compose->focused_editable));
+               entry_paste_clipboard(compose->focused_editable);
        }
 }
 
@@ -6781,8 +6837,7 @@ static void compose_allsel_cb(Compose *compose)
 {
        if (compose->focused_editable &&
            GTK_WIDGET_HAS_FOCUS(compose->focused_editable))
-               gtk_editable_select_region
-                       (GTK_EDITABLE(compose->focused_editable), 0, -1);
+               entry_allsel(compose->focused_editable);
 }
 
 static void textview_move_beginning_of_line (GtkTextView *text)