[balsa/gtk3] Pass parent windows to filter dialogs



commit 74007a704b5d83a7af1faa08a96d1891ed902f6a
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Mar 14 14:51:20 2015 -0400

    Pass parent windows to filter dialogs
    
        * libbalsa/filter.h: add parent window to filters_edit_dialog
        and filters_export_dialog API.
        * src/filter-edit-dialog.c (filters_edit_dialog): use it, and
        add a header bar.
        * src/filter-export-dialog.c (filters_export_dialog): ditto.
        * src/main-window.c (filters_activated),
        (export_filters_activated): pass the main window as the
        transient parent.

 ChangeLog                  |   13 +++++++++++++
 libbalsa/filter.h          |    7 +++----
 src/filter-edit-dialog.c   |   19 ++++++++++++-------
 src/filter-export-dialog.c |   20 +++++++++++++-------
 src/main-window.c          |    4 ++--
 5 files changed, 43 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 38c7a28..47fcd30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2015-03-14  Peter Bloomfield  <pbloomfield bellsouth net>
 
+       reviewed by: <delete if not using a buddy>
+
+       * libbalsa/filter.h: add parent window to filters_edit_dialog
+       and filters_export_dialog API.
+       * src/filter-edit-dialog.c (filters_edit_dialog): use it, and
+       add a header bar.
+       * src/filter-export-dialog.c (filters_export_dialog): ditto.
+       * src/main-window.c (filters_activated),
+       (export_filters_activated): pass the main window as the
+       transient parent.
+
+2015-03-14  Peter Bloomfield  <pbloomfield bellsouth net>
+
        Use a transient parent for the BalsaFilterRunDialog, and manage
        sensitivity of various buttons
 
diff --git a/libbalsa/filter.h b/libbalsa/filter.h
index e04260e..ab5d31c 100644
--- a/libbalsa/filter.h
+++ b/libbalsa/filter.h
@@ -255,17 +255,16 @@ LibBalsaFilter* libbalsa_filter_get_by_name(const gchar* fname);
 /* filters_edit_dialog launches (guess what :) the filters edit dialog box
  * to modify the list of all filters
  */
-void filters_edit_dialog(void);
+void filters_edit_dialog(GtkWindow * parent);
 
 /* filter_run_dialog edits and runs the list of filters of the mailbox
  */
-void filters_run_dialog(LibBalsaMailbox *mbox, GtkWindow *parent);
+void filters_run_dialog(LibBalsaMailbox * mbox, GtkWindow * parent);
 
 /* filter_export_dialog to export filters as sieve scripts
  */
 
-void
-filters_export_dialog(void);
+void filters_export_dialog(GtkWindow * parent);
 
 void libbalsa_filters_set_trash(LibBalsaMailbox* new_trash);
 typedef LibBalsaMailbox* (*UrlToMailboxMapper)(const gchar* url);
diff --git a/src/filter-edit-dialog.c b/src/filter-edit-dialog.c
index 5abd78a..9fa8fe6 100644
--- a/src/filter-edit-dialog.c
+++ b/src/filter-edit-dialog.c
@@ -542,7 +542,7 @@ fe_collect_user_headers(LibBalsaCondition * condition)
  */
 #define BALSA_FILTER_PADDING 6
 void
-filters_edit_dialog(void)
+filters_edit_dialog(GtkWindow * parent)
 {
     GtkWidget *hbox;
     GtkWidget *piece;
@@ -566,12 +566,17 @@ filters_edit_dialog(void)
 
     piece = build_left_side();
 
-    fe_window = gtk_dialog_new_with_buttons(_("Balsa Filters"),
-                                            NULL, 0, /* FIXME */
-                                            _("_OK"), GTK_RESPONSE_OK,
-                                            _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                            _("_Help"), GTK_RESPONSE_HELP,
-                                           NULL);
+    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);
 
     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 3471b1c..1fcfb5f 100644
--- a/src/filter-export-dialog.c
+++ b/src/filter-export-dialog.c
@@ -51,7 +51,7 @@ GtkWidget * fex_window;
  * Returns immediately, but fires off the filter export dialog.
  */
 void
-filters_export_dialog(void)
+filters_export_dialog(GtkWindow * parent)
 {
     GtkTreeView *list;
     GtkTreeModel *model;
@@ -74,12 +74,18 @@ filters_export_dialog(void)
     fex_already_open = TRUE;
 
     fex_window =
-        gtk_dialog_new_with_buttons(_("Balsa Filters Export"),
-                                    NULL, 0, /* FIXME */
-                                    _("_OK"), GTK_RESPONSE_OK,
-                                    _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                    _("_Help"), GTK_RESPONSE_HELP,
-                                    NULL);
+        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_window_set_wmclass(GTK_WINDOW(fex_window), "filter-export",
                            "Balsa");
 
diff --git a/src/main-window.c b/src/main-window.c
index 4d5acd0..36a67fb 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -1217,7 +1217,7 @@ filters_activated(GSimpleAction * action,
                   GVariant      * parameter,
                   gpointer        user_data)
 {
-    filters_edit_dialog();
+    filters_edit_dialog(GTK_WINDOW(user_data));
 }
 
 static void
@@ -1225,7 +1225,7 @@ export_filters_activated(GSimpleAction * action,
                          GVariant      * parameter,
                          gpointer        user_data)
 {
-    filters_export_dialog();
+    filters_export_dialog(GTK_WINDOW(user_data));
 }
 
 static void


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