[balsa/gtk3] Use a transient parent in the no-subject dialog



commit 36c5564aafd95a3608a5d229ec67dde8611f5a79
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Mar 23 15:17:17 2015 -0400

    Use a transient parent in the no-subject dialog
    
        * src/sendmsg-window.c (subject_not_empty): use a transient parent
        and a header bar.

 ChangeLog            |   11 +++++++++--
 src/sendmsg-window.c |   38 +++++++++++++++-----------------------
 2 files changed, 24 insertions(+), 25 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 47fcd30..7ed182f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
+2015-03-23  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       Use a transient parent and a header bar in the no-subject dialog
+
+       * src/sendmsg-window.c (subject_not_empty): use a transient parent
+       and a header bar.
+
 2015-03-14  Peter Bloomfield  <pbloomfield bellsouth net>
 
-       reviewed by: <delete if not using a buddy>
+       Use a transient parent for filter dialogs
 
        * libbalsa/filter.h: add parent window to filters_edit_dialog
        and filters_export_dialog API.
@@ -35,7 +42,7 @@
 
 2015-03-14  Peter Bloomfield  <pbloomfield bellsouth net>
 
-       reviewed by: <delete if not using a buddy>
+       Use a header bar in the toolbar editor
 
        * src/toolbar-prefs.c (customize_dialog_cb): use a header bar.
        (create_toolbar_page): add tooltips to direction buttons.
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 2493fe7..9259c4f 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -5031,11 +5031,15 @@ subject_not_empty(BalsaSendmsg * bsmsg)
     }
 
     /* build the dialog */
-    no_subj_dialog = gtk_dialog_new ();
-    gtk_container_set_border_width (GTK_CONTAINER (no_subj_dialog), 6);
-    gtk_window_set_modal (GTK_WINDOW (no_subj_dialog), TRUE);
-    gtk_window_set_resizable (GTK_WINDOW (no_subj_dialog), FALSE);
-    gtk_window_set_type_hint (GTK_WINDOW (no_subj_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
+    no_subj_dialog = g_object_new(GTK_TYPE_DIALOG,
+                                  "use-header-bar", TRUE,
+                                  "transient-for", bsmsg->window,
+                                  "title", _("No Subject"),
+                                  "border-width", 6,
+                                  "modal", TRUE,
+                                  "resizable", FALSE,
+                                  "type-hint", GDK_WINDOW_TYPE_HINT_DIALOG,
+                                  NULL);
 
     dialog_vbox = gtk_dialog_get_content_area(GTK_DIALOG(no_subj_dialog));
 
@@ -5074,30 +5078,18 @@ subject_not_empty(BalsaSendmsg * bsmsg)
     gtk_entry_set_activates_default (GTK_ENTRY (subj_entry), TRUE);
 
 
-    cnclbutton = gtk_button_new_with_mnemonic(_("_Cancel"));
-    gtk_dialog_add_action_widget (GTK_DIALOG (no_subj_dialog), cnclbutton, GTK_RESPONSE_CANCEL);
+    cnclbutton =
+        gtk_dialog_add_button(GTK_DIALOG(no_subj_dialog),
+                              _("_Cancel"), GTK_RESPONSE_CANCEL);
     gtk_widget_set_can_default(cnclbutton, TRUE);
 
-    okbutton = gtk_button_new ();
-    gtk_dialog_add_action_widget (GTK_DIALOG (no_subj_dialog), okbutton, GTK_RESPONSE_OK);
+    okbutton =
+        gtk_dialog_add_button(GTK_DIALOG(no_subj_dialog),
+                              _("_Send"), GTK_RESPONSE_OK);
     gtk_widget_set_can_default(okbutton, TRUE);
     gtk_dialog_set_default_response(GTK_DIALOG (no_subj_dialog),
                                     GTK_RESPONSE_OK);
 
-    hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
-    gtk_widget_set_halign(hbox, GTK_ALIGN_CENTER);
-    gtk_widget_set_valign(hbox, GTK_ALIGN_CENTER);
-    gtk_container_add (GTK_CONTAINER (okbutton), hbox);
-
-    image = gtk_image_new_from_icon_name(balsa_icon_id(BALSA_PIXMAP_SEND),
-                                         GTK_ICON_SIZE_BUTTON);
-    gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
-
-    label = gtk_label_new_with_mnemonic (_("_Send"));
-    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-    gtk_widget_set_can_focus(label, TRUE);
-    gtk_widget_set_can_default(label, TRUE);
-
     gtk_widget_grab_focus (subj_entry);
     gtk_editable_select_region(GTK_EDITABLE(subj_entry), 0, -1);
     gtk_widget_show_all(dialog_vbox);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]