patches/ristretto-03-main.diff
author kenmays
Thu, 09 Jun 2011 06:13:46 +0000
changeset 3505 9c9851c07943
permissions -rw-r--r--
SFExfce-ristretto.spec: Initial spec + patches
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3505
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
     1
--- ristretto-0.0.93/src/main.c	2011-02-28 13:45:44.000000000 -0500
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
     2
+++ ristretto-0.0.93/src/main.c	2011-06-09 01:55:15.806743500 -0400
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
     3
@@ -143,6 +143,7 @@
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
     4
 static gboolean
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
     5
 cb_rstto_open_files (RsttoOpenFiles *rof)
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
     6
 {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
     7
+    GFileType file_type;
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
     8
     GFile *file, *p_file, *child_file;
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
     9
     GFileInfo *file_info;
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    10
     const gchar *content_type, *filename;
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    11
@@ -156,7 +157,15 @@
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    12
             file = g_file_new_for_commandline_arg (rof->argv[rof->iter]);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    13
             if (file)
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    14
             {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    15
-                file_info = g_file_query_info (file, "standard::content-type", 0, NULL, NULL);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    16
+                if (rof->open_entire_folder) 
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    17
+                {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    18
+                    file_info = g_file_query_info (file, "standard::content-type,standard::type", 0, NULL, NULL);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    19
+                }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    20
+                else
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    21
+                {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    22
+                    file_info = g_file_query_info (file, "standard::content-type", 0, NULL, NULL);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    23
+                }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    24
+
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    25
                 if (file_info)
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    26
                 {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    27
                     content_type = g_file_info_get_attribute_string (file_info, "standard::content-type");
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    28
@@ -165,6 +174,29 @@
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    29
                     {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    30
                         rstto_image_list_add_file (rof->image_list, file, NULL);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    31
                     }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    32
+
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    33
+                    if (rof->open_entire_folder) 
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    34
+                    {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    35
+                        file_type = g_file_info_get_file_type(file_info);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    36
+                        if (file_type == G_FILE_TYPE_DIRECTORY)
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    37
+                        {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    38
+                            file_enumarator = g_file_enumerate_children (file, "standard::*", 0, NULL, NULL);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    39
+                            for(file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); file_info != NULL; file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    40
+                            {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    41
+                                filename = g_file_info_get_name (file_info);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    42
+                                content_type  = g_file_info_get_content_type (file_info);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    43
+                                child_file = g_file_get_child (file, filename);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    44
+
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    45
+                                if (strncmp (content_type, "image/", 6) == 0)
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    46
+                                {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    47
+                                    rstto_image_list_add_file (rof->image_list, child_file, NULL);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    48
+                                }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    49
+
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    50
+                                g_object_unref (child_file);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    51
+                                g_object_unref (file_info);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    52
+                            }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    53
+                        }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    54
+                    }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    55
                 }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    56
             }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    57
             rof->iter++;
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    58
@@ -176,10 +208,11 @@
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    59
         file = g_file_new_for_commandline_arg (rof->argv[rof->iter]);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    60
         if (file)
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    61
         {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    62
-            file_info = g_file_query_info (file, "standard::content-type", 0, NULL, NULL);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    63
+            file_info = g_file_query_info (file, "standard::content-type,standard::type", 0, NULL, NULL);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    64
             if (file_info)
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    65
             {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    66
                 content_type = g_file_info_get_attribute_string (file_info, "standard::content-type");
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    67
+                file_type = g_file_info_get_file_type (file_info);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    68
 
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    69
                 if (strncmp (content_type, "image/", 6) == 0)
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    70
                 {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    71
@@ -187,7 +220,13 @@
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    72
                 }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    73
             }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    74
         }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    75
-        p_file = g_file_get_parent (file);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    76
+        if (file_type != G_FILE_TYPE_DIRECTORY) {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    77
+            p_file = g_file_get_parent (file);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    78
+        }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    79
+        else
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    80
+        {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    81
+            p_file = file;
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    82
+        }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    83
         file_enumarator = g_file_enumerate_children (p_file, "standard::*", 0, NULL, NULL);
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    84
         for(file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); file_info != NULL; file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    85
         {
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    86
@@ -206,3 +245,5 @@
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    87
     }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    88
     return FALSE;
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    89
 }
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    90
+
9c9851c07943 SFExfce-ristretto.spec: Initial spec + patches
kenmays
parents:
diff changeset
    91
+