summaryrefslogtreecommitdiff
path: root/indra/linux_updater/linux_updater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/linux_updater/linux_updater.cpp')
-rw-r--r--indra/linux_updater/linux_updater.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/indra/linux_updater/linux_updater.cpp b/indra/linux_updater/linux_updater.cpp
index d909516bf8..808ab3f64f 100644
--- a/indra/linux_updater/linux_updater.cpp
+++ b/indra/linux_updater/linux_updater.cpp
@@ -33,6 +33,7 @@
#include "llerrorcontrol.h"
#include "llfile.h"
#include "lldir.h"
+#include "lldiriterator.h"
#include "llxmlnode.h"
#include "lltrans.h"
@@ -55,6 +56,8 @@ typedef struct _updater_app_state {
std::string strings_dirs;
std::string strings_file;
+ LLDirIterator *image_dir_iter;
+
GtkWidget *window;
GtkWidget *progress_bar;
GtkWidget *image;
@@ -108,7 +111,7 @@ bool translate_init(std::string comma_delim_path_list,
void updater_app_ui_init(void);
void updater_app_quit(UpdaterAppState *app_state);
void parse_args_and_init(int argc, char **argv, UpdaterAppState *app_state);
-std::string next_image_filename(std::string& image_path);
+std::string next_image_filename(std::string& image_path, LLDirIterator& iter);
void display_error(GtkWidget *parent, std::string title, std::string message);
BOOL install_package(std::string package_file, std::string destination);
BOOL spawn_viewer(UpdaterAppState *app_state);
@@ -174,7 +177,7 @@ void updater_app_ui_init(UpdaterAppState *app_state)
// load the first image
app_state->image = gtk_image_new_from_file
- (next_image_filename(app_state->image_dir).c_str());
+ (next_image_filename(app_state->image_dir, *app_state->image_dir_iter).c_str());
gtk_widget_set_size_request(app_state->image, 340, 310);
gtk_container_add(GTK_CONTAINER(frame), app_state->image);
@@ -205,7 +208,7 @@ gboolean rotate_image_cb(gpointer data)
llassert(data != NULL);
app_state = (UpdaterAppState *) data;
- filename = next_image_filename(app_state->image_dir);
+ filename = next_image_filename(app_state->image_dir, *app_state->image_dir_iter);
gdk_threads_enter();
gtk_image_set_from_file(GTK_IMAGE(app_state->image), filename.c_str());
@@ -214,10 +217,10 @@ gboolean rotate_image_cb(gpointer data)
return TRUE;
}
-std::string next_image_filename(std::string& image_path)
+std::string next_image_filename(std::string& image_path, LLDirIterator& iter)
{
std::string image_filename;
- gDirUtilp->getNextFileInDir(image_path, "/*.jpg", image_filename);
+ iter.next(image_filename);
return image_path + "/" + image_filename;
}
@@ -741,6 +744,7 @@ void parse_args_and_init(int argc, char **argv, UpdaterAppState *app_state)
else if ((!strcmp(argv[i], "--image-dir")) && (++i < argc))
{
app_state->image_dir = argv[i];
+ app_state->image_dir_iter = new LLDirIterator(argv[i], "/*.jpg");
}
else if ((!strcmp(argv[i], "--dest")) && (++i < argc))
{
@@ -825,6 +829,7 @@ int main(int argc, char **argv)
}
bool success = !app_state->failure;
+ delete app_state->image_dir_iter;
delete app_state;
return success ? 0 : 1;
}