gtk_widget_destroy(msgw); \
}
-static int gzopen_frontend(const char *path, int oflags, int mode)
-{
- int fd;
-
- if ((fd = open(path, oflags, mode)) < 0) return -1;
- if (!(gzf = gzdopen(fd, "rb"))) return -1;
- return 1;
-}
-
-static int gzclose_frontend(int nothing)
-{
- g_return_val_if_fail(gzf != NULL, 0);
- return gzclose(gzf);
-}
-
-static ssize_t gzread_frontend(int nothing, void *buf, size_t s)
-{
- return gzread(gzf, buf, s);
-}
-
-static ssize_t gzwrite_frontend(int nothing, const void *buf, size_t s)
-{
- return gzwrite(gzf, buf, s);
-}
+static int gzopen_frontend(const char *path, int oflags, int mode);
+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);
tartype_t funcs = {
(openfunc_t) gzopen_frontend,
gchar *dest;
gint r;
gchar *glob;
- GtkWidget *w;
+ gchar *curdir;
dest = g_build_path(G_DIR_SEPARATOR_S, g_get_home_dir(), ".themes", NULL);
r = mkdir(dest, 0777);
dest, strerror(errno));
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));
+ g_free(curdir);
return FALSE;
}
gtk_msg(GTK_MESSAGE_ERROR,
_("Unable to open the file \"%s\": %s"),
path, strerror(errno));
+ chdir(curdir);
+ g_free(curdir);
return FALSE;
}
path, strerror(errno));
g_free(dest);
+ chdir(curdir);
+ g_free(curdir);
return FALSE;
}
gtk_msg(GTK_MESSAGE_INFO, _("%s was installed to %s"), theme, dest);
- gtk_dialog_run(GTK_DIALOG(w));
- gtk_widget_destroy(w);
g_free(dest);
+ chdir(curdir);
+ g_free(curdir);
+
return TRUE;
}
+
+static int gzopen_frontend(const char *path, int oflags, int mode)
+{
+ int fd;
+
+ if ((fd = open(path, oflags, mode)) < 0) return -1;
+ if (!(gzf = gzdopen(fd, "rb"))) return -1;
+ return 1;
+}
+
+static int gzclose_frontend(int nothing)
+{
+ g_return_val_if_fail(gzf != NULL, 0);
+ return gzclose(gzf);
+}
+
+static ssize_t gzread_frontend(int nothing, void *buf, size_t s)
+{
+ return gzread(gzf, buf, s);
+}
+
+static ssize_t gzwrite_frontend(int nothing, const void *buf, size_t s)
+{
+ return gzwrite(gzf, buf, s);
+}
+