diff options
author | Alexander Mikhaylenko <alexm@gnome.org> | 2020-04-03 03:58:06 +0500 |
---|---|---|
committer | Alexander Mikhaylenko <alexm@gnome.org> | 2020-04-03 03:58:06 +0500 |
commit | 386e6114c43d66eba82cb75115eb1b928e66b057 (patch) | |
tree | 9b2eb8a3cee85b77131579447352a385f2611460 /src | |
parent | 90a9498786698692472d253b69414bfd9efbfd0a (diff) | |
download | gnome-screenshot-386e6114c43d66eba82cb75115eb1b928e66b057.tar.gz |
dialog: Add functions for retrieving dialog and filename entry
This is the first step in making the dialog a GObject. This will allow to
stop exposing the struct fields publicly.
Diffstat (limited to 'src')
-rw-r--r-- | src/screenshot-application.c | 8 | ||||
-rw-r--r-- | src/screenshot-dialog.c | 12 | ||||
-rw-r--r-- | src/screenshot-dialog.h | 2 |
3 files changed, 18 insertions, 4 deletions
diff --git a/src/screenshot-application.c b/src/screenshot-application.c index 38d801d..54a2afd 100644 --- a/src/screenshot-application.c +++ b/src/screenshot-application.c @@ -104,7 +104,7 @@ screenshot_close_interactive_dialog (ScreenshotApplication *self) { ScreenshotDialog *dialog = self->priv->dialog; save_folder_to_settings (self); - gtk_widget_destroy (dialog->dialog); + gtk_widget_destroy (screenshot_dialog_get_dialog (dialog)); g_free (dialog); } @@ -143,7 +143,7 @@ save_pixbuf_handle_error (ScreenshotApplication *self, g_autofree gchar *detail = g_strdup_printf (_("A file named ā%sā already exists in ā%sā"), file_name, folder_name); - gint response = screenshot_show_dialog (GTK_WINDOW (dialog->dialog), + gint response = screenshot_show_dialog (GTK_WINDOW (screenshot_dialog_get_dialog (dialog)), GTK_MESSAGE_WARNING, GTK_BUTTONS_YES_NO, _("Overwrite existing file?"), @@ -159,14 +159,14 @@ save_pixbuf_handle_error (ScreenshotApplication *self, } else { - screenshot_show_dialog (GTK_WINDOW (dialog->dialog), + screenshot_show_dialog (GTK_WINDOW (screenshot_dialog_get_dialog (dialog)), GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Unable to capture a screenshot"), _("Error creating file. Please choose another location and retry.")); } - gtk_widget_grab_focus (dialog->filename_entry); + gtk_widget_grab_focus (screenshot_dialog_get_filename_entry (dialog)); } else { diff --git a/src/screenshot-dialog.c b/src/screenshot-dialog.c index 3d7e83f..141a86a 100644 --- a/src/screenshot-dialog.c +++ b/src/screenshot-dialog.c @@ -324,3 +324,15 @@ screenshot_dialog_set_busy (ScreenshotDialog *dialog, gdk_flush (); } + +GtkWidget * +screenshot_dialog_get_dialog (ScreenshotDialog *dialog) +{ + return dialog->dialog; +} + +GtkWidget * +screenshot_dialog_get_filename_entry (ScreenshotDialog *dialog) +{ + return dialog->filename_entry; +} diff --git a/src/screenshot-dialog.h b/src/screenshot-dialog.h index 50b32a7..65e0aab 100644 --- a/src/screenshot-dialog.h +++ b/src/screenshot-dialog.h @@ -58,3 +58,5 @@ char *screenshot_dialog_get_folder (ScreenshotDialog *dialog); char *screenshot_dialog_get_filename (ScreenshotDialog *dialog); void screenshot_dialog_set_busy (ScreenshotDialog *dialog, gboolean busy); +GtkWidget *screenshot_dialog_get_dialog (ScreenshotDialog *dialog); +GtkWidget *screenshot_dialog_get_filename_entry (ScreenshotDialog *dialog); |