diff options
author | Alexander Mikhaylenko <alexm@gnome.org> | 2020-04-03 09:49:57 +0500 |
---|---|---|
committer | Alexander Mikhaylenko <alexm@gnome.org> | 2020-04-03 09:53:36 +0500 |
commit | a1c05f9e75ae2434910797d62557c17cf2037c67 (patch) | |
tree | 76775c3d84be1d7221443400e0e807e2b44ccd2a | |
parent | 45f3a638cd233d94bdfae8bed472b8e1b17d5db8 (diff) | |
download | gnome-screenshot-a1c05f9e75ae2434910797d62557c17cf2037c67.tar.gz |
dialog: Pass GtkApplication explicitly
Don't rely on g_application_get_default().
-rw-r--r-- | src/screenshot-application.c | 3 | ||||
-rw-r--r-- | src/screenshot-dialog.c | 10 | ||||
-rw-r--r-- | src/screenshot-dialog.h | 5 |
3 files changed, 11 insertions, 7 deletions
diff --git a/src/screenshot-application.c b/src/screenshot-application.c index 820bc55..96829a5 100644 --- a/src/screenshot-application.c +++ b/src/screenshot-application.c @@ -439,7 +439,8 @@ build_filename_ready_cb (GObject *source, if (screenshot_config->interactive) { - self->priv->dialog = screenshot_dialog_new (self->priv->screenshot, + self->priv->dialog = screenshot_dialog_new (GTK_APPLICATION (self), + self->priv->screenshot, self->priv->save_uri); g_signal_connect_object (self->priv->dialog, "save", G_CALLBACK (save_clicked_cb), self, 0); g_signal_connect_object (self->priv->dialog, "copy", G_CALLBACK (copy_clicked_cb), self, 0); diff --git a/src/screenshot-dialog.c b/src/screenshot-dialog.c index 684152e..b7c2b89 100644 --- a/src/screenshot-dialog.c +++ b/src/screenshot-dialog.c @@ -248,8 +248,9 @@ screenshot_dialog_init (ScreenshotDialog *self) } ScreenshotDialog * -screenshot_dialog_new (GdkPixbuf *screenshot, - char *initial_uri) +screenshot_dialog_new (GtkApplication *app, + GdkPixbuf *screenshot, + char *initial_uri) { g_autoptr(GFile) tmp_file = NULL, parent_file = NULL; g_autofree gchar *current_folder = NULL, *current_name = NULL; @@ -263,11 +264,12 @@ screenshot_dialog_new (GdkPixbuf *screenshot, current_name = g_file_get_basename (tmp_file); current_folder = g_file_get_uri (parent_file); - self = g_object_new (SCREENSHOT_TYPE_DIALOG, NULL); + self = g_object_new (SCREENSHOT_TYPE_DIALOG, + "application", app, + NULL); self->screenshot = screenshot; - gtk_window_set_application (GTK_WINDOW (self), GTK_APPLICATION (g_application_get_default ())); gtk_widget_realize (GTK_WIDGET (self)); gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (self->save_widget), current_folder); diff --git a/src/screenshot-dialog.h b/src/screenshot-dialog.h index 51b425f..7419154 100644 --- a/src/screenshot-dialog.h +++ b/src/screenshot-dialog.h @@ -27,8 +27,9 @@ G_BEGIN_DECLS G_DECLARE_FINAL_TYPE (ScreenshotDialog, screenshot_dialog, SCREENSHOT, DIALOG, GtkApplicationWindow) -ScreenshotDialog *screenshot_dialog_new (GdkPixbuf *screenshot, - char *initial_uri); +ScreenshotDialog *screenshot_dialog_new (GtkApplication *app, + GdkPixbuf *screenshot, + char *initial_uri); char *screenshot_dialog_get_uri (ScreenshotDialog *dialog); char *screenshot_dialog_get_folder (ScreenshotDialog *dialog); |