aboutsummaryrefslogtreecommitdiff
path: root/src/image.c
diff options
context:
space:
mode:
authornirav <nirav@teisuu.com>2018-10-20 18:47:23 +0530
committerDandelion <nirav@teisuu.com>2018-10-20 18:47:23 +0530
commitf8f3159f9b98b024043bd8de2c5e15dd2adf03ca (patch)
tree0ccaa16120845ef816199dc02f2866c4be1fbba3 /src/image.c
parenta7488f38fef1960086af860063f1958fb75d58f3 (diff)
downloadim-f8f3159f9b98b024043bd8de2c5e15dd2adf03ca.tar.gz
im-f8f3159f9b98b024043bd8de2c5e15dd2adf03ca.zip
Switched to gtk_init and gtk_main from gtk_application
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/image.c b/src/image.c
index 052f1b3..4b725e7 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1,8 +1,9 @@
-#include "image.h"
-#include "window.h"
#include <gtk-3.0/gtk/gtk.h>
#include <stdlib.h>
+#include "image.h"
+#include "window.h"
+
static GtkWidget *image;
static GdkPixbuf *pixbuf;
static GdkPixbuf *curr_pixbuf;
@@ -14,7 +15,6 @@ static int loading = 0;
static GFile *file;
static GFileInputStream *is;
-static GError *error = NULL;
GtkWidget *new_image()
{
@@ -29,11 +29,12 @@ void pixbuf_load_callback(GObject *source_object, GAsyncResult *res,
g_object_unref(pixbuf);
if (is != NULL)
g_object_unref(is);
+ GError *error = NULL;
pixbuf = gdk_pixbuf_new_from_stream_finish(res, &error);
if (error != NULL) {
loading = 0;
g_printerr("%s\n", error->message);
- return;
+ exit(EXIT_FAILURE);
}
curr_pixbuf_width = pixbuf_width = gdk_pixbuf_get_width(GDK_PIXBUF(pixbuf));
curr_pixbuf_height = pixbuf_height =
@@ -49,11 +50,12 @@ void pixbuf_load_callback(GObject *source_object, GAsyncResult *res,
void file_read_callback(GObject *source_object, GAsyncResult *res,
gpointer user_data)
{
+ GError *error = NULL;
is = g_file_read_finish(file, res, &error);
if (error != NULL) {
loading = 0;
g_printerr("%s\n", error->message);
- return;
+ exit(EXIT_FAILURE);
}
gdk_pixbuf_new_from_stream_async(G_INPUT_STREAM(is), NULL,
&pixbuf_load_callback, NULL);