Re: Fw: new release
John Ellis <[email protected]> Sun, 15 Oct 2006 04:03:13 -0400
| Newsgroups | gmane.comp.gnome.apps.gqview.devel |
|---|---|
| Message-ID | <[email protected]> |
Bevis R W King wrote: [...] > I have yet to have time to work on the patch for the "issue" with too > many arguments that I mentioned to you in relation to: > > gqview DirA/* DirB/* DirC/* > > and > gqview DirA/ DirB/ DirC/ > > not doing the same thing. The issue being that the second case shows > the contents of DirA and complains about DirB and DirC being invalid. I > feel it should treat a directory name as a request to show everything in > that directory. Hi Bevis, could you try the attached patch and report any problems you encounter? With the patch, specifying any combination of files and/or folders should now work as expected. Patch is against 2.1.2, but should work on any version of 2.1.x and 2.0.x released thus far. Apply patch with: patch main.c gqview-dir-cmd-line-fix.patch Greetings, John -- John Ellis <[email protected]> http://gqview.sourceforge.net <GQview> | http://hideseek.sourceforge.net http://gqmpeg.sourceforge.net <GQmpeg> | <Preferences Hide and Seek> ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Gqview-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gqview-devel
gqview-dir-cmd-line-fix.patch
(text/x-patch, 4.1 KB)
Index: main.c
===================================================================
RCS file: /devel/cvs/gqview/src/main.c,v
retrieving revision 1.101
diff -u -r1.101 main.c
--- main.c 5 Mar 2005 21:06:33 -0000 1.101
+++ main.c 15 Oct 2006 07:47:00 -0000
@@ -817,15 +817,15 @@
static gint startup_command_line_collection = FALSE;
-static void parse_command_line_add_file(const gchar *new_path, gchar **path, gchar **file,
+static void parse_command_line_add_file(const gchar *file_path, gchar **path, gchar **file,
GList **list, GList **collection_list)
{
gchar *path_parsed;
- path_parsed = g_strdup(new_path);
+ path_parsed = g_strdup(file_path);
parse_out_relatives(path_parsed);
- if (file_extension_match(new_path, ".gqv"))
+ if (file_extension_match(path_parsed, ".gqv"))
{
*collection_list = g_list_append(*collection_list, path_parsed);
}
@@ -833,16 +833,85 @@
{
if (!*path) *path = remove_level_from_path(path_parsed);
if (!*file) *file = g_strdup(path_parsed);
- *list = g_list_append(*list, path_parsed);
+ *list = g_list_prepend(*list, path_parsed);
}
}
+static void parse_command_line_add_dir(const gchar *dir, gchar **path, gchar **file,
+ GList **list)
+{
+ GList *files = NULL;
+ gchar *path_parsed;
+
+ path_parsed = g_strdup(dir);
+ parse_out_relatives(path_parsed);
+
+ if (path_list(path_parsed, &files, NULL))
+ {
+ GList *work;
+
+ files = path_list_filter(files, FALSE);
+ files = path_list_sort(files);
+
+ work = files;
+ while (work)
+ {
+ gchar *p;
+
+ p = work->data;
+ if (!*path) *path = remove_level_from_path(p);
+ if (!*file) *file = g_strdup(p);
+ *list = g_list_prepend(*list, p);
+
+ work = work->next;
+ }
+
+ g_list_free(files);
+ }
+
+ g_free(path_parsed);
+}
+
+static void parse_command_line_process_dir(const gchar *dir, gchar **path, gchar **file,
+ GList **list, gchar **first_dir)
+{
+
+ if (!*list && !*first_dir)
+ {
+ *first_dir = g_strdup(dir);
+ }
+ else
+ {
+ if (*first_dir)
+ {
+ parse_command_line_add_dir(*first_dir, path, file, list);
+ g_free(*first_dir);
+ *first_dir = NULL;
+ }
+ parse_command_line_add_dir(dir, path, file, list);
+ }
+}
+
+static void parse_command_line_process_file(const gchar *file_path, gchar **path, gchar **file,
+ GList **list, GList **collection_list, gchar **first_dir)
+{
+
+ if (*first_dir)
+ {
+ parse_command_line_add_dir(*first_dir, path, file, list);
+ g_free(*first_dir);
+ *first_dir = NULL;
+ }
+ parse_command_line_add_file(file_path, path, file, list, collection_list);
+}
+
static void parse_command_line(int argc, char *argv[], gchar **path, gchar **file,
GList **cmd_list, GList **collection_list)
{
GList *list = NULL;
GList *remote_list = NULL;
gint remote_do = FALSE;
+ gchar *first_dir = NULL;
if (argc > 1)
{
@@ -854,21 +923,23 @@
const gchar *cmd_line = argv[i];
gchar *cmd_all = concat_dir_and_file(base_dir, cmd_line);
- if (!*path && cmd_line[0] == '/' && isdir(cmd_line))
+ if (cmd_line[0] == '/' && isdir(cmd_line))
{
- *path = g_strdup(cmd_line);
+ parse_command_line_process_dir(cmd_line, path, file, &list, &first_dir);
}
- else if (!*path && isdir(cmd_all))
+ else if (isdir(cmd_all))
{
- *path = g_strdup(cmd_all);
+ parse_command_line_process_dir(cmd_all, path, file, &list, &first_dir);
}
else if (cmd_line[0] == '/' && isfile(cmd_line))
{
- parse_command_line_add_file(cmd_line, path, file, &list, collection_list);
+ parse_command_line_process_file(cmd_line, path, file,
+ &list, collection_list, &first_dir);
}
else if (isfile(cmd_all))
{
- parse_command_line_add_file(cmd_all, path, file, &list, collection_list);
+ parse_command_line_process_file(cmd_all, path, file,
+ &list, collection_list, &first_dir);
}
else if (strcmp(cmd_line, "--debug") == 0)
{
@@ -979,6 +1050,15 @@
parse_out_relatives(*file);
}
+ list = g_list_reverse(list);
+
+ if (!*path && first_dir)
+ {
+ *path = first_dir;
+ first_dir = NULL;
+ }
+ g_free(first_dir);
+
if (remote_do)
{
gqview_remote_control(argv[0], remote_list, *path, list, *collection_list);