summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Mikhaylenko <alexm@gnome.org>2020-04-03 03:58:06 +0500
committerAlexander Mikhaylenko <alexm@gnome.org>2020-04-03 03:58:06 +0500
commit386e6114c43d66eba82cb75115eb1b928e66b057 (patch)
tree9b2eb8a3cee85b77131579447352a385f2611460 /src
parent90a9498786698692472d253b69414bfd9efbfd0a (diff)
downloadgnome-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.c8
-rw-r--r--src/screenshot-dialog.c12
-rw-r--r--src/screenshot-dialog.h2
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);