From 1a4744f6237df4e7892134eb76ca31d39bfbd459 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 29 May 2007 23:49:55 +0000 Subject: [PATCH] more splitting to functions --- src/install.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/install.c b/src/install.c index 44bf9c9..2bce641 100644 --- a/src/install.c +++ b/src/install.c @@ -29,6 +29,7 @@ static int gzclose_frontend(int nothing); static ssize_t gzread_frontend(int nothing, void *buf, size_t s); static ssize_t gzwrite_frontend(int nothing, const void *buf, size_t s); static gchar *get_theme_dir(); +static gboolean change_dir(const gchar *dir); tartype_t funcs = { (openfunc_t) gzopen_frontend, @@ -55,6 +56,17 @@ static gchar *get_theme_dir() return dir; } +static gboolean change_dir(const gchar *dir) +{ + if (chdir(dest) == -1) { + gtk_msg(GTK_MESSAGE_ERROR, + _("Unable to move to directory \"%s\": %s"), + dest, strerror(errno)); + return FALSE; + } + return TRUE; +} + gboolean install_theme(char *path, char *theme) { TAR *t; @@ -67,10 +79,7 @@ gboolean install_theme(char *path, char *theme) return FALSE; curdir = g_get_current_dir(); - if (chdir(dest) == -1) { - gtk_msg(GTK_MESSAGE_ERROR, - _("Unable to move to directory \"%s\": %s"), - dest, strerror(errno)); + if (!change_dir(dest)) { g_free(curdir); return FALSE; } -- 2.39.2