mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-25 02:36:07 +00:00
Preparations to make nautilus_file_get use async. I/O.
There's still a long way to go. * components/music/nautilus-music-view.c: (fetch_play_time), (format_play_time), (fetch_song_info), (play_status_display), (play_current_file), (nautilus_music_view_update_from_uri): Changed the music view so it doesn't use NautilusFile any more since it already has what it needs from gnome-vfs. There's still the issue of sync. vs. async. for this component. * libnautilus-extensions/Makefile.am: * libnautilus-extensions/nautilus-stock-dialogs.c: (nautilus_timed_wait_start), (nautilus_timed_wait_free), (nautilus_timed_wait_stop): * libnautilus-extensions/nautilus-stock-dialogs.h: Started on something called nautilus_timed_wait that we need to use when all our lines are busy. Checked it in since I'll be in Palo Alto and don't want any non-checked-in changes. * libnautilus-extensions/nautilus-background-canvas-group.c: Added comments and removed some dead code. * src/nautilus-window-menus.c: (uri_known_not_to_exist): Rewrote this to use sync. I/O on local files instead of using nautilus_file_get. * test/.cvsignore: Ignore some of the new files in this directory.
This commit is contained in:
parent
552d6733b5
commit
5a5c97ab0e
42
ChangeLog
42
ChangeLog
|
@ -1,3 +1,33 @@
|
|||
2000-06-13 Darin Adler <darin@eazel.com>
|
||||
|
||||
Preparations to make nautilus_file_get use async. I/O.
|
||||
There's still a long way to go.
|
||||
|
||||
* components/music/nautilus-music-view.c: (fetch_play_time),
|
||||
(format_play_time), (fetch_song_info), (play_status_display),
|
||||
(play_current_file), (nautilus_music_view_update_from_uri):
|
||||
Changed the music view so it doesn't use NautilusFile any more
|
||||
since it already has what it needs from gnome-vfs. There's still
|
||||
the issue of sync. vs. async. for this component.
|
||||
|
||||
* libnautilus-extensions/Makefile.am:
|
||||
* libnautilus-extensions/nautilus-stock-dialogs.c:
|
||||
(nautilus_timed_wait_start), (nautilus_timed_wait_free),
|
||||
(nautilus_timed_wait_stop):
|
||||
* libnautilus-extensions/nautilus-stock-dialogs.h:
|
||||
Started on something called nautilus_timed_wait that we need to
|
||||
use when all our lines are busy. Checked it in since I'll be in
|
||||
Palo Alto and don't want any non-checked-in changes.
|
||||
|
||||
* libnautilus-extensions/nautilus-background-canvas-group.c:
|
||||
Added comments and removed some dead code.
|
||||
|
||||
* src/nautilus-window-menus.c: (uri_known_not_to_exist):
|
||||
Rewrote this to use sync. I/O on local files instead of using
|
||||
nautilus_file_get.
|
||||
|
||||
* test/.cvsignore: Ignore some of the new files in this directory.
|
||||
|
||||
2000-06-13 Maciej Stachowiak <mjs@eazel.com>
|
||||
|
||||
* libnautilus-extensions/nautilus-mime-actions.c
|
||||
|
@ -110,15 +140,17 @@
|
|||
|
||||
2000-06-14 Anders Carlsson <andersca@gnu.org>
|
||||
|
||||
* libnautilus-extensions/nautilus-background-canvas-group.c
|
||||
* libnautilus-extensions/nautilus-background-canvas-group.c
|
||||
(nautilus_background_canvas_group_draw): Add a check to see if the
|
||||
NautilusBackground is too complex which means we have do draw if ourselves.
|
||||
NautilusBackground is too complex which means we have do draw if
|
||||
ourselves. Otherwise, we can have a light touch and let the canvas
|
||||
handle it without our "help".
|
||||
|
||||
* libnautilus-extensions/nautilus-background.c,
|
||||
libnautilus-extensions/nautilus-background.h
|
||||
(nautilus_background_is_too_complex_for_gtk_style): New function.
|
||||
Checks if a NautilusBackground is too complex to be drawn by GtkStyle, forcing
|
||||
us to draw it ourselves.
|
||||
Checks if a NautilusBackground is too complex to be drawn by
|
||||
GtkStyle, forcing us to draw it ourselves.
|
||||
|
||||
2000-06-13 Seth Nickell <seth@eazel.com>
|
||||
|
||||
|
@ -13310,5 +13342,3 @@ Fri Apr 14 16:35:32 2000 Raph Levien <raph@acm.org>
|
|||
2000-04-14 Maciej Stachowiak <mjs@eazel.com>
|
||||
|
||||
* ChangeLog-20000414: rolled over from ChangeLog.
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include <libnautilus/libnautilus.h>
|
||||
#include <libnautilus-extensions/nautilus-background.h>
|
||||
#include <libnautilus-extensions/nautilus-directory-background.h>
|
||||
#include <libnautilus-extensions/nautilus-file.h>
|
||||
#include <libnautilus-extensions/nautilus-file-utilities.h>
|
||||
#include <libnautilus-extensions/nautilus-gdk-pixbuf-extensions.h>
|
||||
#include <libnautilus-extensions/nautilus-glib-extensions.h>
|
||||
|
@ -540,24 +539,26 @@ fetch_bit_rate (const char *song_uri)
|
|||
|
||||
/* fetch_play_time takes the pathname to a file and returns the play time in seconds */
|
||||
static int
|
||||
fetch_play_time (const char *song_uri, int bitrate)
|
||||
fetch_play_time (GnomeVFSFileInfo *file_info, int bitrate)
|
||||
{
|
||||
NautilusFile *file = nautilus_file_get (song_uri + 7);
|
||||
GnomeVFSFileSize file_size = nautilus_file_get_size (file);
|
||||
nautilus_file_unref(file);
|
||||
|
||||
return file_size / (125 * bitrate);
|
||||
if ((file_info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) == 0) {
|
||||
/* FIXME: Unknown time should return 0? */
|
||||
return 0;
|
||||
}
|
||||
|
||||
return file_info->size / (125 * bitrate);
|
||||
}
|
||||
|
||||
/* format_play_time takes the pathname to a file and returns the play time formated as mm:ss */
|
||||
static char *
|
||||
format_play_time (const char *song_uri, int bitrate)
|
||||
format_play_time (int track_time)
|
||||
{
|
||||
int seconds = fetch_play_time(song_uri, bitrate);
|
||||
int minutes = seconds / 60;
|
||||
int remain_seconds = seconds - (60 * minutes);
|
||||
char *result = g_strdup_printf ("%d:%02d ", minutes, remain_seconds);
|
||||
return result;
|
||||
int seconds, minutes, remain_seconds;
|
||||
|
||||
seconds = track_time;
|
||||
minutes = seconds / 60;
|
||||
remain_seconds = seconds - (60 * minutes);
|
||||
return g_strdup_printf ("%d:%02d ", minutes, remain_seconds);
|
||||
}
|
||||
|
||||
/* utility routine to pull an initial number from the beginning of the passed in name.
|
||||
|
@ -590,7 +591,7 @@ extract_initial_number(const char *name_str)
|
|||
/* allocate a return a song info record, from an mp3 tag if present, or from intrinsic info */
|
||||
|
||||
static SongInfo *
|
||||
fetch_song_info (const char *song_uri, int file_order)
|
||||
fetch_song_info (const char *song_uri, GnomeVFSFileInfo *file_info, int file_order)
|
||||
{
|
||||
gboolean has_info = FALSE;
|
||||
SongInfo *info;
|
||||
|
@ -607,16 +608,16 @@ fetch_song_info (const char *song_uri, int file_order)
|
|||
/* if we couldn't get a track number, see if we can pull one from
|
||||
the beginning of the file name */
|
||||
if (info->track_number <= 0) {
|
||||
info->track_number = extract_initial_number(g_basename(song_uri));
|
||||
info->track_number = extract_initial_number(file_info->name);
|
||||
}
|
||||
|
||||
/* there was no id3 tag, so set up the info heuristically from the file name and file order */
|
||||
if (!has_info) {
|
||||
info->title = g_strdup (g_basename (song_uri));
|
||||
info->title = g_strdup (file_info->name);
|
||||
}
|
||||
|
||||
info->bitrate = fetch_bit_rate(song_uri);
|
||||
info->track_time = fetch_play_time(song_uri, info->bitrate);
|
||||
info->bitrate = fetch_bit_rate (song_uri);
|
||||
info->track_time = fetch_play_time (file_info, info->bitrate);
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -856,7 +857,6 @@ play_status_display (NautilusMusicView *music_view)
|
|||
update_play_controls_status(music_view, status);
|
||||
}
|
||||
|
||||
|
||||
if (is_playing) {
|
||||
if (!music_view->details->slider_dragging) {
|
||||
frameNo = get_current_frame();
|
||||
|
@ -887,38 +887,45 @@ play_status_display (NautilusMusicView *music_view)
|
|||
/* track incrementing routines */
|
||||
|
||||
static void
|
||||
play_current_file(NautilusMusicView *music_view, gboolean from_start)
|
||||
play_current_file (NautilusMusicView *music_view, gboolean from_start)
|
||||
{
|
||||
int play_mode;
|
||||
char *song_filename, *temp_str;
|
||||
NautilusFile *file;
|
||||
|
||||
char *song_filename, *temp_str, *song_uri;
|
||||
GnomeVFSResult result;
|
||||
GnomeVFSFileInfo file_info;
|
||||
|
||||
play_mode = get_play_status();
|
||||
gtk_clist_select_row (GTK_CLIST(music_view->details->song_list), music_view->details->selected_index, 0);
|
||||
|
||||
song_filename = gtk_clist_get_row_data(GTK_CLIST(music_view->details->song_list),
|
||||
music_view->details->selected_index);
|
||||
|
||||
song_filename = gtk_clist_get_row_data (GTK_CLIST (music_view->details->song_list),
|
||||
music_view->details->selected_index);
|
||||
if (song_filename == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* set up the current bitrate and file size so we can give progress feedback */
|
||||
|
||||
gtk_clist_get_text (GTK_CLIST(music_view->details->song_list), music_view->details->selected_index, 4, &temp_str);
|
||||
music_view->details->current_bitrate = atoi(temp_str);
|
||||
gtk_clist_get_text (GTK_CLIST(music_view->details->song_list),
|
||||
music_view->details->selected_index, 4, &temp_str);
|
||||
music_view->details->current_bitrate = atoi (temp_str);
|
||||
song_uri = nautilus_get_uri_from_local_path (song_filename);
|
||||
result = gnome_vfs_get_file_info (song_uri, &file_info,
|
||||
GNOME_VFS_FILE_INFO_DEFAULT, NULL);
|
||||
g_free (song_uri);
|
||||
music_view->details->current_file_size =
|
||||
(result == GNOME_VFS_OK
|
||||
&& (file_info.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) != 0)
|
||||
? file_info.size
|
||||
: 0; /* FIXME: Is 0 OK for the failure case here? */
|
||||
|
||||
file = nautilus_file_get (song_filename + 7);
|
||||
music_view->details->current_file_size = (int) nautilus_file_get_size (file);
|
||||
nautilus_file_unref(file);
|
||||
|
||||
gtk_widget_set_sensitive(music_view->details->playtime_bar, TRUE);
|
||||
gtk_widget_set_sensitive (music_view->details->playtime_bar, TRUE);
|
||||
|
||||
if (music_view->details->status_timeout != -1)
|
||||
gtk_timeout_remove(music_view->details->status_timeout);
|
||||
|
||||
music_view->details->status_timeout = gtk_timeout_add(900, (GtkFunction) play_status_display, music_view);
|
||||
|
||||
/* FIXME: +7 does not make a URI into a path. */
|
||||
start_playing_file(song_filename + 7, from_start || (play_mode != STATUS_PAUSE));
|
||||
}
|
||||
|
||||
|
@ -1268,25 +1275,26 @@ nautilus_music_view_update_from_uri (NautilusMusicView *music_view, const char *
|
|||
current_file_info = gnome_vfs_directory_list_first (list);
|
||||
while (current_file_info != NULL) {
|
||||
/* skip invisible files, for now */
|
||||
|
||||
if (current_file_info->name[0] == '.') {
|
||||
current_file_info = gnome_vfs_directory_list_next(list);
|
||||
continue;
|
||||
}
|
||||
|
||||
path_uri = nautilus_make_path(uri, current_file_info->name);
|
||||
/* FIXME: This won't work for file names with special characters.
|
||||
* The file name needs to be escaped.
|
||||
*/
|
||||
path_uri = nautilus_make_path (uri, current_file_info->name);
|
||||
|
||||
/* fetch info and queue it if it's an mp3 file */
|
||||
info = fetch_song_info (path_uri, file_index);
|
||||
info = fetch_song_info (path_uri, current_file_info, file_index);
|
||||
if (info) {
|
||||
|
||||
info->path_uri = path_uri;
|
||||
file_index += 1;
|
||||
song_list = g_list_append (song_list, info);
|
||||
} else {
|
||||
/* it's not an mp3 file, so see if it's an image */
|
||||
NautilusFile *file = nautilus_file_get (path_uri + 7);
|
||||
char *mime_type = nautilus_file_get_mime_type (file);
|
||||
const char *mime_type = gnome_vfs_file_info_get_mime_type
|
||||
(current_file_info);
|
||||
|
||||
if (nautilus_str_has_prefix (mime_type, "image/")) {
|
||||
/* for now, just keep the first image */
|
||||
|
@ -1294,10 +1302,8 @@ nautilus_music_view_update_from_uri (NautilusMusicView *music_view, const char *
|
|||
image_path_uri = g_strdup (path_uri);
|
||||
}
|
||||
}
|
||||
|
||||
nautilus_file_unref (file);
|
||||
|
||||
g_free (path_uri);
|
||||
g_free (mime_type);
|
||||
}
|
||||
|
||||
current_file_info = gnome_vfs_directory_list_next(list);
|
||||
|
@ -1311,7 +1317,7 @@ nautilus_music_view_update_from_uri (NautilusMusicView *music_view, const char *
|
|||
gtk_clist_clear (GTK_CLIST (music_view->details->song_list));
|
||||
|
||||
for (p = song_list; p != NULL; p = p->next) {
|
||||
info = (SongInfo *)p->data;
|
||||
info = (SongInfo *) p->data;
|
||||
|
||||
clist_entry[0] = malloc(4);
|
||||
if (info->track_number > 0)
|
||||
|
@ -1335,8 +1341,8 @@ nautilus_music_view_update_from_uri (NautilusMusicView *music_view, const char *
|
|||
clist_entry[3] = g_strdup(info->year);
|
||||
if (info->bitrate > 0)
|
||||
clist_entry[4] = g_strdup_printf("%d ", info->bitrate);
|
||||
if (info->path_uri)
|
||||
clist_entry[5] = format_play_time(info->path_uri, info->bitrate);
|
||||
if (info->track_time > 0)
|
||||
clist_entry[5] = format_play_time (info->track_time);
|
||||
if (info->album)
|
||||
clist_entry[6] = g_strdup(info->album);
|
||||
if (info->comment)
|
||||
|
@ -1352,6 +1358,7 @@ nautilus_music_view_update_from_uri (NautilusMusicView *music_view, const char *
|
|||
/* install the album cover */
|
||||
|
||||
if (image_path_uri != NULL) {
|
||||
/* FIXME: +7 does not make a URI into a path. */
|
||||
pixbuf = gdk_pixbuf_new_from_file(image_path_uri + 7);
|
||||
pixbuf = nautilus_gdk_pixbuf_scale_to_fit(pixbuf, 128, 128);
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ libnautilus_extensions_la_SOURCES = \
|
|||
nautilus-program-choosing.c \
|
||||
nautilus-radio-button-group.c \
|
||||
nautilus-self-checks.c \
|
||||
nautilus-stock-dialogs.c \
|
||||
nautilus-string-list.c \
|
||||
nautilus-string-picker.c \
|
||||
nautilus-string.c \
|
||||
|
@ -161,6 +162,7 @@ noinst_HEADERS = \
|
|||
nautilus-program-choosing.h \
|
||||
nautilus-radio-button-group.h \
|
||||
nautilus-self-checks.h \
|
||||
nautilus-stock-dialogs.h \
|
||||
nautilus-string-list.h \
|
||||
nautilus-string-picker.h \
|
||||
nautilus-string.h \
|
||||
|
|
|
@ -34,31 +34,25 @@
|
|||
#include "nautilus-gdk-extensions.h"
|
||||
#include "nautilus-gtk-macros.h"
|
||||
|
||||
static void nautilus_background_canvas_group_initialize_class (gpointer klass);
|
||||
static void nautilus_background_canvas_group_initialize (gpointer object, gpointer klass);
|
||||
static void nautilus_background_canvas_group_destroy (GtkObject *object);
|
||||
static void nautilus_background_canvas_group_finalize (GtkObject *object);
|
||||
static void nautilus_background_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
int x, int y, int width, int height);
|
||||
static void nautilus_background_canvas_group_render (GnomeCanvasItem *item, GnomeCanvasBuf *buffer);
|
||||
|
||||
static void nautilus_background_canvas_group_initialize_class (gpointer klass);
|
||||
static void nautilus_background_canvas_group_initialize (gpointer object,
|
||||
gpointer klass);
|
||||
static void nautilus_background_canvas_group_draw (GnomeCanvasItem *item,
|
||||
GdkDrawable *drawable,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
static void nautilus_background_canvas_group_render (GnomeCanvasItem *item,
|
||||
GnomeCanvasBuf *buffer);
|
||||
|
||||
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusBackgroundCanvasGroup, nautilus_background_canvas_group, GNOME_TYPE_CANVAS_GROUP)
|
||||
|
||||
static void
|
||||
nautilus_background_canvas_group_initialize_class (gpointer klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GnomeCanvasItemClass *canvas_item_class;
|
||||
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
canvas_item_class = GNOME_CANVAS_ITEM_CLASS (klass);
|
||||
|
||||
object_class->destroy = nautilus_background_canvas_group_destroy;
|
||||
object_class->finalize = nautilus_background_canvas_group_finalize;
|
||||
|
||||
canvas_item_class->draw = nautilus_background_canvas_group_draw;
|
||||
canvas_item_class->render = nautilus_background_canvas_group_render;
|
||||
GNOME_CANVAS_ITEM_CLASS (klass)->draw = nautilus_background_canvas_group_draw;
|
||||
GNOME_CANVAS_ITEM_CLASS (klass)->render = nautilus_background_canvas_group_render;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -66,45 +60,37 @@ nautilus_background_canvas_group_initialize (gpointer object, gpointer klass)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_background_canvas_group_destroy (GtkObject *object)
|
||||
{
|
||||
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_background_canvas_group_finalize (GtkObject *object)
|
||||
{
|
||||
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, finalize, (object));
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_background_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
int drawable_corner_x, int drawable_corner_y,
|
||||
int drawable_width, int drawable_height)
|
||||
{
|
||||
NautilusBackground *background;
|
||||
GdkGC *gc;
|
||||
GdkRectangle rectangle;
|
||||
|
||||
/* Draw the background. */
|
||||
background = nautilus_get_widget_background(GTK_WIDGET (item->canvas));
|
||||
|
||||
if (background != NULL && nautilus_background_is_too_complex_for_gtk_style (background)) {
|
||||
GdkGC *gc;
|
||||
GdkRectangle rectangle;
|
||||
background = nautilus_get_widget_background (GTK_WIDGET (item->canvas));
|
||||
|
||||
/* If GtkStyle handled it, then we don't want to bother doing
|
||||
* any additional work. It would be way slow to draw again.
|
||||
*/
|
||||
if (nautilus_background_is_too_complex_for_gtk_style (background)) {
|
||||
/* Create a new gc each time.
|
||||
If this is a speed problem, we can create one and keep it around,
|
||||
but it's a bit more complicated to ensure that it's always compatible
|
||||
with whatever drawable is passed in.
|
||||
*/
|
||||
* If this is a speed problem, we can create one and keep it around,
|
||||
* but it's a bit more complicated to ensure that it's always compatible
|
||||
* with whatever drawable is passed in.
|
||||
*/
|
||||
gc = gdk_gc_new (drawable);
|
||||
|
||||
/* The rectangle is the size of the entire viewed area of the canvas.
|
||||
The corner is determined by the current scroll position of the
|
||||
GtkLayout, and the size is determined by the current size of the widget.
|
||||
Since 0,0 is the corner of the drawable, we need to offset the rectangle
|
||||
so it's relative to the drawable's coordinates.
|
||||
*/
|
||||
/* The rectangle is the size of the entire viewed area
|
||||
* of the canvas. The corner is determined by the
|
||||
* current scroll position of the GtkLayout, and the
|
||||
* size is determined by the current size of the
|
||||
* widget. Since 0,0 is the corner of the drawable,
|
||||
* we need to offset the rectangle so it's relative to
|
||||
* the drawable's coordinates.
|
||||
*/
|
||||
rectangle.x = GTK_LAYOUT (item->canvas)->xoffset - drawable_corner_x;
|
||||
rectangle.y = GTK_LAYOUT (item->canvas)->yoffset - drawable_corner_y;
|
||||
rectangle.width = GTK_WIDGET (item->canvas)->allocation.width;
|
||||
|
@ -116,9 +102,9 @@ nautilus_background_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawa
|
|||
gdk_gc_unref (gc);
|
||||
}
|
||||
|
||||
/* Call through to the GnomeCanvasGroup implementation, which will draw all
|
||||
the canvas items.
|
||||
*/
|
||||
/* Call through to the GnomeCanvasGroup implementation, which
|
||||
* will draw all the canvas items.
|
||||
*/
|
||||
NAUTILUS_CALL_PARENT_CLASS (GNOME_CANVAS_ITEM_CLASS, draw,
|
||||
(item, drawable,
|
||||
drawable_corner_x, drawable_corner_y,
|
||||
|
@ -126,32 +112,40 @@ nautilus_background_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawa
|
|||
}
|
||||
|
||||
|
||||
/* draw the background for the anti-aliased canvas */
|
||||
|
||||
/* draw the background for the anti-aliased canvas case */
|
||||
static void
|
||||
nautilus_background_canvas_group_render (GnomeCanvasItem *item, GnomeCanvasBuf *buffer)
|
||||
{
|
||||
gint entire_width, entire_height;
|
||||
double left, top, bottom, right;
|
||||
NautilusBackground *background;
|
||||
double left, top, bottom, right;
|
||||
int entire_width, entire_height;
|
||||
|
||||
background = nautilus_get_widget_background(GTK_WIDGET (item->canvas));
|
||||
background = nautilus_get_widget_background (GTK_WIDGET (item->canvas));
|
||||
if (background != NULL) {
|
||||
gnome_canvas_get_scroll_region (GNOME_CANVAS(item->canvas), &left, &top, &right, &bottom);
|
||||
/* FIXME: Don't we want to draw the background for the size of the window
|
||||
* rather than the whole canvas? This won't work right for gradients, will it?
|
||||
*/
|
||||
gnome_canvas_get_scroll_region (GNOME_CANVAS(item->canvas),
|
||||
&left, &top, &right, &bottom);
|
||||
|
||||
/* FIXME: Icons can go past bounds? News to me! (Darin)
|
||||
* This slop value of 24 must die.
|
||||
*/
|
||||
entire_width = right - left + 24; /* add some slop since icons can go past bounds */
|
||||
entire_height = bottom - top + 24;
|
||||
nautilus_background_draw_aa(background, buffer, entire_width, entire_height);
|
||||
} else
|
||||
|
||||
nautilus_background_draw_aa (background, buffer, entire_width, entire_height);
|
||||
|
||||
/* FIXME: Shouldn't nautilus_background_draw_aa do these? */
|
||||
buffer->is_bg = FALSE;
|
||||
buffer->is_buf = TRUE;
|
||||
} else {
|
||||
/* FIXME: Why do we need this in this case? */
|
||||
gnome_canvas_buf_ensure_buf (buffer);
|
||||
|
||||
buffer->is_bg = FALSE;
|
||||
buffer->is_buf = TRUE;
|
||||
}
|
||||
|
||||
/* Call through to the GnomeCanvasGroup implementation, which will draw all
|
||||
the canvas items.
|
||||
*/
|
||||
NAUTILUS_CALL_PARENT_CLASS (GNOME_CANVAS_ITEM_CLASS, render ,
|
||||
(item, buffer));
|
||||
|
||||
|
||||
* the canvas items.
|
||||
*/
|
||||
NAUTILUS_CALL_PARENT_CLASS (GNOME_CANVAS_ITEM_CLASS, render, (item, buffer));
|
||||
}
|
||||
|
|
87
libnautilus-extensions/nautilus-stock-dialogs.c
Normal file
87
libnautilus-extensions/nautilus-stock-dialogs.c
Normal file
|
@ -0,0 +1,87 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
|
||||
/* nautilus-stock-dialogs.c: Various standard dialogs for Nautilus.
|
||||
|
||||
Copyright (C) 2000 Eazel, Inc.
|
||||
|
||||
The Gnome Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
Authors: Darin Adler <darin@eazel.com>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "nautilus-stock-dialogs.h"
|
||||
|
||||
struct NautilusTimedWait {
|
||||
char *wait_message;
|
||||
NautilusCancelCallback cancel_callback;
|
||||
gpointer callback_data;
|
||||
GDestroyNotify destroy_notify;
|
||||
GtkWindow *parent_window;
|
||||
};
|
||||
|
||||
NautilusTimedWait *
|
||||
nautilus_timed_wait_start (const char *wait_message,
|
||||
NautilusCancelCallback cancel_callback,
|
||||
gpointer callback_data,
|
||||
GDestroyNotify destroy_notify,
|
||||
GtkWindow *parent_window)
|
||||
{
|
||||
NautilusTimedWait *timed_wait;
|
||||
|
||||
g_return_val_if_fail (wait_message != NULL, NULL);
|
||||
g_return_val_if_fail (cancel_callback != NULL, NULL);
|
||||
g_return_val_if_fail (parent_window == NULL || GTK_IS_WINDOW (parent_window), NULL);
|
||||
|
||||
/* Create the timed wait record. */
|
||||
timed_wait = g_new (NautilusTimedWait, 1);
|
||||
timed_wait->wait_message = g_strdup (wait_message);
|
||||
timed_wait->cancel_callback = cancel_callback;
|
||||
timed_wait->callback_data = callback_data;
|
||||
timed_wait->destroy_notify = destroy_notify;
|
||||
timed_wait->parent_window = parent_window;
|
||||
if (parent_window != NULL) {
|
||||
gtk_widget_ref (GTK_WIDGET (parent_window));
|
||||
}
|
||||
|
||||
return timed_wait;
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_timed_wait_free (NautilusTimedWait *timed_wait)
|
||||
{
|
||||
/* Let the caller destroy the callback data. */
|
||||
if (timed_wait->destroy_notify != NULL) {
|
||||
(* timed_wait->destroy_notify) (timed_wait->callback_data);
|
||||
}
|
||||
|
||||
/* Now free the other stuff we were holding onto. */
|
||||
g_free (timed_wait->wait_message);
|
||||
if (timed_wait->parent_window != NULL) {
|
||||
gtk_widget_unref (GTK_WIDGET (timed_wait->parent_window));
|
||||
}
|
||||
|
||||
/* And the wait object itself. */
|
||||
g_free (timed_wait);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_timed_wait_stop (NautilusTimedWait *timed_wait)
|
||||
{
|
||||
g_return_if_fail (timed_wait != NULL);
|
||||
|
||||
nautilus_timed_wait_free (timed_wait);
|
||||
}
|
40
libnautilus-extensions/nautilus-stock-dialogs.h
Normal file
40
libnautilus-extensions/nautilus-stock-dialogs.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
|
||||
/* nautilus-stock-dialogs.h: Various standard dialogs for Nautilus.
|
||||
|
||||
Copyright (C) 2000 Eazel, Inc.
|
||||
|
||||
The Gnome Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
Authors: Darin Adler <darin@eazel.com>
|
||||
*/
|
||||
|
||||
#ifndef NAUTILUS_STOCK_DIALOGS_H
|
||||
#define NAUTILUS_STOCK_DIALOGS_H
|
||||
|
||||
#include <gtk/gtkwindow.h>
|
||||
|
||||
typedef void (* NautilusCancelCallback) (gpointer callback_data);
|
||||
typedef struct NautilusTimedWait NautilusTimedWait;
|
||||
|
||||
NautilusTimedWait *nautilus_timed_wait_start (const char *wait_message,
|
||||
NautilusCancelCallback cancel_callback,
|
||||
gpointer callback_data,
|
||||
GDestroyNotify destroy_notify,
|
||||
GtkWindow *parent_window);
|
||||
void nautilus_timed_wait_stop (NautilusTimedWait *timed_wait);
|
||||
|
||||
#endif /* NAUTILUS_STOCK_DIALOGS_H */
|
|
@ -85,6 +85,7 @@ libnautilus_extensions_la_SOURCES = \
|
|||
nautilus-program-choosing.c \
|
||||
nautilus-radio-button-group.c \
|
||||
nautilus-self-checks.c \
|
||||
nautilus-stock-dialogs.c \
|
||||
nautilus-string-list.c \
|
||||
nautilus-string-picker.c \
|
||||
nautilus-string.c \
|
||||
|
@ -161,6 +162,7 @@ noinst_HEADERS = \
|
|||
nautilus-program-choosing.h \
|
||||
nautilus-radio-button-group.h \
|
||||
nautilus-self-checks.h \
|
||||
nautilus-stock-dialogs.h \
|
||||
nautilus-string-list.h \
|
||||
nautilus-string-picker.h \
|
||||
nautilus-string.h \
|
||||
|
|
|
@ -34,31 +34,25 @@
|
|||
#include "nautilus-gdk-extensions.h"
|
||||
#include "nautilus-gtk-macros.h"
|
||||
|
||||
static void nautilus_background_canvas_group_initialize_class (gpointer klass);
|
||||
static void nautilus_background_canvas_group_initialize (gpointer object, gpointer klass);
|
||||
static void nautilus_background_canvas_group_destroy (GtkObject *object);
|
||||
static void nautilus_background_canvas_group_finalize (GtkObject *object);
|
||||
static void nautilus_background_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
int x, int y, int width, int height);
|
||||
static void nautilus_background_canvas_group_render (GnomeCanvasItem *item, GnomeCanvasBuf *buffer);
|
||||
|
||||
static void nautilus_background_canvas_group_initialize_class (gpointer klass);
|
||||
static void nautilus_background_canvas_group_initialize (gpointer object,
|
||||
gpointer klass);
|
||||
static void nautilus_background_canvas_group_draw (GnomeCanvasItem *item,
|
||||
GdkDrawable *drawable,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
static void nautilus_background_canvas_group_render (GnomeCanvasItem *item,
|
||||
GnomeCanvasBuf *buffer);
|
||||
|
||||
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusBackgroundCanvasGroup, nautilus_background_canvas_group, GNOME_TYPE_CANVAS_GROUP)
|
||||
|
||||
static void
|
||||
nautilus_background_canvas_group_initialize_class (gpointer klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GnomeCanvasItemClass *canvas_item_class;
|
||||
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
canvas_item_class = GNOME_CANVAS_ITEM_CLASS (klass);
|
||||
|
||||
object_class->destroy = nautilus_background_canvas_group_destroy;
|
||||
object_class->finalize = nautilus_background_canvas_group_finalize;
|
||||
|
||||
canvas_item_class->draw = nautilus_background_canvas_group_draw;
|
||||
canvas_item_class->render = nautilus_background_canvas_group_render;
|
||||
GNOME_CANVAS_ITEM_CLASS (klass)->draw = nautilus_background_canvas_group_draw;
|
||||
GNOME_CANVAS_ITEM_CLASS (klass)->render = nautilus_background_canvas_group_render;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -66,45 +60,37 @@ nautilus_background_canvas_group_initialize (gpointer object, gpointer klass)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_background_canvas_group_destroy (GtkObject *object)
|
||||
{
|
||||
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_background_canvas_group_finalize (GtkObject *object)
|
||||
{
|
||||
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, finalize, (object));
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_background_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
int drawable_corner_x, int drawable_corner_y,
|
||||
int drawable_width, int drawable_height)
|
||||
{
|
||||
NautilusBackground *background;
|
||||
GdkGC *gc;
|
||||
GdkRectangle rectangle;
|
||||
|
||||
/* Draw the background. */
|
||||
background = nautilus_get_widget_background(GTK_WIDGET (item->canvas));
|
||||
|
||||
if (background != NULL && nautilus_background_is_too_complex_for_gtk_style (background)) {
|
||||
GdkGC *gc;
|
||||
GdkRectangle rectangle;
|
||||
background = nautilus_get_widget_background (GTK_WIDGET (item->canvas));
|
||||
|
||||
/* If GtkStyle handled it, then we don't want to bother doing
|
||||
* any additional work. It would be way slow to draw again.
|
||||
*/
|
||||
if (nautilus_background_is_too_complex_for_gtk_style (background)) {
|
||||
/* Create a new gc each time.
|
||||
If this is a speed problem, we can create one and keep it around,
|
||||
but it's a bit more complicated to ensure that it's always compatible
|
||||
with whatever drawable is passed in.
|
||||
*/
|
||||
* If this is a speed problem, we can create one and keep it around,
|
||||
* but it's a bit more complicated to ensure that it's always compatible
|
||||
* with whatever drawable is passed in.
|
||||
*/
|
||||
gc = gdk_gc_new (drawable);
|
||||
|
||||
/* The rectangle is the size of the entire viewed area of the canvas.
|
||||
The corner is determined by the current scroll position of the
|
||||
GtkLayout, and the size is determined by the current size of the widget.
|
||||
Since 0,0 is the corner of the drawable, we need to offset the rectangle
|
||||
so it's relative to the drawable's coordinates.
|
||||
*/
|
||||
/* The rectangle is the size of the entire viewed area
|
||||
* of the canvas. The corner is determined by the
|
||||
* current scroll position of the GtkLayout, and the
|
||||
* size is determined by the current size of the
|
||||
* widget. Since 0,0 is the corner of the drawable,
|
||||
* we need to offset the rectangle so it's relative to
|
||||
* the drawable's coordinates.
|
||||
*/
|
||||
rectangle.x = GTK_LAYOUT (item->canvas)->xoffset - drawable_corner_x;
|
||||
rectangle.y = GTK_LAYOUT (item->canvas)->yoffset - drawable_corner_y;
|
||||
rectangle.width = GTK_WIDGET (item->canvas)->allocation.width;
|
||||
|
@ -116,9 +102,9 @@ nautilus_background_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawa
|
|||
gdk_gc_unref (gc);
|
||||
}
|
||||
|
||||
/* Call through to the GnomeCanvasGroup implementation, which will draw all
|
||||
the canvas items.
|
||||
*/
|
||||
/* Call through to the GnomeCanvasGroup implementation, which
|
||||
* will draw all the canvas items.
|
||||
*/
|
||||
NAUTILUS_CALL_PARENT_CLASS (GNOME_CANVAS_ITEM_CLASS, draw,
|
||||
(item, drawable,
|
||||
drawable_corner_x, drawable_corner_y,
|
||||
|
@ -126,32 +112,40 @@ nautilus_background_canvas_group_draw (GnomeCanvasItem *item, GdkDrawable *drawa
|
|||
}
|
||||
|
||||
|
||||
/* draw the background for the anti-aliased canvas */
|
||||
|
||||
/* draw the background for the anti-aliased canvas case */
|
||||
static void
|
||||
nautilus_background_canvas_group_render (GnomeCanvasItem *item, GnomeCanvasBuf *buffer)
|
||||
{
|
||||
gint entire_width, entire_height;
|
||||
double left, top, bottom, right;
|
||||
NautilusBackground *background;
|
||||
double left, top, bottom, right;
|
||||
int entire_width, entire_height;
|
||||
|
||||
background = nautilus_get_widget_background(GTK_WIDGET (item->canvas));
|
||||
background = nautilus_get_widget_background (GTK_WIDGET (item->canvas));
|
||||
if (background != NULL) {
|
||||
gnome_canvas_get_scroll_region (GNOME_CANVAS(item->canvas), &left, &top, &right, &bottom);
|
||||
/* FIXME: Don't we want to draw the background for the size of the window
|
||||
* rather than the whole canvas? This won't work right for gradients, will it?
|
||||
*/
|
||||
gnome_canvas_get_scroll_region (GNOME_CANVAS(item->canvas),
|
||||
&left, &top, &right, &bottom);
|
||||
|
||||
/* FIXME: Icons can go past bounds? News to me! (Darin)
|
||||
* This slop value of 24 must die.
|
||||
*/
|
||||
entire_width = right - left + 24; /* add some slop since icons can go past bounds */
|
||||
entire_height = bottom - top + 24;
|
||||
nautilus_background_draw_aa(background, buffer, entire_width, entire_height);
|
||||
} else
|
||||
|
||||
nautilus_background_draw_aa (background, buffer, entire_width, entire_height);
|
||||
|
||||
/* FIXME: Shouldn't nautilus_background_draw_aa do these? */
|
||||
buffer->is_bg = FALSE;
|
||||
buffer->is_buf = TRUE;
|
||||
} else {
|
||||
/* FIXME: Why do we need this in this case? */
|
||||
gnome_canvas_buf_ensure_buf (buffer);
|
||||
|
||||
buffer->is_bg = FALSE;
|
||||
buffer->is_buf = TRUE;
|
||||
}
|
||||
|
||||
/* Call through to the GnomeCanvasGroup implementation, which will draw all
|
||||
the canvas items.
|
||||
*/
|
||||
NAUTILUS_CALL_PARENT_CLASS (GNOME_CANVAS_ITEM_CLASS, render ,
|
||||
(item, buffer));
|
||||
|
||||
|
||||
* the canvas items.
|
||||
*/
|
||||
NAUTILUS_CALL_PARENT_CLASS (GNOME_CANVAS_ITEM_CLASS, render, (item, buffer));
|
||||
}
|
||||
|
|
87
libnautilus-private/nautilus-stock-dialogs.c
Normal file
87
libnautilus-private/nautilus-stock-dialogs.c
Normal file
|
@ -0,0 +1,87 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
|
||||
/* nautilus-stock-dialogs.c: Various standard dialogs for Nautilus.
|
||||
|
||||
Copyright (C) 2000 Eazel, Inc.
|
||||
|
||||
The Gnome Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
Authors: Darin Adler <darin@eazel.com>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "nautilus-stock-dialogs.h"
|
||||
|
||||
struct NautilusTimedWait {
|
||||
char *wait_message;
|
||||
NautilusCancelCallback cancel_callback;
|
||||
gpointer callback_data;
|
||||
GDestroyNotify destroy_notify;
|
||||
GtkWindow *parent_window;
|
||||
};
|
||||
|
||||
NautilusTimedWait *
|
||||
nautilus_timed_wait_start (const char *wait_message,
|
||||
NautilusCancelCallback cancel_callback,
|
||||
gpointer callback_data,
|
||||
GDestroyNotify destroy_notify,
|
||||
GtkWindow *parent_window)
|
||||
{
|
||||
NautilusTimedWait *timed_wait;
|
||||
|
||||
g_return_val_if_fail (wait_message != NULL, NULL);
|
||||
g_return_val_if_fail (cancel_callback != NULL, NULL);
|
||||
g_return_val_if_fail (parent_window == NULL || GTK_IS_WINDOW (parent_window), NULL);
|
||||
|
||||
/* Create the timed wait record. */
|
||||
timed_wait = g_new (NautilusTimedWait, 1);
|
||||
timed_wait->wait_message = g_strdup (wait_message);
|
||||
timed_wait->cancel_callback = cancel_callback;
|
||||
timed_wait->callback_data = callback_data;
|
||||
timed_wait->destroy_notify = destroy_notify;
|
||||
timed_wait->parent_window = parent_window;
|
||||
if (parent_window != NULL) {
|
||||
gtk_widget_ref (GTK_WIDGET (parent_window));
|
||||
}
|
||||
|
||||
return timed_wait;
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_timed_wait_free (NautilusTimedWait *timed_wait)
|
||||
{
|
||||
/* Let the caller destroy the callback data. */
|
||||
if (timed_wait->destroy_notify != NULL) {
|
||||
(* timed_wait->destroy_notify) (timed_wait->callback_data);
|
||||
}
|
||||
|
||||
/* Now free the other stuff we were holding onto. */
|
||||
g_free (timed_wait->wait_message);
|
||||
if (timed_wait->parent_window != NULL) {
|
||||
gtk_widget_unref (GTK_WIDGET (timed_wait->parent_window));
|
||||
}
|
||||
|
||||
/* And the wait object itself. */
|
||||
g_free (timed_wait);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_timed_wait_stop (NautilusTimedWait *timed_wait)
|
||||
{
|
||||
g_return_if_fail (timed_wait != NULL);
|
||||
|
||||
nautilus_timed_wait_free (timed_wait);
|
||||
}
|
40
libnautilus-private/nautilus-stock-dialogs.h
Normal file
40
libnautilus-private/nautilus-stock-dialogs.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
|
||||
/* nautilus-stock-dialogs.h: Various standard dialogs for Nautilus.
|
||||
|
||||
Copyright (C) 2000 Eazel, Inc.
|
||||
|
||||
The Gnome Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
Authors: Darin Adler <darin@eazel.com>
|
||||
*/
|
||||
|
||||
#ifndef NAUTILUS_STOCK_DIALOGS_H
|
||||
#define NAUTILUS_STOCK_DIALOGS_H
|
||||
|
||||
#include <gtk/gtkwindow.h>
|
||||
|
||||
typedef void (* NautilusCancelCallback) (gpointer callback_data);
|
||||
typedef struct NautilusTimedWait NautilusTimedWait;
|
||||
|
||||
NautilusTimedWait *nautilus_timed_wait_start (const char *wait_message,
|
||||
NautilusCancelCallback cancel_callback,
|
||||
gpointer callback_data,
|
||||
GDestroyNotify destroy_notify,
|
||||
GtkWindow *parent_window);
|
||||
void nautilus_timed_wait_stop (NautilusTimedWait *timed_wait);
|
||||
|
||||
#endif /* NAUTILUS_STOCK_DIALOGS_H */
|
|
@ -42,6 +42,7 @@
|
|||
#include <libnautilus-extensions/nautilus-string.h>
|
||||
#include <libnautilus-extensions/nautilus-global-preferences.h>
|
||||
#include <libnautilus-extensions/nautilus-user-level-manager.h>
|
||||
#include <libnautilus-extensions/nautilus-file-utilities.h>
|
||||
|
||||
static GtkWindow *bookmarks_window = NULL;
|
||||
|
||||
|
@ -405,23 +406,19 @@ show_bogus_bookmark_window (BookmarkHolder *holder)
|
|||
static gboolean
|
||||
uri_known_not_to_exist (const char *uri)
|
||||
{
|
||||
NautilusFile *file;
|
||||
char *path_name;
|
||||
gboolean exists;
|
||||
|
||||
/* Don't assume anything about schemes other than "file://" */
|
||||
if (!nautilus_str_has_prefix (uri, "file://")) {
|
||||
/* Convert to a path, returning FALSE if not local. */
|
||||
path_name = nautilus_get_local_path_from_uri (uri);
|
||||
if (path_name == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
file = nautilus_file_get (uri);
|
||||
|
||||
/* Couldn't make a NautilusFile, so uri must have been bogus. */
|
||||
if (file == NULL) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
nautilus_file_unref (file);
|
||||
|
||||
return FALSE;
|
||||
/* Now check if the file exists (sync. call OK because it is local). */
|
||||
exists = g_file_exists (path_name);
|
||||
g_free (path_name);
|
||||
return !exists;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <libnautilus-extensions/nautilus-string.h>
|
||||
#include <libnautilus-extensions/nautilus-global-preferences.h>
|
||||
#include <libnautilus-extensions/nautilus-user-level-manager.h>
|
||||
#include <libnautilus-extensions/nautilus-file-utilities.h>
|
||||
|
||||
static GtkWindow *bookmarks_window = NULL;
|
||||
|
||||
|
@ -405,23 +406,19 @@ show_bogus_bookmark_window (BookmarkHolder *holder)
|
|||
static gboolean
|
||||
uri_known_not_to_exist (const char *uri)
|
||||
{
|
||||
NautilusFile *file;
|
||||
char *path_name;
|
||||
gboolean exists;
|
||||
|
||||
/* Don't assume anything about schemes other than "file://" */
|
||||
if (!nautilus_str_has_prefix (uri, "file://")) {
|
||||
/* Convert to a path, returning FALSE if not local. */
|
||||
path_name = nautilus_get_local_path_from_uri (uri);
|
||||
if (path_name == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
file = nautilus_file_get (uri);
|
||||
|
||||
/* Couldn't make a NautilusFile, so uri must have been bogus. */
|
||||
if (file == NULL) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
nautilus_file_unref (file);
|
||||
|
||||
return FALSE;
|
||||
/* Now check if the file exists (sync. call OK because it is local). */
|
||||
exists = g_file_exists (path_name);
|
||||
g_free (path_name);
|
||||
return !exists;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
.deps
|
||||
.libs
|
||||
*.la
|
||||
*.lo
|
||||
Makefile
|
||||
Makefile.in
|
||||
test-nautilus-mime-actions
|
||||
|
|
Loading…
Reference in a new issue