[balsa/gtk3] Use GtkDialog API and GTK_DIALOG_* flags



commit c0abdfcac7f1bd8ede1318691d18e8a0a6e68fc7
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue Mar 24 18:49:50 2015 -0400

    Use GtkDialog API and GTK_DIALOG_* flags
    
        * src/filter-edit-dialog.c (filters_edit_dialog):
        * src/filter-export-dialog.c (filters_export_dialog):
        * src/sendmsg-window.c (subject_not_empty):
        * src/toolbar-prefs.c (customize_dialog_cb):

 ChangeLog                  |   10 ++++++++++
 src/filter-edit-dialog.c   |   18 +++++++-----------
 src/filter-export-dialog.c |   19 +++++++------------
 src/sendmsg-window.c       |   33 +++++++++++----------------------
 src/toolbar-prefs.c        |   17 +++++++----------
 5 files changed, 42 insertions(+), 55 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d549a6a..1ada9d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2015-03-24  Peter Bloomfield  <pbloomfield bellsouth net>
 
+       Use GtkDialog API and GTK_DIALOG_* flags instead of g_object_new
+       and GObject properties
+
+       * src/filter-edit-dialog.c (filters_edit_dialog):
+       * src/filter-export-dialog.c (filters_export_dialog):
+       * src/sendmsg-window.c (subject_not_empty):
+       * src/toolbar-prefs.c (customize_dialog_cb):
+
+2015-03-24  Peter Bloomfield  <pbloomfield bellsouth net>
+
        * libbalsa/libbalsa.c (ask_cert_real), (ask_timeout_real): use
        header bars.
 
diff --git a/src/filter-edit-dialog.c b/src/filter-edit-dialog.c
index 9fa8fe6..720795c 100644
--- a/src/filter-edit-dialog.c
+++ b/src/filter-edit-dialog.c
@@ -566,17 +566,13 @@ filters_edit_dialog(GtkWindow * parent)
 
     piece = build_left_side();
 
-    fe_window =
-        g_object_new(GTK_TYPE_DIALOG,
-                     "transient-for", parent,
-                     "use-header-bar", TRUE,
-                     "title", _("Filters"),
-                     NULL);
-    gtk_dialog_add_buttons(GTK_DIALOG(fe_window),
-                           _("_OK"),     GTK_RESPONSE_OK,
-                           _("_Cancel"), GTK_RESPONSE_CANCEL,
-                           _("_Help"),   GTK_RESPONSE_HELP,
-                          NULL);
+    fe_window = gtk_dialog_new_with_buttons(_("Filters"),
+                                            parent,
+                                            GTK_DIALOG_USE_HEADER_BAR,
+                                            _("_OK"), GTK_RESPONSE_OK,
+                                            _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                            _("_Help"), GTK_RESPONSE_HELP,
+                                           NULL);
 
     g_signal_connect(G_OBJECT(fe_window), "response",
                      G_CALLBACK(fe_dialog_response), NULL);
diff --git a/src/filter-export-dialog.c b/src/filter-export-dialog.c
index 1fcfb5f..cdb1e10 100644
--- a/src/filter-export-dialog.c
+++ b/src/filter-export-dialog.c
@@ -74,18 +74,13 @@ filters_export_dialog(GtkWindow * parent)
     fex_already_open = TRUE;
 
     fex_window =
-        g_object_new(GTK_TYPE_DIALOG,
-                     "transient-for", parent,
-                     "use-header-bar", TRUE,
-                     "title", _("Export Filters"),
-                     NULL);
-    gtk_dialog_add_buttons(GTK_DIALOG(fex_window),
-                           _("_OK"), GTK_RESPONSE_OK,
-                           _("_Cancel"), GTK_RESPONSE_CANCEL,
-                           /* We don't actually offer any help:
-                           _("_Help"), GTK_RESPONSE_HELP,
-                           */
-                           NULL);
+        gtk_dialog_new_with_buttons(_("Export Filters"),
+                                    parent,
+                                    GTK_DIALOG_USE_HEADER_BAR,
+                                    _("_OK"), GTK_RESPONSE_OK,
+                                    _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                    _("_Help"), GTK_RESPONSE_HELP,
+                                    NULL);
     gtk_window_set_wmclass(GTK_WINDOW(fex_window), "filter-export",
                            "Balsa");
 
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 09413db..2cc9870 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -5018,8 +5018,6 @@ subject_not_empty(BalsaSendmsg * bsmsg)
     gchar *text_str;
     GtkWidget *label;
     GtkWidget *subj_entry;
-    GtkWidget *cnclbutton;
-    GtkWidget *okbutton;
     gint response;
 
     /* read the subject widget and verify that it is contains something else
@@ -5035,15 +5033,17 @@ subject_not_empty(BalsaSendmsg * bsmsg)
     }
 
     /* build the 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);
+    no_subj_dialog =
+        gtk_dialog_new_with_buttons(_("No Subject"),
+                                    GTK_WINDOW(bsmsg->window),
+                                    GTK_DIALOG_MODAL |
+                                    GTK_DIALOG_USE_HEADER_BAR,
+                                    _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                    _("_Send"),   GTK_RESPONSE_OK,
+                                    NULL);
+    gtk_container_set_border_width (GTK_CONTAINER (no_subj_dialog), 6);
+    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);
 
     dialog_vbox = gtk_dialog_get_content_area(GTK_DIALOG(no_subj_dialog));
 
@@ -5080,17 +5080,6 @@ subject_not_empty(BalsaSendmsg * bsmsg)
     gtk_entry_set_text(GTK_ENTRY(subj_entry), _("(no subject)"));
     gtk_box_pack_start (GTK_BOX (hbox), subj_entry, TRUE, TRUE, 0);
     gtk_entry_set_activates_default (GTK_ENTRY (subj_entry), TRUE);
-
-
-    cnclbutton =
-        gtk_dialog_add_button(GTK_DIALOG(no_subj_dialog),
-                              _("_Cancel"), GTK_RESPONSE_CANCEL);
-    gtk_widget_set_can_default(cnclbutton, TRUE);
-
-    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);
 
diff --git a/src/toolbar-prefs.c b/src/toolbar-prefs.c
index f319fb9..1553eee 100644
--- a/src/toolbar-prefs.c
+++ b/src/toolbar-prefs.c
@@ -135,16 +135,13 @@ customize_dialog_cb(GtkWidget * widget, gpointer data)
     }
 
     customize_widget =
-        g_object_new(GTK_TYPE_DIALOG,
-                     "title", _("Customize Toolbars"),
-                     "transient-for", active_window,
-                     "destroy-with-parent", TRUE,
-                     "use-header-bar", TRUE,
-                     NULL);
-    gtk_dialog_add_buttons(GTK_DIALOG(customize_widget),
-                           _("_Close"), GTK_RESPONSE_CLOSE,
-                           _("_Help"),  GTK_RESPONSE_HELP,
-                           NULL);
+        gtk_dialog_new_with_buttons(_("Customize Toolbars"),
+                                    GTK_WINDOW(active_window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT |
+                                    GTK_DIALOG_USE_HEADER_BAR,
+                                    _("_Close"), GTK_RESPONSE_CLOSE,
+                                    _("_Help"),  GTK_RESPONSE_HELP,
+                                    NULL);
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(customize_widget, GTK_WINDOW(active_window));
 #endif


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