[easytag/wip/application-window: 105/112] Set transient parents before init()
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/application-window: 105/112] Set transient parents before init()
- Date: Wed, 27 Aug 2014 21:06:20 +0000 (UTC)
commit ef9354a3c4086b1f48c6115d8b9d3e840fa09f57
Author: David King <amigadave amigadave com>
Date: Wed Aug 20 07:43:49 2014 +0100
Set transient parents before init()
If gtk_window_set_transient_for() is called in the GObject init()
method, it is overridden to the default for the property immediately
afterwards, as "transient-for" is a contruct property. Instead, set the
property as part of calls to g_object_new().
src/application_window.c | 12 ++++++------
src/load_files_dialog.c | 8 +++++---
src/load_files_dialog.h | 2 +-
src/playlist_dialog.c | 8 +++++---
src/playlist_dialog.h | 2 +-
src/preferences_dialog.c | 8 +++++---
src/preferences_dialog.h | 2 +-
src/scan_dialog.c | 7 ++++---
src/scan_dialog.h | 2 +-
src/search_dialog.c | 7 ++++---
src/search_dialog.h | 2 +-
11 files changed, 34 insertions(+), 26 deletions(-)
---
diff --git a/src/application_window.c b/src/application_window.c
index f7f3410..ee529c8 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -724,7 +724,7 @@ on_find (GSimpleAction *action,
}
else
{
- priv->search_dialog = GTK_WIDGET (et_search_dialog_new ());
+ priv->search_dialog = GTK_WIDGET (et_search_dialog_new (GTK_WINDOW (self)));
gtk_widget_show_all (priv->search_dialog);
}
}
@@ -939,7 +939,7 @@ on_preferences (GSimpleAction *action,
}
else
{
- priv->preferences_dialog = GTK_WIDGET (et_preferences_dialog_new ());
+ priv->preferences_dialog = GTK_WIDGET (et_preferences_dialog_new (GTK_WINDOW (self)));
gtk_widget_show_all (priv->preferences_dialog);
}
}
@@ -999,7 +999,7 @@ on_scanner_change (GSimpleAction *action,
}
else
{
- priv->scan_dialog = GTK_WIDGET (et_scan_dialog_new ());
+ priv->scan_dialog = GTK_WIDGET (et_scan_dialog_new (GTK_WINDOW (self)));
gtk_widget_show (priv->scan_dialog);
}
}
@@ -1155,7 +1155,7 @@ on_show_load_filenames (GSimpleAction *action,
}
else
{
- priv->load_files_dialog = GTK_WIDGET (et_load_files_dialog_new ());
+ priv->load_files_dialog = GTK_WIDGET (et_load_files_dialog_new (GTK_WINDOW (self)));
gtk_widget_show_all (priv->load_files_dialog);
}
}
@@ -1177,7 +1177,7 @@ on_show_playlist (GSimpleAction *action,
}
else
{
- priv->playlist_dialog = GTK_WIDGET (et_playlist_dialog_new ());
+ priv->playlist_dialog = GTK_WIDGET (et_playlist_dialog_new (GTK_WINDOW (self)));
gtk_widget_show_all (priv->playlist_dialog);
}
}
@@ -1883,7 +1883,7 @@ et_application_window_show_preferences_dialog_scanner (EtApplicationWindow *self
if (!priv->preferences_dialog)
{
- priv->preferences_dialog = GTK_WIDGET (et_preferences_dialog_new ());
+ priv->preferences_dialog = GTK_WIDGET (et_preferences_dialog_new (GTK_WINDOW (self)));
}
et_preferences_dialog_show_scanner (ET_PREFERENCES_DIALOG (priv->preferences_dialog));
diff --git a/src/load_files_dialog.c b/src/load_files_dialog.c
index 8965503..cb31d08 100644
--- a/src/load_files_dialog.c
+++ b/src/load_files_dialog.c
@@ -907,7 +907,6 @@ create_load_files_dialog (EtLoadFilesDialog *self)
gtk_window_set_title (GTK_WINDOW (self),
_("Load Filenames From a Text File"));
- gtk_window_set_transient_for (GTK_WINDOW (self), GTK_WINDOW (MainWindow));
gtk_window_set_destroy_with_parent (GTK_WINDOW (self), TRUE);
gtk_dialog_add_buttons (GTK_DIALOG (self), _("_Close"),
GTK_RESPONSE_CANCEL, _("_Apply"),
@@ -1236,7 +1235,10 @@ et_load_files_dialog_class_init (EtLoadFilesDialogClass *klass)
* Returns: a new #EtLoadFilesDialog
*/
EtLoadFilesDialog *
-et_load_files_dialog_new (void)
+et_load_files_dialog_new (GtkWindow *parent)
{
- return g_object_new (ET_TYPE_LOAD_FILES_DIALOG, NULL);
+ g_return_val_if_fail (GTK_WINDOW (parent), NULL);
+
+ return g_object_new (ET_TYPE_LOAD_FILES_DIALOG, "transient-for", parent,
+ NULL);
}
diff --git a/src/load_files_dialog.h b/src/load_files_dialog.h
index ff6c50c..d455b1d 100644
--- a/src/load_files_dialog.h
+++ b/src/load_files_dialog.h
@@ -46,7 +46,7 @@ struct _EtLoadFilesDialogClass
};
GType et_load_files_dialog_get_type (void);
-EtLoadFilesDialog *et_load_files_dialog_new (void);
+EtLoadFilesDialog *et_load_files_dialog_new (GtkWindow *parent);
G_END_DECLS
diff --git a/src/playlist_dialog.c b/src/playlist_dialog.c
index 48b34d5..5ad2058 100644
--- a/src/playlist_dialog.c
+++ b/src/playlist_dialog.c
@@ -650,7 +650,6 @@ create_playlist_dialog (EtPlaylistDialog *self)
dialog = GTK_DIALOG (self);
gtk_window_set_title (GTK_WINDOW (self), _("Generate Playlist"));
- gtk_window_set_transient_for (GTK_WINDOW (self), GTK_WINDOW (MainWindow));
gtk_window_set_destroy_with_parent (GTK_WINDOW (self), TRUE);
gtk_dialog_add_buttons (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Save"), GTK_RESPONSE_OK, NULL);
@@ -792,7 +791,10 @@ et_playlist_dialog_class_init (EtPlaylistDialogClass *klass)
* Returns: a new #EtPlaylistDialog
*/
EtPlaylistDialog *
-et_playlist_dialog_new (void)
+et_playlist_dialog_new (GtkWindow *parent)
{
- return g_object_new (ET_TYPE_PLAYLIST_DIALOG, NULL);
+ g_return_val_if_fail (GTK_WINDOW (parent), NULL);
+
+ return g_object_new (ET_TYPE_PLAYLIST_DIALOG, "transient-for", parent,
+ NULL);
}
diff --git a/src/playlist_dialog.h b/src/playlist_dialog.h
index cf97269..a6d1b9d 100644
--- a/src/playlist_dialog.h
+++ b/src/playlist_dialog.h
@@ -46,7 +46,7 @@ struct _EtPlaylistDialogClass
};
GType et_playlist_dialog_get_type (void);
-EtPlaylistDialog *et_playlist_dialog_new (void);
+EtPlaylistDialog *et_playlist_dialog_new (GtkWindow *window);
G_END_DECLS
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index 5de7ca8..6269a9c 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -290,7 +290,6 @@ create_preferences_dialog (EtPreferencesDialog *self)
/* The window */
gtk_window_set_title (GTK_WINDOW (self), _("Preferences"));
- gtk_window_set_transient_for (GTK_WINDOW (self), GTK_WINDOW (MainWindow));
gtk_window_set_destroy_with_parent (GTK_WINDOW (self), TRUE);
gtk_dialog_add_buttons (GTK_DIALOG (self), _("_Close"), GTK_RESPONSE_CLOSE,
NULL);
@@ -1290,7 +1289,10 @@ et_preferences_dialog_class_init (EtPreferencesDialogClass *klass)
* Returns: a new #EtPreferencesDialog
*/
EtPreferencesDialog *
-et_preferences_dialog_new (void)
+et_preferences_dialog_new (GtkWindow *parent)
{
- return g_object_new (ET_TYPE_PREFERENCES_DIALOG, NULL);
+ g_return_val_if_fail (GTK_WINDOW (parent), NULL);
+
+ return g_object_new (ET_TYPE_PREFERENCES_DIALOG, "transient-for", parent,
+ NULL);
}
diff --git a/src/preferences_dialog.h b/src/preferences_dialog.h
index 154bb2a..71612da 100644
--- a/src/preferences_dialog.h
+++ b/src/preferences_dialog.h
@@ -46,7 +46,7 @@ struct _EtPreferencesDialogClass
};
GType et_preferences_dialog_get_type (void);
-EtPreferencesDialog *et_preferences_dialog_new (void);
+EtPreferencesDialog *et_preferences_dialog_new (GtkWindow *parent);
void et_preferences_dialog_show_scanner (EtPreferencesDialog *self);
G_END_DECLS
diff --git a/src/scan_dialog.c b/src/scan_dialog.c
index 2ec14c9..714c04a 100644
--- a/src/scan_dialog.c
+++ b/src/scan_dialog.c
@@ -2509,7 +2509,6 @@ create_scan_dialog (EtScanDialog *self)
/* The window */
gtk_window_set_title (GTK_WINDOW (self), _("Tag and Filename Scan"));
- gtk_window_set_transient_for (GTK_WINDOW (self), GTK_WINDOW (MainWindow));
gtk_window_set_destroy_with_parent (GTK_WINDOW (self), TRUE);
gtk_dialog_add_buttons (GTK_DIALOG (self), _("_Close"),
GTK_RESPONSE_CLOSE, NULL);
@@ -3529,7 +3528,9 @@ et_scan_dialog_class_init (EtScanDialogClass *klass)
* Returns: a new #EtScanDialog
*/
EtScanDialog *
-et_scan_dialog_new (void)
+et_scan_dialog_new (GtkWindow *parent)
{
- return g_object_new (ET_TYPE_SCAN_DIALOG, NULL);
+ g_return_val_if_fail (GTK_WINDOW (parent), NULL);
+
+ return g_object_new (ET_TYPE_SCAN_DIALOG, "transient-for", parent, NULL);
}
diff --git a/src/scan_dialog.h b/src/scan_dialog.h
index 2a1cf8a..ce9dabe 100644
--- a/src/scan_dialog.h
+++ b/src/scan_dialog.h
@@ -48,7 +48,7 @@ struct _EtScanDialogClass
};
GType et_scan_dialog_get_type (void);
-EtScanDialog *et_scan_dialog_new (void);
+EtScanDialog *et_scan_dialog_new (GtkWindow *parent);
void et_scan_dialog_apply_changes (EtScanDialog *self);
void et_scan_dialog_open (EtScanDialog *self, EtScanMode scanner_type);
void et_scan_dialog_scan_selected_files (EtScanDialog *self);
diff --git a/src/search_dialog.c b/src/search_dialog.c
index c213fb7..2e2c2ff 100644
--- a/src/search_dialog.c
+++ b/src/search_dialog.c
@@ -607,7 +607,6 @@ create_search_dialog (EtSearchDialog *self)
priv = et_search_dialog_get_instance_private (self);
- gtk_window_set_transient_for (GTK_WINDOW (self), GTK_WINDOW (MainWindow));
gtk_window_set_title (GTK_WINDOW (self), _("Find Files"));
g_signal_connect (self, "delete-event", G_CALLBACK (on_delete_event),
NULL);
@@ -947,7 +946,9 @@ et_search_dialog_class_init (EtSearchDialogClass *klass)
* Returns: a new #EtSearchDialog
*/
EtSearchDialog *
-et_search_dialog_new (void)
+et_search_dialog_new (GtkWindow *parent)
{
- return g_object_new (ET_TYPE_SEARCH_DIALOG, NULL);
+ g_return_val_if_fail (GTK_WINDOW (parent), NULL);
+
+ return g_object_new (ET_TYPE_SEARCH_DIALOG, "transient-for", parent, NULL);
}
diff --git a/src/search_dialog.h b/src/search_dialog.h
index 5331afc..848c450 100644
--- a/src/search_dialog.h
+++ b/src/search_dialog.h
@@ -46,7 +46,7 @@ struct _EtSearchDialogClass
};
GType et_search_dialog_get_type (void);
-EtSearchDialog *et_search_dialog_new (void);
+EtSearchDialog *et_search_dialog_new (GtkWindow *parent);
void et_search_dialog_apply_changes (EtSearchDialog *self);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]