summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2021-11-26 20:06:36 +0300
committerMarge Bot <marge-bot@gnome.org>2022-01-27 22:25:42 +0000
commit27bcf0da484cc1274eda0c2ed133b883e8cfe76e (patch)
tree1d0683b6762887e3e9692fbb462f97b6c228b409 /src
parent4442ced76032e09cea2fa14c7dfa6e056fa8e3d0 (diff)
downloadgnome-shell-27bcf0da484cc1274eda0c2ed133b883e8cfe76e.tar.gz
screenshot-ui: Use ImageContent for notification icon
StImageContent specifically, when used as a notification icon, preserves the screenshot aspect ratio and avoids ugly scaling. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1954>
Diffstat (limited to 'src')
-rw-r--r--src/shell-screenshot.c11
-rw-r--r--src/shell-screenshot.h4
2 files changed, 8 insertions, 7 deletions
diff --git a/src/shell-screenshot.c b/src/shell-screenshot.c
index f87b61e49..fcf2da236 100644
--- a/src/shell-screenshot.c
+++ b/src/shell-screenshot.c
@@ -1049,7 +1049,7 @@ shell_screenshot_pick_color_finish (ShellScreenshot *screenshot,
#undef INDEX_B
static void
-composite_to_stream_on_png_saved (GObject *source,
+composite_to_stream_on_png_saved (GObject *pixbuf,
GAsyncResult *result,
gpointer user_data)
{
@@ -1059,7 +1059,7 @@ composite_to_stream_on_png_saved (GObject *source,
if (!gdk_pixbuf_save_to_stream_finish (result, &error))
g_task_return_error (task, error);
else
- g_task_return_boolean (task, TRUE);
+ g_task_return_pointer (task, g_object_ref (pixbuf), g_object_unref);
g_object_unref (task);
}
@@ -1193,10 +1193,11 @@ shell_screenshot_composite_to_stream (CoglTexture *texture,
* Finish the asynchronous operation started by
* shell_screenshot_composite_to_stream () and obtain its result.
*
- * Returns: whether the operation was successful
+ * Returns: (transfer full) (nullable): a GdkPixbuf with the final image if the
+ * operation was successful, or NULL on error.
*
*/
-gboolean
+GdkPixbuf *
shell_screenshot_composite_to_stream_finish (GAsyncResult *result,
GError **error)
{
@@ -1205,7 +1206,7 @@ shell_screenshot_composite_to_stream_finish (GAsyncResult *result,
shell_screenshot_composite_to_stream),
FALSE);
- return g_task_propagate_boolean (G_TASK (result), error);
+ return g_task_propagate_pointer (G_TASK (result), error);
}
ShellScreenshot *
diff --git a/src/shell-screenshot.h b/src/shell-screenshot.h
index b379b8a0a..441410d6c 100644
--- a/src/shell-screenshot.h
+++ b/src/shell-screenshot.h
@@ -84,7 +84,7 @@ void shell_screenshot_composite_to_stream (CoglTexture *texture,
GOutputStream *stream,
GAsyncReadyCallback callback,
gpointer user_data);
-gboolean shell_screenshot_composite_to_stream_finish (GAsyncResult *result,
- GError **error);
+GdkPixbuf *shell_screenshot_composite_to_stream_finish (GAsyncResult *result,
+ GError **error);
#endif /* ___SHELL_SCREENSHOT_H__ */