~ubuntu-branches/ubuntu/dapper/file-roller/dapper-updates

« back to all changes in this revision

Viewing changes to src/recent-files/egg-recent-util.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-12-13 00:19:53 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051213001953-0klipgnhk6vikhrt
Tags: 2.13.2-0ubuntu1
* New upstream version:
  - Fixed bug #323713: "Save as" should default to current archive filename
    (Ubuntu: #20132)
  - Fixed bug #315069: file-roller: drag 'n drop doesn't work for more
    than 1 file.
  - Fixed bug #323534: Passwords improperly escaped for zip files
  - Do not open a progress dialog when dragging files, use a progressbar
    in the statusbar instead.
  - Fixed bug #316364: Nautilus dependency should be optional
  - Fixed bug #311821: ascending and descending indicators are opposite
    from expected.
  - Fixed bug #317423: Conflicting mnemonic in "Extract" dialog.
  - Fixed bug #323068: file-roller fails in chosing extract-to directory
  - Fixed bug #322197: Improve Naming Filename when create new Archive file
  - Fixed bug #316564: needs unzip AND zip
    (Ubuntu: #15595)
  - Simplified the add dialog populating the file type combobox with the
    extensions instead of the descriptions.
  - Set progress dialog display delay to 1 second.
  - More HIG compliant progress dialog.
  - Use a single command execution to add many files and folders to an
    archive to speed up the operation.
  - Allow to stop creation of a new archive.
  - Correctly associate fr to 7zip files.
* debian/patches/03_lp-autoconf.patch:
  - updated

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#include <stdio.h>
3
3
#include <string.h>
4
4
#include <gtk/gtk.h>
 
5
#ifndef USE_STABLE_LIBGNOMEUI
 
6
#include <libgnomeui/gnome-icon-lookup.h>
 
7
#endif
5
8
#include <time.h>
6
9
#include <unistd.h>
7
10
#include <sys/types.h>
8
 
#ifndef USE_STABLE_LIBGNOMEUI
9
 
#include <libgnomeui/gnome-icon-theme.h>
10
 
#include <libgnomeui/gnome-icon-lookup.h>
11
 
#endif
12
11
#include <math.h>
13
12
#include "egg-recent-util.h"
14
13
 
57
56
        return g_string_free (str, FALSE);
58
57
}
59
58
 
60
 
#ifndef USE_STABLE_LIBGNOMEUI
61
 
static GdkPixbuf *
62
 
load_icon_file (char          *filename,
63
 
                guint          nominal_size)
64
 
{
65
 
        GdkPixbuf *pixbuf, *scaled_pixbuf;
66
 
        guint width, height;
67
 
 
68
 
        pixbuf = gdk_pixbuf_new_from_file_at_size (filename, nominal_size, nominal_size, NULL);
69
 
 
70
 
        if (pixbuf == NULL) {
71
 
                return NULL;
72
 
        }
73
 
        
74
 
        width = gdk_pixbuf_get_width (pixbuf); 
75
 
        height = gdk_pixbuf_get_height (pixbuf);
76
 
        /* if the icon is larger than the nominal size, scale down */
77
 
        if (MAX (width, height) > nominal_size) {
78
 
                if (width > height) {
79
 
                        height = height * nominal_size / width;
80
 
                        width = nominal_size;
81
 
                } else {
82
 
                        width = width * nominal_size / height;
83
 
                        height = nominal_size;
84
 
                }
85
 
                scaled_pixbuf = gdk_pixbuf_scale_simple
86
 
                        (pixbuf, width, height, GDK_INTERP_BILINEAR);
87
 
                g_object_unref (pixbuf);
88
 
                pixbuf = scaled_pixbuf;
89
 
        }
90
 
 
91
 
        return pixbuf;
92
 
}
93
 
 
94
59
GdkPixbuf *
95
 
egg_recent_util_get_icon (GnomeIconTheme *theme, const gchar *uri,
 
60
egg_recent_util_get_icon (GtkIconTheme *theme, const gchar *uri,
96
61
                          const gchar *mime_type, int size)
97
62
{
 
63
#ifndef USE_STABLE_LIBGNOMEUI
98
64
        gchar *icon;
99
 
        gchar *filename;
100
 
        const GnomeIconData *icon_data;
101
65
        GdkPixbuf *pixbuf;
102
66
        
103
67
        icon = gnome_icon_lookup (theme, NULL, uri, NULL, NULL,
104
68
                                  mime_type, 0, NULL);
105
 
        
106
69
 
107
70
        g_return_val_if_fail (icon != NULL, NULL);
108
71
 
109
 
        filename = gnome_icon_theme_lookup_icon (theme, icon,
110
 
                                                 size,
111
 
                                                 &icon_data,
112
 
                                                 NULL);
 
72
        pixbuf = gtk_icon_theme_load_icon (theme, icon, size, 0, NULL);
113
73
        g_free (icon);
114
74
 
115
 
        if (filename == NULL) {
116
 
                return NULL;
117
 
        }
118
 
 
119
 
        pixbuf = load_icon_file (filename, size);
120
 
        g_free (filename);
121
 
        
122
 
        
123
75
        return pixbuf;
 
76
#endif
 
77
        return NULL;
124
78
}
125
 
#endif /* !USE_STABLE_LIBGNOMEUI */
126
79
 
127
80
gchar *
128
81
egg_recent_util_get_unique_id (void)