Author: colossus
Date: 2008-08-20 11:30:33 +0000 (Wed, 20 Aug 2008)
New Revision: 27524

Removed:
   xarchiver/trunk/src/glib-mem.h
   xarchiver/trunk/src/mime-type/
Modified:
   xarchiver/trunk/src/7zip.c
   xarchiver/trunk/src/7zip.h
   xarchiver/trunk/src/Makefile.am
   xarchiver/trunk/src/add_dialog.c
   xarchiver/trunk/src/archive.c
   xarchiver/trunk/src/interface.c
   xarchiver/trunk/src/interface.h
   xarchiver/trunk/src/main.c
   xarchiver/trunk/src/mime.c
   xarchiver/trunk/src/mime.h
   xarchiver/trunk/src/open-with-dlg.c
   xarchiver/trunk/src/pref_dialog.c
   xarchiver/trunk/src/string_utils.c
   xarchiver/trunk/src/string_utils.h
   xarchiver/trunk/src/support.h
   xarchiver/trunk/src/window.c
Log:
Reverted mime code to the one prior revision 26783.
Changed string "Size of the mime type icon" to "Icon size".
Made the option Icon size in the pref dialog to be honoured.
Moved the function xa_7zip_recurse_local_directory() as 
xa_recurse_local_directory() in string_utils.c.
Made the function xa_recurse_local_directory() to do its job.


Modified: xarchiver/trunk/src/7zip.c
===================================================================
--- xarchiver/trunk/src/7zip.c  2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/7zip.c  2008-08-20 11:30:33 UTC (rev 27524)
@@ -19,7 +19,6 @@
 #include "config.h"
 #include <string.h>
 #include <unistd.h>
-#include <dirent.h>
 #include "7zip.h"
 
 extern gboolean sevenzr;
@@ -210,22 +209,17 @@
        _names = names;
        while (_names)
        {
-               
xa_7zip_recurse_local_directory((gchar*)_names->data,&dirlist,archive->add_recurse);
+               
xa_recurse_local_directory((gchar*)_names->data,&dirlist,archive->add_recurse);
                _names = _names->next;
        }
        if (dirlist == NULL)
-               xa_cat_filenames(archive,names,files);
-       else
-               xa_cat_filenames(archive,dirlist,files);
+               dirlist = names;
 
-       if (dirlist != NULL)
-       {
-               g_slist_foreach(dirlist,(GFunc)g_free,NULL);
-               g_slist_free(dirlist);
-       }
-       g_slist_foreach(names,(GFunc)g_free,NULL);
-       g_slist_free(names);
+       xa_cat_filenames(archive,dirlist,files);
 
+       g_slist_foreach(dirlist,(GFunc)g_free,NULL);
+       g_slist_free(dirlist);
+
        if (archive->location_entry_path != NULL)
                chdir (archive->tmp);
 
@@ -303,27 +297,3 @@
        xa_run_command (archive,list);
 }
 
-void xa_7zip_recurse_local_directory(gchar *path,GSList **list,gboolean 
recurse)
-{
-       DIR *dir;
-       struct dirent *dirlist;
-       gchar *fullname = NULL;
-
-       dir = opendir(path);
-
-       if (dir == NULL)
-               return;
-       *list = g_slist_append(*list,path);
-       if (recurse)
-       {
-               while ((dirlist = readdir(dir)))
-               {
-                       if (dirlist->d_name[0] == '.')
-                               continue;
-                       fullname = g_strconcat (path,"/",dirlist->d_name,NULL);
-                       if (g_file_test(fullname,G_FILE_TEST_IS_DIR))
-                               
xa_7zip_recurse_local_directory(fullname,list,recurse);
-               }
-       }
-       closedir(dir);
-}

Modified: xarchiver/trunk/src/7zip.h
===================================================================
--- xarchiver/trunk/src/7zip.h  2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/7zip.h  2008-08-20 11:30:33 UTC (rev 27524)
@@ -32,5 +32,4 @@
 void xa_7zip_test (XArchive *);
 void xa_open_7zip (XArchive *);
 void xa_get_7zip_line_content (gchar *, gpointer );
-void xa_7zip_recurse_local_directory(gchar *,GSList **,gboolean);
 #endif

Modified: xarchiver/trunk/src/Makefile.am
===================================================================
--- xarchiver/trunk/src/Makefile.am     2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/Makefile.am     2008-08-20 11:30:33 UTC (rev 27524)
@@ -1,15 +1,7 @@
 bin_PROGRAMS = xarchiver
 
-if USE_LIBMIMETYPE
-MIME_TYPE_DIR = mime-type
-MIME_LIB = $(top_builddir)/src/mime-type/libmimetype.la
-else
-MIME_TYPE_DIR = xdgmime
-MIME_LIB = $(top_builddir)/src/xdgmime/libxdgmime.la
-endif
+SUBDIRS = xdgmime
 
-SUBDIRS = $(MIME_TYPE_DIR)
-
 xarchiver_SOURCES = \
        socket.c socket.h \
        main.c main.h \
@@ -45,7 +37,7 @@
        -DLOCALEDIR=\"$(localedir)\"
 
 xarchiver_LDADD = \
-       $(MIME_LIB) \
+       $(top_builddir)/src/xdgmime/libxdgmime.la \
        @GTK_LIBS@ \
        @GLIB_LIBS@
 

Modified: xarchiver/trunk/src/add_dialog.c
===================================================================
--- xarchiver/trunk/src/add_dialog.c    2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/add_dialog.c    2008-08-20 11:30:33 UTC (rev 27524)
@@ -446,8 +446,8 @@
                        slist = list;
                        while (slist)
                        {
-                               esc  = xa_escape_bad_chars (slist->data, "\\");
-                               esc2 = xa_escape_bad_chars (esc, "$'`\"\\!?* 
()[]&|:;<>#");
+                               esc  = xa_escape_bad_chars (slist->data,"\\");
+                               esc2 = xa_escape_bad_chars (esc,"$'`\"\\!?* 
()[]&|:;<>#");
                                g_free (esc);
                                g_string_append(items,esc2);
                                g_string_append_c(items,' ');
@@ -459,7 +459,7 @@
                        cmd_list = g_slist_append(cmd_list,command);
                        xa_run_command (archive,cmd_list);
                }
+               archive->status = XA_ARCHIVESTATUS_ADD;
        }
-       archive->status = XA_ARCHIVESTATUS_ADD;
        (*archive->add) (archive,list,compression_string);
 }

Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c       2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/archive.c       2008-08-20 11:30:33 UTC (rev 27524)
@@ -69,7 +69,7 @@
                NULL,
                argv,
                NULL,
-               G_SPAWN_LEAVE_DESCRIPTORS_OPEN | G_SPAWN_SEARCH_PATH | 
G_SPAWN_DO_NOT_REAP_CHILD,
+               (G_SPAWN_LEAVE_DESCRIPTORS_OPEN | G_SPAWN_SEARCH_PATH | 
G_SPAWN_DO_NOT_REAP_CHILD),
                NULL,
                NULL,
                &archive->child_pid,
@@ -120,7 +120,7 @@
        for (scan = list; scan != NULL; )
        {
                length = 0;
-               while ((scan != NULL) && (length < 5000))
+               while ((scan != NULL) && (length < 5000)) //MAX_CMD_LEN
                {
                        length += strlen (scan->data);
                        chunks = g_slist_prepend(chunks,scan->data);
@@ -376,7 +376,6 @@
                gtk_widget_set_sensitive (Stop_button,TRUE);
                while (_commands)
                {
-                       g_print ("xa_run_command: pb source: 
%d\n",archive->pb_source);
                        g_print ("%s\n",(gchar*)_commands->data);
                        xa_spawn_async_process (archive,_commands->data);
                        if (archive->child_pid == 0)

Deleted: xarchiver/trunk/src/glib-mem.h

Modified: xarchiver/trunk/src/interface.c
===================================================================
--- xarchiver/trunk/src/interface.c     2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/interface.c     2008-08-20 11:30:33 UTC (rev 27524)
@@ -56,6 +56,8 @@
        accel_group = gtk_accel_group_new ();
        xa_set_window_title (xa_main_window ,NULL);
 
+       /* icon_theme is initialized in pref_dialog.c:45 */
+       g_signal_connect (G_OBJECT (icon_theme), "changed",G_CALLBACK 
(xa_icon_theme_changed),NULL);
        icon = gtk_icon_theme_load_icon(icon_theme,"xarchiver",24,0,NULL);
        gtk_window_set_icon (GTK_WINDOW(xa_main_window),icon);
        g_signal_connect (G_OBJECT (xa_main_window),"delete-event",G_CALLBACK 
(xa_quit_application),NULL);
@@ -483,7 +485,7 @@
        gtk_widget_show (total_frame);
        gtk_box_pack_start (GTK_BOX (hbox_sb),total_frame,TRUE,TRUE,0);
        gtk_frame_set_label_align (GTK_FRAME (total_frame),0,0);
-       gtk_frame_set_shadow_type (GTK_FRAME 
(total_frame),GTK_SHADOW_ETCHED_OUT);
+       gtk_frame_set_shadow_type (GTK_FRAME (total_frame),GTK_SHADOW_OUT);
 
        total_label = gtk_label_new (NULL);
        gtk_misc_set_alignment (GTK_MISC(total_label),0.0,0.5);
@@ -493,7 +495,7 @@
        selected_frame = gtk_frame_new (NULL);
        gtk_box_pack_start (GTK_BOX (hbox_sb),selected_frame,TRUE,TRUE,0);
        gtk_frame_set_label_align (GTK_FRAME (selected_frame),0,0);
-       gtk_frame_set_shadow_type (GTK_FRAME 
(selected_frame),GTK_SHADOW_ETCHED_OUT);
+       gtk_frame_set_shadow_type (GTK_FRAME (selected_frame),GTK_SHADOW_OUT);
 
        selected_label = gtk_label_new (NULL);
        gtk_misc_set_alignment (GTK_MISC(selected_label),0.0,0.5);
@@ -1522,7 +1524,14 @@
        message = g_strdup_printf("%.0f%s",percent,"%");
        gtk_progress_bar_set_text (GTK_PROGRESS_BAR(pb->progressbar1),message);
        g_free(message);
-       
        while (gtk_events_pending())
                gtk_main_iteration();
 }
+
+void xa_icon_theme_changed (GtkIconTheme *icon_theme,gpointer data)
+{
+       /* TODO:
+        * Here we should reload all the icons currently displayed according to 
the
+        * new icon_theme. xa_get_pixbuf_icon_from_cache() is to be called as 
many
+        * time as the filenames currently displayed. What of the other tabs 
then? */   
+}

Modified: xarchiver/trunk/src/interface.h
===================================================================
--- xarchiver/trunk/src/interface.h     2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/interface.h     2008-08-20 11:30:33 UTC (rev 27524)
@@ -38,6 +38,7 @@
 GtkCellRenderer *archive_dir_renderer;
 GtkAccelGroup *accel_group;
 GtkTooltips *tooltips;
+GtkIconTheme *icon_theme;
 
 GtkWidget *xa_popup_menu, *xa_main_window, *vbox1, *hbox_sb, *menubar1, 
*menuitem1, *menuitem1_menu, *new1, *open1, *listing, *listing_submenu,
 *listing_text, *listing_html, *save1, *entry1, *green_led, *red_led, 
*progressbar, *total_label,*selected_label, *total_frame,*selected_frame,
@@ -71,4 +72,5 @@
 gboolean xa_sidepane_drag_motion ( GtkWidget*,GdkDragContext *,gint x,gint 
y,guint ,gpointer );
 Progress_bar_data *xa_create_progress_bar();
 void xa_increase_progress_bar(Progress_bar_data *,gchar *,double ,gboolean );
+void xa_icon_theme_changed (GtkIconTheme *,gpointer );
 #endif

Modified: xarchiver/trunk/src/main.c
===================================================================
--- xarchiver/trunk/src/main.c  2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/main.c  2008-08-20 11:30:33 UTC (rev 27524)
@@ -107,8 +107,6 @@
        if (multi_extract || add_files || ask_and_extract || ask_and_add || 
extract_path != NULL)
                batch_mode = TRUE;
 
-       xa_mime_type_init();    /* initialize mime-type cache */
-
        xa_set_available_archivers();
        prefs_window   = xa_create_prefs_dialog();
        extract_window = xa_create_extract_dialog();

Modified: xarchiver/trunk/src/mime.c
===================================================================
--- xarchiver/trunk/src/mime.c  2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/mime.c  2008-08-20 11:30:33 UTC (rev 27524)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2007 Giuseppe Torelli <[EMAIL PROTECTED]>
+ *  Copyright (c) 2008 Giuseppe Torelli <[EMAIL PROTECTED]>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -16,93 +16,21 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 
-#include "glib-mem.h"  /* provide compatibility macros for g_slice */
 #include "mime.h"
-#include "mime-type/mime-type.h"
 
-typedef struct _XAMimeType
+GSList *icon_cache = NULL;
+extern GtkIconTheme *icon_theme;
+const char *xa_get_stock_mime_icon(char *filename)
 {
-       char* name;
-       char* icon_name;
-       char* desc;
-       GdkPixbuf* icon;
-}XAMimeType;
+       const char *mime;
+       const char *icon_name = "binary";
 
-static GHashTable *mime_cache = NULL;
-static GdkPixbuf *folder_icon = NULL;
-static GdkPixbuf *lock_icon = NULL;
-       
-static void xa_mime_type_free( XAMimeType* type )
-{
-       g_free( type->name );
-       g_free( type->icon_name );
-       g_free( type->desc );
-       if( type->icon )
-               g_object_unref( type->icon );
-       g_slice_free( XAMimeType, type );
-}
-
-void xa_mime_type_init()
-{
-#ifdef USE_MIMETYPE
-/*
-    GtkIconTheme * theme;
-    MimeCache** caches;
-    int i, n_caches;
-*/
-    mime_type_init();
-
-#if 0
-    /* install file alteration monitor for mime-cache */
-    caches = mime_type_get_caches( &n_caches );
-    mime_caches_monitor = g_new0( VFSFileMonitor*, n_caches );
-    for( i = 0; i < n_caches; ++i )
-    {
-        VFSFileMonitor* fm = vfs_file_monitor_add_file( caches[i]->file_path,
-                                                                
on_mime_cache_changed, caches[i] );
-        mime_caches_monitor[i] = fm;
-    }
-    theme = gtk_icon_theme_get_default();
-    theme_change_notify = g_signal_connect( theme, "changed",
-                                            G_CALLBACK( on_icon_theme_changed 
),
-                                            NULL );
-#endif
-
-#endif
-
-    mime_cache = g_hash_table_new_full( g_str_hash, g_str_equal,
-                                       NULL, (GDestroyNotify)xa_mime_type_free 
);
-
-}
-
-static XAMimeType* lookup_mime_type( const char* name )
-{
-    XAMimeType* type;
-    type = (XAMimeType*)g_hash_table_lookup( mime_cache, name );
-    if( G_UNLIKELY( ! type ) )
-    {
-       type = g_slice_new0( XAMimeType );
-       type->name = g_strdup( name );
-       g_hash_table_insert( mime_cache, type->name, type);
-    }
-       return type;
-}
-
-const char *xa_get_stock_mime_icon(const char *filename, const char *mime)
-{
-       const char *icon_name = NULL;
-
+       mime = xdg_mime_get_mime_type_from_file_name(filename);
        //g_print ("%s\t%s\n",filename,mime);
        if (strstr(filename,".ogg") || strstr(filename,".flac") )
                icon_name = "sound";
-       else if( NULL == mime )
-               return NULL;
-
-       if (strncmp(mime,"image/",6) == 0)
+       else if (strncmp(mime,"image/",6) == 0)
                icon_name = "image";
        else if (strcmp(mime,"text/html") == 0)
                icon_name = "html";
@@ -134,96 +62,63 @@
                icon_name = "gnome-mime-application-x-perl";
        else if (strcmp(mime,"application/x-font-ttf") == 0)
                icon_name = "gnome-mime-application-x-font-ttf";
-       return icon_name;
+       return icon_name;               
 }
 
-GdkPixbuf *xa_get_pixbuf_icon_from_cache(const gchar *filename)
+GdkPixbuf *xa_get_pixbuf_icon_from_cache(gchar *filename,gint size)
 {
-    char icon_name[ 100 ];
-       const char* mime_type;
-       XAMimeType* mime = NULL;
+       pixbuf_cache *tie = NULL;
+       const gchar *icon_name;
+       GSList *found = NULL;
+       GdkPixbuf *pixbuf = NULL;
 
        if (strcmp(filename,"folder") == 0)
-       {
-               if( G_LIKELY( folder_icon ) )
-                       return (GdkPixbuf*)g_object_ref( folder_icon );
-               folder_icon = gtk_icon_theme_load_icon(icon_theme,"folder", 20, 
0, NULL);
-               if( G_UNLIKELY( ! folder_icon ) )
-                       folder_icon = 
gtk_icon_theme_load_icon(icon_theme,"gnome-fs-directory", 20, 0, NULL);
-               return folder_icon ? (GdkPixbuf*)g_object_ref( folder_icon ) : 
NULL;
-       }
+               icon_name = filename;
        else if (strcmp(filename,"lock") == 0)
-       {
-               if( G_LIKELY( lock_icon ) )
-                       return (GdkPixbuf*)g_object_ref( lock_icon );
-               lock_icon = 
gtk_icon_theme_load_icon(icon_theme,GTK_STOCK_DIALOG_AUTHENTICATION, 20, 
0,NULL);
-               return lock_icon ? (GdkPixbuf*)g_object_ref( lock_icon ) : NULL;
-       }
+               icon_name = "gtk-dialog-authentication";
        else
-       {
-               char* sep;
-               GdkPixbuf* icon = NULL;
-#ifdef USE_MIMETYPE
-               mime_type = mime_type_get_by_filename(filename, NULL);
-#else
-               mime_type = xdg_mime_get_mime_type_from_file_name(filename);
-#endif
+               icon_name = xa_get_stock_mime_icon(filename);
 
-               if( mime_type )
+       tie = g_new0(pixbuf_cache,1);
+       if (tie)
+       {
+               tie->icon_name = g_strdup(icon_name);
+               found = 
g_slist_find_custom(icon_cache,tie,(GCompareFunc)xa_icon_name_compare_func);
+               if (found)
                {
-                       mime = lookup_mime_type( mime_type );
-
-                       if( mime->icon )
-                               return (GdkPixbuf*)g_object_ref( mime->icon );
-
-                       sep = strchr( mime->name, '/' );
-                       if ( sep )
-                       {
-                               strcpy( icon_name, mime->name );
-                               icon_name[ (sep - mime->name) ] = '-';
-                               icon = gtk_icon_theme_load_icon ( icon_theme, 
icon_name, 20, 0, NULL );
-                               if ( ! icon )
-                               {
-                                       strcpy( icon_name, "gnome-mime-" );
-                                       strncat( icon_name, mime->name, ( sep - 
mime->name ) );
-                                       strcat( icon_name, "-" );
-                                       strcat( icon_name, sep + 1 );
-                                       icon = gtk_icon_theme_load_icon ( 
icon_theme, icon_name, 20, 0, NULL );
-                               }
-                               if ( G_UNLIKELY( ! icon ) )
-                               {
-                                       icon_name[ 11 ] = 0;
-                                       strncat( icon_name, mime->name, ( sep - 
mime->name ) );
-                                       icon = gtk_icon_theme_load_icon ( 
icon_theme, icon_name, 20, 0, NULL );
-                               }
-                       }
+                       g_free (tie->icon_name);
+                       g_free (tie);
+                       return ((pixbuf_cache *)found->data)->pixbuf;
                }
-
-               if( G_UNLIKELY( !icon ) )
+               else
                {
-                       const char* fallback = xa_get_stock_mime_icon(filename, 
mime_type);
-                       if( fallback )
-                               icon = gtk_icon_theme_load_icon ( icon_theme, 
fallback, 20, 0, NULL );                  
-               }
-               if( G_UNLIKELY( !icon ) )
-               {
-                       /* prevent endless recursion of XDG_MIME_TYPE_UNKNOWN */
-                       if( G_LIKELY( strcmp(mime->name, XDG_MIME_TYPE_UNKNOWN) 
) )
+                       pixbuf = 
gtk_icon_theme_load_icon(icon_theme,icon_name,size,GTK_ICON_LOOKUP_FORCE_SVG,NULL);
+                       if (pixbuf)
                        {
-                               /* FIXME: fallback to icon of parent mime-type 
*/
-                               icon = xa_get_pixbuf_icon_from_cache( 
XDG_MIME_TYPE_UNKNOWN );
+                               tie->pixbuf = pixbuf;
+                               icon_cache = g_slist_prepend(icon_cache,tie);
                        }
-                       else /* unknown */
-                               icon = gtk_icon_theme_load_icon ( icon_theme, 
"unknown", 20, 0, NULL );
                }
-
-               mime->icon = icon;
-               return (GdkPixbuf*)g_object_ref( icon );
        }
-       return NULL;
+       return pixbuf;
 }
 
+gint xa_icon_name_compare_func(pixbuf_cache *a, pixbuf_cache *b)
+{
+       return strcmp(a->icon_name, b->icon_name);
+}
+
 void xa_free_icon_cache()
 {
-       g_hash_table_destroy( mime_cache );
+       GSList *x = icon_cache;
+
+       while (x)
+       {
+               pixbuf_cache *tie = x->data;
+               g_free (tie->icon_name);
+               g_object_unref (tie->pixbuf);
+               g_free(tie);
+               x = x->next;
+       }
+       g_slist_free(icon_cache);
 }

Modified: xarchiver/trunk/src/mime.h
===================================================================
--- xarchiver/trunk/src/mime.h  2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/mime.h  2008-08-20 11:30:33 UTC (rev 27524)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2007 Giuseppe Torelli <[EMAIL PROTECTED]>
+ *  Copyright (c) 2008 Giuseppe Torelli <[EMAIL PROTECTED]>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -34,10 +34,8 @@
        GdkPixbuf *pixbuf;
 };
 
-const char *xa_get_stock_mime_icon(const char *filename, const char* mime);
-GdkPixbuf *xa_get_pixbuf_icon_from_cache(const gchar *filename);
-gint xa_icon_name_compare_func(pixbuf_cache *a, pixbuf_cache *b);
+const char *xa_get_stock_mime_icon(char *);
+GdkPixbuf *xa_get_pixbuf_icon_from_cache(gchar *,gint);
+gint xa_icon_name_compare_func(pixbuf_cache *, pixbuf_cache *);
 void xa_free_icon_cache();
-void xa_mime_type_init();
-
 #endif

Modified: xarchiver/trunk/src/open-with-dlg.c
===================================================================
--- xarchiver/trunk/src/open-with-dlg.c 2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/open-with-dlg.c 2008-08-20 11:30:33 UTC (rev 27524)
@@ -50,7 +50,7 @@
        hbox1 = gtk_hbox_new (FALSE, 1);
        gtk_box_pack_start (GTK_BOX (vbox1),hbox1,FALSE,FALSE,0);
 
-       pixbuf = xa_get_pixbuf_icon_from_cache(filename);
+       pixbuf = xa_get_pixbuf_icon_from_cache(filename,40);
        mime_icon = gtk_image_new_from_pixbuf(pixbuf);
        gtk_box_pack_start (GTK_BOX (hbox1),mime_icon,FALSE,TRUE,0);
        gtk_misc_set_alignment (GTK_MISC (mime_icon),0,0);

Modified: xarchiver/trunk/src/pref_dialog.c
===================================================================
--- xarchiver/trunk/src/pref_dialog.c   2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/pref_dialog.c   2008-08-20 11:30:33 UTC (rev 27524)
@@ -137,7 +137,7 @@
        gtk_table_set_row_spacings (GTK_TABLE (table1), 2);
        gtk_table_set_col_spacings (GTK_TABLE (table1), 4);
 
-       label9 = gtk_label_new (_("Size of the mime type icons"));
+       label9 = gtk_label_new (_("Icons size (requires restart)"));
        gtk_table_attach (GTK_TABLE (table1), label9, 0, 1, 0, 1,
                      (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (GTK_SHRINK), 0, 0);
@@ -444,7 +444,7 @@
                gtk_combo_box_set_active 
(GTK_COMBO_BOX(prefs_data->combo_prefered_format),g_key_file_get_integer(xa_key_file,PACKAGE,"preferred_format",NULL));
                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON 
(prefs_data->confirm_deletion),g_key_file_get_boolean(xa_key_file,PACKAGE,"confirm_deletion",NULL));
                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON 
(prefs_data->store_output),g_key_file_get_boolean(xa_key_file,PACKAGE,"store_output",NULL));
-               //gtk_combo_box_set_active 
(GTK_COMBO_BOX(prefs_data->combo_archive_view),g_key_file_get_integer(xa_key_file,PACKAGE,"archive_view",NULL));
+
                gtk_combo_box_set_active 
(GTK_COMBO_BOX(prefs_data->combo_icon_size),g_key_file_get_integer(xa_key_file,PACKAGE,"icon_size",NULL));
                gtk_toggle_button_set_active 
(GTK_TOGGLE_BUTTON(prefs_data->check_show_comment),g_key_file_get_boolean(xa_key_file,PACKAGE,"show_archive_comment",NULL));
                gtk_toggle_button_set_active 
(GTK_TOGGLE_BUTTON(prefs_data->check_sort_filename_column),g_key_file_get_boolean(xa_key_file,PACKAGE,"sort_filename_content",NULL));

Modified: xarchiver/trunk/src/string_utils.c
===================================================================
--- xarchiver/trunk/src/string_utils.c  2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/string_utils.c  2008-08-20 11:30:33 UTC (rev 27524)
@@ -16,12 +16,7 @@
  *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
  */
 
-#include <gtk/gtk.h>
-#include <glib.h>
-#include <string.h>
 #include "string_utils.h"
-#include "utf8-fnmatch.h"
-#include "errno.h"
 
 #ifndef HAVE_MKDTEMP
 char *mkdtemp (gchar *tmpl)
@@ -336,3 +331,27 @@
   *sp = 0;
   return string;
 }
+
+void xa_recurse_local_directory(gchar *path,GSList **list,gboolean recurse)
+{
+       DIR *dir;
+       struct dirent *dirlist;
+       gchar *fullname = NULL;
+
+       dir = opendir(path);
+
+       if (dir == NULL)
+               return;
+       *list = g_slist_append(*list,path);
+       while ((dirlist = readdir(dir)))
+       {
+               if (dirlist->d_name[0] == '.')
+                       continue;
+               fullname = g_strconcat (path,"/",dirlist->d_name,NULL);
+               if (recurse && g_file_test(fullname,G_FILE_TEST_IS_DIR))
+                       xa_recurse_local_directory(fullname,list,recurse);
+               else
+                       *list = g_slist_append(*list,fullname);         
+       }
+       closedir(dir);
+}

Modified: xarchiver/trunk/src/string_utils.h
===================================================================
--- xarchiver/trunk/src/string_utils.h  2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/string_utils.h  2008-08-20 11:30:33 UTC (rev 27524)
@@ -23,6 +23,13 @@
 #include "config.h"
 #endif
 
+#include <gtk/gtk.h>
+#include <glib.h>
+#include <string.h>
+#include <dirent.h>
+#include "string_utils.h"
+#include "utf8-fnmatch.h"
+#include "errno.h"
 #include "archive.h"
 #ifndef HAVE_STRCASESTR
 const char *strcasestr(const char *haystack, const char *needle);
@@ -41,5 +48,6 @@
 gchar *xa_escape_filename (gchar *filename,gchar *meta_chars);
 GSList *xa_slist_copy(GSList *);
 gchar *itoa(int,int );
+void xa_recurse_local_directory(gchar *,GSList **,gboolean);
 #endif
 

Modified: xarchiver/trunk/src/support.h
===================================================================
--- xarchiver/trunk/src/support.h       2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/support.h       2008-08-20 11:30:33 UTC (rev 27524)
@@ -24,7 +24,6 @@
 #endif
 
 #include <gtk/gtk.h>
-GtkIconTheme *icon_theme;
 
 /*
  * Standard gettext macros.

Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c        2008-08-20 05:34:01 UTC (rev 27523)
+++ xarchiver/trunk/src/window.c        2008-08-20 11:30:33 UTC (rev 27524)
@@ -2817,6 +2817,7 @@
        unsigned short int i;
        gpointer current_column;
        gchar *filename;
+       gint size;
 
        archive->current_entry = entry;
        if (entry == NULL)
@@ -2872,7 +2873,11 @@
                else
                        filename = entry->filename;
 
-               pixbuf = xa_get_pixbuf_icon_from_cache(filename);
+               if (gtk_combo_box_get_active 
(GTK_COMBO_BOX(prefs_window->combo_icon_size)) == 0)
+                       size = 30;
+               else
+                       size = 20;
+               pixbuf = xa_get_pixbuf_icon_from_cache(filename,size);
                gtk_list_store_set (archive->liststore,&iter,archive->nc+1, 
entry,-1);
                gtk_list_store_set 
(archive->liststore,&iter,0,pixbuf,1,entry->filename,-1);
 

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to