diff options
Diffstat (limited to 'libnautilus-private')
47 files changed, 287 insertions, 1636 deletions
diff --git a/libnautilus-private/Makefile.am b/libnautilus-private/Makefile.am index f9be570d3..dc24cd409 100644 --- a/libnautilus-private/Makefile.am +++ b/libnautilus-private/Makefile.am @@ -47,8 +47,6 @@ libnautilus_private_la_SOURCES = \ nautilus-customization-data.h \ nautilus-default-file-icon.c \ nautilus-default-file-icon.h \ - nautilus-desktop-file-loader.c \ - nautilus-desktop-file-loader.h \ nautilus-directory-async.c \ nautilus-directory-background.c \ nautilus-directory-background.h \ diff --git a/libnautilus-private/nautilus-audio-player.c b/libnautilus-private/nautilus-audio-player.c index 71f924511..b59bcd2f5 100644 --- a/libnautilus-private/nautilus-audio-player.c +++ b/libnautilus-private/nautilus-audio-player.c @@ -23,14 +23,15 @@ */ #include <config.h> +#include "nautilus-audio-player.h" + +#include <esd.h> +#include <glib/gmem.h> +#include <glib/gstrfuncs.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> #include <unistd.h> -#include <esd.h> - -#include "nautilus-audio-player.h" /* BUFFER_FRAMES represents the size of the buffer in frames. */ #define BUFFER_FRAMES 4096 @@ -322,27 +323,26 @@ esdout_setup_format (ESDInfo *info, AudioFormat format, gint rate, gint nch) } #ifdef WORDS_BIGENDIAN - if (format == FORMAT_U16_LE || format == FORMAT_S16_LE) { + if (format == FORMAT_U16_LE || format == FORMAT_S16_LE) #else - if (format == FORMAT_U16_BE || format == FORMAT_S16_BE) { + if (format == FORMAT_U16_BE || format == FORMAT_S16_BE) #endif swap_16 = TRUE; - } info->esd_translate = (void*(*)())NULL; if (info->esd_format == ESD_BITS8) { - if (swap_sign == TRUE) { + if (swap_sign) { info->esd_translate = esd_stou8; } } else { - if (swap_sign == TRUE) { - if (swap_16 == TRUE) { + if (swap_sign) { + if (swap_16) { info->esd_translate = esd_utos16sw; } else { info->esd_translate = esd_utos16; } } else { - if (swap_16 == TRUE) { + if (swap_16) { info->esd_translate = esd_16sw; } } diff --git a/libnautilus-private/nautilus-audio-player.h b/libnautilus-private/nautilus-audio-player.h index ee1294b88..6c44be28f 100644 --- a/libnautilus-private/nautilus-audio-player.h +++ b/libnautilus-private/nautilus-audio-player.h @@ -22,22 +22,23 @@ Authors: Gene Z. Ragan <gzr@eazel.com> */ -#ifndef NAUTILUS_AUDIO_PLAYER__ -#define NAUTILUS_AUDIO_PLAYER__ +#ifndef NAUTILUS_AUDIO_PLAYER_H +#define NAUTILUS_AUDIO_PLAYER_H #include <config.h> #include <sys/types.h> #include <audiofile.h> #include <pthread.h> -#include <glib.h> + +#include <glib/gtypes.h> typedef struct { gboolean use_remote; - gchar *server; - gint port; - gint buffer_size; - gint prebuffer; + char *server; + int port; + int buffer_size; + int prebuffer; } ESDConfig; typedef struct { @@ -48,8 +49,7 @@ typedef struct { } NautilusAudioPlayerData; -NautilusAudioPlayerData *nautilus_audio_player_play (const char *filename); -void nautilus_audio_player_stop (NautilusAudioPlayerData *data); - +NautilusAudioPlayerData *nautilus_audio_player_play (const char *filename); +void nautilus_audio_player_stop (NautilusAudioPlayerData *data); #endif diff --git a/libnautilus-private/nautilus-bookmark.h b/libnautilus-private/nautilus-bookmark.h index 2a235cf9c..76f85d204 100644 --- a/libnautilus-private/nautilus-bookmark.h +++ b/libnautilus-private/nautilus-bookmark.h @@ -25,11 +25,8 @@ #ifndef NAUTILUS_BOOKMARK_H #define NAUTILUS_BOOKMARK_H -#include "nautilus-icon-factory.h" - #include <gtk/gtkwidget.h> -#include <gdk/gdktypes.h> -#include <gdk-pixbuf/gdk-pixbuf.h> +#include <libnautilus-private/nautilus-icon-factory.h> typedef struct NautilusBookmark NautilusBookmark; @@ -69,33 +66,32 @@ struct NautilusBookmarkClass { typedef struct NautilusBookmarkClass NautilusBookmarkClass; -GtkType nautilus_bookmark_get_type (void); -NautilusBookmark * nautilus_bookmark_new (const char *uri, - const char *name); -NautilusBookmark * nautilus_bookmark_new_with_icon (const char *uri, - const char *name, - NautilusScalableIcon *icon); -NautilusBookmark * nautilus_bookmark_copy (NautilusBookmark *bookmark); -char * nautilus_bookmark_get_name (NautilusBookmark *bookmark); -char * nautilus_bookmark_get_uri (NautilusBookmark *bookmark); -NautilusScalableIcon *nautilus_bookmark_get_icon (NautilusBookmark *bookmark); -gboolean nautilus_bookmark_set_name (NautilusBookmark *bookmark, - const char *new_name); -gboolean nautilus_bookmark_uri_known_not_to_exist (NautilusBookmark *bookmark); -int nautilus_bookmark_compare_with (gconstpointer a, - gconstpointer b); -int nautilus_bookmark_compare_uris (gconstpointer a, - gconstpointer b); +GType nautilus_bookmark_get_type (void); +NautilusBookmark * nautilus_bookmark_new (const char *uri, + const char *name); +NautilusBookmark * nautilus_bookmark_new_with_icon (const char *uri, + const char *name, + NautilusScalableIcon *icon); +NautilusBookmark * nautilus_bookmark_copy (NautilusBookmark *bookmark); +char * nautilus_bookmark_get_name (NautilusBookmark *bookmark); +char * nautilus_bookmark_get_uri (NautilusBookmark *bookmark); +NautilusScalableIcon *nautilus_bookmark_get_icon (NautilusBookmark *bookmark); +gboolean nautilus_bookmark_set_name (NautilusBookmark *bookmark, + const char *new_name); +gboolean nautilus_bookmark_uri_known_not_to_exist (NautilusBookmark *bookmark); +int nautilus_bookmark_compare_with (gconstpointer a, + gconstpointer b); +int nautilus_bookmark_compare_uris (gconstpointer a, + gconstpointer b); /* Helper functions for displaying bookmarks */ -gboolean nautilus_bookmark_get_pixmap_and_mask (NautilusBookmark *bookmark, - guint icon_size, - GdkPixmap **pixmap_return, - GdkBitmap **mask_return); -GdkPixbuf * nautilus_bookmark_get_pixbuf (NautilusBookmark *bookmark, - guint icon_size, - gboolean optimize_for_anti_aliasing); -GtkWidget * nautilus_bookmark_menu_item_new (NautilusBookmark *bookmark); - +gboolean nautilus_bookmark_get_pixmap_and_mask (NautilusBookmark *bookmark, + guint icon_size, + GdkPixmap **pixmap_return, + GdkBitmap **mask_return); +GdkPixbuf * nautilus_bookmark_get_pixbuf (NautilusBookmark *bookmark, + guint icon_size, + gboolean optimize_for_anti_aliasing); +GtkWidget * nautilus_bookmark_menu_item_new (NautilusBookmark *bookmark); #endif /* NAUTILUS_BOOKMARK_H */ diff --git a/libnautilus-private/nautilus-customization-data.h b/libnautilus-private/nautilus-customization-data.h index 6d51ad400..0f1abc212 100644 --- a/libnautilus-private/nautilus-customization-data.h +++ b/libnautilus-private/nautilus-customization-data.h @@ -30,10 +30,8 @@ #ifndef NAUTILUS_CUSTOMIZATION_DATA_H #define NAUTILUS_CUSTOMIZATION_DATA_H -#include <glib.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <gtk/gtklabel.h> -#include <gtk/gtkwidget.h> #include <libgnomevfs/gnome-vfs-types.h> #define RESET_IMAGE_NAME "reset.png" diff --git a/libnautilus-private/nautilus-desktop-file-loader.c b/libnautilus-private/nautilus-desktop-file-loader.c deleted file mode 100644 index 2cbdd8538..000000000 --- a/libnautilus-private/nautilus-desktop-file-loader.c +++ /dev/null @@ -1,1162 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */ - -/* nautilus-desktop-file-loader.c - - Copyright (C) 2001 Red Hat, Inc. - - Developers: Havoc Pennington <hp@redhat.com> - - This 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 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 this 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. - -*/ - -#include <config.h> -#include "nautilus-desktop-file-loader.h" - -#include "nautilus-program-choosing.h" -#include <eel/eel-gnome-extensions.h> -#include <eel/eel-vfs-extensions.h> -#include <errno.h> -#include <langinfo.h> -#include <libgnome/gnome-url.h> -#include <libgnomevfs/gnome-vfs-ops.h> -#include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -typedef struct NautilusDesktopFileSection NautilusDesktopFileSection; -typedef struct NautilusDesktopFileAddition NautilusDesktopFileAddition; -typedef struct NautilusDesktopFileForeachData NautilusDesktopFileForeachData; - -typedef void (* NautilusDesktopFileForeachFunc) (NautilusDesktopFile *df, - const char *name, - gpointer data); - - -struct NautilusDesktopFile { - char **lines; - - /* hash of section names, from pointer to start of name (just after - * bracket) to NautilusDesktopFileSection structs - */ - GHashTable *section_hash; - GList *addition_list; - - NautilusDesktopFileSection *main_section; -}; - -struct NautilusDesktopFileSection { - /* pointer into a line of df->lines for start of name */ - const char *name; - - /* hash of keys in the section, - * from pointer to start of key name to - * pointer to start of value, not copied - * from df->lines - */ - GHashTable *key_hash; - - /* First line in the section (not the [section name] line, - * but the one after that) - */ - char **start_line; -}; - -struct NautilusDesktopFileAddition { - NautilusDesktopFileSection *section; - char *name; - char *value; - - /* used for saving */ - gboolean saving_section; -}; - -struct NautilusDesktopFileForeachData { - NautilusDesktopFile *df; - NautilusDesktopFileForeachFunc func; - gpointer user_data; - gboolean include_localized; -}; - -char** nautilus_desktop_file_get_lines (NautilusDesktopFile *df); -void nautilus_desktop_file_foreach_section (NautilusDesktopFile *df, - NautilusDesktopFileForeachFunc func, - gpointer user_data); -void nautilus_desktop_file_foreach_key (NautilusDesktopFile *df, - const char *section, - gboolean include_localized, - NautilusDesktopFileForeachFunc func, - gpointer user_data); - -static void hash_lines (NautilusDesktopFile *df); -static NautilusDesktopFileSection* section_new (const char *name, - char **start_line); -static void section_free (NautilusDesktopFileSection *sect); -static char* section_dup_name (NautilusDesktopFileSection *sect); -static char* validated_strdup (const char *str); -static NautilusDesktopFileAddition* addition_new (NautilusDesktopFileSection *section, - const char *name, - const char *value); -static void addition_free (NautilusDesktopFileAddition *addition); - - -NautilusDesktopFile* -nautilus_desktop_file_new (void) -{ - NautilusDesktopFile *df; - - df = g_new0 (NautilusDesktopFile, 1); - - return df; -} - -GnomeVFSResult -nautilus_desktop_file_load (const char *uri, - NautilusDesktopFile **desktop_file) -{ - char *contents; - NautilusDesktopFile *df; - GnomeVFSResult result; - int file_size; - - *desktop_file = NULL; - result = eel_read_entire_file (uri, &file_size, - &contents); - if (result != GNOME_VFS_OK) { - return result; - } - - df = nautilus_desktop_file_from_string (contents); - - g_free (contents); - - *desktop_file = df; - - return GNOME_VFS_OK; -} - -NautilusDesktopFile* -nautilus_desktop_file_from_string (const char *data) -{ - NautilusDesktopFile *df; - - df = nautilus_desktop_file_new (); - - df->lines = g_strsplit (data, "\n", G_MAXINT); - - hash_lines (df); - - return df; -} - -static GnomeVFSResult -write_all (GnomeVFSHandle *handle, - gconstpointer buffer, - GnomeVFSFileSize bytes) -{ - GnomeVFSFileSize bytes_written; - GnomeVFSResult result; - - while (bytes > 0) { - result = gnome_vfs_write (handle, buffer, - bytes, &bytes_written); - if (result != GNOME_VFS_OK) { - return result; - } - bytes -= bytes_written; - } - - return GNOME_VFS_OK; -} - -GnomeVFSResult -nautilus_desktop_file_save (NautilusDesktopFile *df, - const char *uri) -{ - NautilusDesktopFileAddition *addition; - GnomeVFSHandle *handle; - GnomeVFSResult result; - char *old_val; - GList *list; - gint i; - - g_return_val_if_fail (df != NULL, FALSE); - g_return_val_if_fail (df->lines != NULL, FALSE); - - result = gnome_vfs_open (&handle, uri, GNOME_VFS_OPEN_WRITE); - if (result != GNOME_VFS_OK) { - return result; - } - - for (i = 0; df->lines[i] != NULL; i++) { - gboolean handled_line; - - handled_line = FALSE; - for (list = df->addition_list; list; list = list->next) { - addition = (NautilusDesktopFileAddition *)list->data; - - if (addition->section->start_line[0] == df->lines[i]) { - addition->saving_section = TRUE; - } - - if (addition->saving_section && df->lines[i][0] == '[') { - addition->saving_section = FALSE; - } - - if (addition->saving_section && - (strncmp (addition->name, df->lines[i], strlen (addition->name)) == 0)) { - old_val = strstr (df->lines[i], "="); - if (old_val == NULL) { - continue; - } - result = write_all (handle, - df->lines[i], - old_val + 1 - df->lines[i]); - if (result != GNOME_VFS_OK) { - gnome_vfs_close (handle); - return result; - } - result = write_all (handle, - addition->value, - strlen (addition->value)); - if (result != GNOME_VFS_OK) { - gnome_vfs_close (handle); - return result; - } - result = write_all (handle, "\n", 1); - if (result != GNOME_VFS_OK) { - gnome_vfs_close (handle); - return result; - } - - handled_line = TRUE; - } - } - if (handled_line == FALSE) { - result = write_all (handle, - df->lines[i], - strlen (df->lines[i])); - if (result != GNOME_VFS_OK) { - gnome_vfs_close (handle); - return result; - } - result = write_all (handle, "\n", 1); - if (result != GNOME_VFS_OK) { - gnome_vfs_close (handle); - return result; - } - } - } - - gnome_vfs_close (handle); - return GNOME_VFS_OK; -} - -static void -destroy_foreach (gpointer key, gpointer value, gpointer data) -{ - section_free (value); -} - - -void -nautilus_desktop_file_free (NautilusDesktopFile *df) -{ - if (df->section_hash != NULL) { - g_hash_table_foreach (df->section_hash, destroy_foreach, NULL); - g_hash_table_destroy (df->section_hash); - } - - g_list_foreach (df->addition_list, (GFunc) addition_free, NULL); - g_list_free (df->addition_list); - if (df->lines != NULL) - g_strfreev (df->lines); - - g_free (df); -} - - -char** -nautilus_desktop_file_get_lines (NautilusDesktopFile *df) -{ - return g_strdupv (df->lines); -} - -/* Custom hash functions allow us to avoid strdups */ -static gboolean -key_equal (gconstpointer v1, - gconstpointer v2) -{ - const gchar *p1 = v1; - const gchar *p2 = v2; - - /* we count '=' and ' ' as terminator - * and don't count leading/trailing spaces - */ - - while (g_ascii_isspace (*p1)) { - ++p1; - } - - while (g_ascii_isspace (*p2)) { - ++p2; - } - - while (*p1 && *p2 && - *p1 != '=' && *p2 != '=' && - !g_ascii_isspace (*p1) && !g_ascii_isspace (*p2)) { - if (*p1 != *p2) { - return FALSE; - } - - ++p1; - ++p2; - } - - if (*p1 && *p1 != '=' && !g_ascii_isspace (*p1)) { - return FALSE; - } - - if (*p2 && *p2 != '=' && !g_ascii_isspace (*p2)) { - return FALSE; - } - - return TRUE; -} - -static guint -key_hash (gconstpointer key) -{ - const char *p = key; - guint h = *p; - - /* we count '=' and ' ' as terminator - * and don't count leading/trailing spaces - */ - - while (g_ascii_isspace (*p)) { - ++p; - } - - if (h) { - for (p += 1; *p != '\0' && *p != '=' && !g_ascii_isspace (*p); p++) { - h = (h << 5) - h + *p; - } - } - - return h; -} - -static gboolean -section_equal (gconstpointer v1, - gconstpointer v2) -{ - const gchar *p1 = v1; - const gchar *p2 = v2; - - /* we count ']' as terminator */ - - while (*p1 && *p2 && - *p1 != ']' && *p2 != ']') { - if (*p1 != *p2) { - return FALSE; - } - - ++p1; - ++p2; - } - - if (*p1 && *p1 != ']') { - return FALSE; - } - - if (*p2 && *p2 != ']') { - return FALSE; - } - - return TRUE; -} - -static guint -section_hash (gconstpointer key) -{ - const char *p = key; - guint h = *p; - - /* we count ']' as terminator */ - - if (h) { - for (p += 1; *p != '\0' && *p != ']'; p++) { - h = (h << 5) - h + *p; - } - } - - return h; -} - -static void -hash_lines (NautilusDesktopFile *df) -{ - NautilusDesktopFileSection *current_sect; - const char *eq; - const char *p; - char **iter; - - if (df->section_hash == NULL) { - df->section_hash = g_hash_table_new (section_hash, section_equal); - } - - current_sect = NULL; - iter = df->lines; - - while (iter != NULL && *iter != NULL) { - p = *iter; - - while (g_ascii_isspace (*p)) { - ++p; - } - - /* blank or comment lines */ - if (*p == '\0' || *p == '#') { - goto next; - } - - if (*p == '[') { - /* Begin a section */ - ++p; - - if (*p != ']' && - strchr (p, ']') != NULL) { - current_sect = section_new (p, iter + 1); - - g_hash_table_insert (df->section_hash, - (char*) current_sect->name, - current_sect); - - if (df->main_section == NULL && - (section_equal (current_sect->name, "Desktop Entry") || - section_equal (current_sect->name, "KDE Desktop Entry"))) { - df->main_section = current_sect; - } - } - } else { - /* should be a key=value line, if not - * it's some invalid crap - */ - eq = strchr (p, '='); - if (eq == NULL) { - goto next; - } else { - if (current_sect) { - ++eq; - while (g_ascii_isspace (*eq)) { - ++eq; - } - /* could overwrite an earlier copy of - * the same key name in this section - */ - g_hash_table_insert (current_sect->key_hash, - (char*) p, (char*) eq); - } - } - } - - next: - ++iter; - } -} - -static NautilusDesktopFileSection* -section_new (const char *name, - char **start_line) -{ - NautilusDesktopFileSection *sect; - - sect = g_new (NautilusDesktopFileSection, 1); - - sect->name = name; - sect->start_line = start_line; - sect->key_hash = g_hash_table_new (key_hash, key_equal); - - return sect; -} - -static void -section_free (NautilusDesktopFileSection *sect) -{ - g_hash_table_destroy (sect->key_hash); - g_free (sect); -} - - -static NautilusDesktopFileAddition * -addition_new (NautilusDesktopFileSection *section, - const char *name, - const char *value) -{ - NautilusDesktopFileAddition *addition; - - addition = g_new (NautilusDesktopFileAddition, 1); - - addition->section = section; - addition->name = g_strdup (name); - addition->value = g_strdup (value); - - return addition; -} - -static void -addition_free (NautilusDesktopFileAddition *addition) -{ - g_free (addition->name); - g_free (addition->value); - g_free (addition); -} - -static char* -section_dup_name (NautilusDesktopFileSection *sect) -{ - const char *name_end; - - name_end = strchr (sect->name, ']'); - - g_assert (name_end); /* we were supposed to verify this on initial parse */ - - return g_strndup (sect->name, name_end - sect->name); -} - -static NautilusDesktopFileSection* -get_section (NautilusDesktopFile *df, - const char *section) -{ - if (df->section_hash == NULL) { - return NULL; - } - - if (section == NULL) { - return df->main_section; - } else { - return g_hash_table_lookup (df->section_hash, section); - } -} - -static void -section_foreach (gpointer key, gpointer value, gpointer data) -{ - NautilusDesktopFileForeachData *fd; - NautilusDesktopFileSection *sect; - char *name; - - fd = data; - sect = value; - - name = section_dup_name (sect); - - (* fd->func) (fd->df, name, fd->user_data); - - g_free (name); -} - -void -nautilus_desktop_file_foreach_section (NautilusDesktopFile *df, - NautilusDesktopFileForeachFunc func, - gpointer user_data) -{ - if (df->section_hash != NULL) { - NautilusDesktopFileForeachData fd; - - fd.df = df; - fd.func = func; - fd.user_data = user_data; - fd.include_localized = FALSE; /* not used */ - - g_hash_table_foreach (df->section_hash, section_foreach, &fd); - } -} - - -static void -key_foreach (gpointer key, gpointer value, gpointer data) -{ - NautilusDesktopFileForeachData *fd; - char *key_end; - char *name; - - fd = data; - - key_end = (char*) key; - while (*key_end && - !g_ascii_isspace (*key_end) && - *key_end != '=') { - ++key_end; - } - - name = g_strndup (key, key_end - (char*)key); - - if (fd->include_localized || - (!fd->include_localized && strchr (name, '[') == NULL)) { - (* fd->func) (fd->df, name, fd->user_data); - } - - g_free (name); -} - -void -nautilus_desktop_file_foreach_key (NautilusDesktopFile *df, - const char *section, - gboolean include_localized, - NautilusDesktopFileForeachFunc func, - gpointer user_data) -{ - NautilusDesktopFileSection *sect; - - sect = get_section (df, section); - - if (sect) { - NautilusDesktopFileForeachData fd; - - fd.df = df; - fd.func = func; - fd.user_data = user_data; - fd.include_localized = include_localized; - - g_hash_table_foreach (sect->key_hash, key_foreach, &fd); - } -} - -static const char* -get_keyval (NautilusDesktopFile *df, - const char *section, - const char *keyname) -{ - NautilusDesktopFileSection *sect; - const char *strval; - - sect = get_section (df, section); - - if (sect == NULL) { - return FALSE; - } - - strval = g_hash_table_lookup (sect->key_hash, - keyname); - - return strval; -} - -static gboolean -parse_boolean (const char *strval, - int len, - gboolean *val) -{ - if (len < 0) { - len = strlen (strval); - } - - if (*strval == '1') { - *val = TRUE; - return TRUE; - } else if (len > 3 && - strval[0] == 't' && strval[1] == 'r' && - strval[2] == 'u' && strval[3] == 'e') { - *val = TRUE; - return TRUE; - } else if (*strval == '0') { - *val = FALSE; - return TRUE; - } else if (len > 4 && - strval[0] == 'f' && strval[1] == 'a' && - strval[2] == 'l' && strval[3] == 's' && - strval[4] == 'e') { - *val = FALSE; - return TRUE; - } - - return FALSE; -} - -static gboolean -parse_number (const char *strval, - int len, - double *val) -{ - char *end; - double tmp; - - if (len < 0) { - len = strlen (strval); - } - - tmp = strtod (strval, &end); - if (strval == end) { - return FALSE; - } - - *val = tmp; - return TRUE; -} - - -static void -get_locale (char **lang, - char **lang_country) -{ - const char *uscore_pos; - const char *at_pos; - const char *dot_pos; - const char *end_pos; - const char *locale; - const char *start_lang; - const char *end_lang; - const char *end_country; - - *lang = NULL; - *lang_country = NULL; - - locale = setlocale (LC_MESSAGES, NULL); - - if (locale == NULL) { - return; - } - - /* lang_country.encoding@modifier */ - - uscore_pos = strchr (locale, '_'); - dot_pos = strchr (uscore_pos ? uscore_pos : locale, '.'); - at_pos = strchr ((dot_pos != NULL) ? dot_pos : ((uscore_pos != NULL) ? uscore_pos : locale), '@'); - end_pos = locale + strlen (locale); - - start_lang = locale; - end_lang = ((uscore_pos != NULL) ? uscore_pos : - ((dot_pos != NULL) ? dot_pos : - ((at_pos != NULL) ? at_pos : end_pos))); - end_country = ((dot_pos != NULL) ? dot_pos : - ((at_pos != NULL) ? at_pos : end_pos)); - - if (uscore_pos == NULL) { - *lang = g_strndup (start_lang, end_lang - start_lang); - } else { - *lang = g_strndup (start_lang, end_lang - start_lang); - *lang_country = g_strndup (start_lang, - end_country - start_lang); - } -} - -gboolean -nautilus_desktop_file_get_boolean (NautilusDesktopFile *df, - const char *section, - const char *keyname, - gboolean *val) -{ - const char *strval; - - strval = get_keyval (df, section, keyname); - - if (strval == NULL) { - return FALSE; - } - - return parse_boolean (strval, -1, val); -} - -gboolean -nautilus_desktop_file_get_number (NautilusDesktopFile *df, - const char *section, - const char *keyname, - double *val) -{ - const char *strval; - - strval = get_keyval (df, section, keyname); - - if (strval == NULL) { - return FALSE; - } - - return parse_number (strval, -1, val); -} - -/* Totally bogus UTF-8 stuff */ -gboolean -nautilus_desktop_file_get_string (NautilusDesktopFile *df, - const char *section, - const char *keyname, - char **val) -{ - const char *strval; - char *tmp; - - strval = get_keyval (df, section, keyname); - - if (strval == NULL) { - return FALSE; - } - - tmp = validated_strdup (strval); - - if (tmp != NULL) { - *val = tmp; - } - - return tmp != NULL; -} - -gboolean -nautilus_desktop_file_get_locale_string (NautilusDesktopFile *df, - const char *section, - const char *keyname, - char **val) -{ - const char *strval; - char *lang; - char *lang_country; - char *s; - - strval = NULL; - get_locale (&lang, &lang_country); - - /* FIXME - we need to try de_DE.ENCODING in addition to what - * we are trying here. - */ - - /* Try "Foo[de_DE]" */ - if (lang_country) { - s = g_strconcat (keyname, "[", lang_country, "]", NULL); - strval = get_keyval (df, section, s); - g_free (s); - if (strval != NULL) - goto done; - } - - /* Try "Foo[de]" */ - if (lang) { - s = g_strconcat (keyname, "[", lang, "]", NULL); - strval = get_keyval (df, section, s); - g_free (s); - if (strval != NULL) - goto done; - } - - /* Fall back to not localized */ - strval = get_keyval (df, section, keyname); - - done: - g_free (lang); - g_free (lang_country); - - if (strval == NULL) { - return FALSE; - } else { - char *tmp = validated_strdup (strval); - - if (tmp != NULL) { - *val = tmp; - } - return tmp != NULL; - } -} - -gboolean -nautilus_desktop_file_get_regexp (NautilusDesktopFile *df, - const char *section, - const char *keyname, - char **val) -{ - return nautilus_desktop_file_get_string (df, section, keyname, val); -} - -/* This is extremely broken */ - -#define F 0 /* character never appears in text */ -#define T 1 /* character appears in plain ASCII text */ -#define I 2 /* character appears in ISO-8859 text */ -#define X 3 /* character appears in non-ISO extended ASCII (Mac, IBM PC) */ - -static char text_chars[256] = { - /* BEL BS HT LF FF CR */ - F, F, F, F, F, F, F, T, T, T, T, F, T, T, F, F, /* 0x0X */ - /* ESC */ - F, F, F, F, F, F, F, F, F, F, F, T, F, F, F, F, /* 0x1X */ - T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x2X */ - T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x3X */ - T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x4X */ - T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x5X */ - T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x6X */ - T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, F, /* 0x7X */ - /* NEL */ - X, X, X, X, X, T, X, X, X, X, X, X, X, X, X, X, /* 0x8X */ - X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 0x9X */ - I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xaX */ - I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xbX */ - I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xcX */ - I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xdX */ - I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xeX */ - I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I /* 0xfX */ -}; - -static int -looks_utf8 (const unsigned char *buf, - int nbytes, - unsigned long *ubuf, - int *ulen) -{ - int i, n; - unsigned long c; - int gotone = 0; - - *ulen = 0; - - for (i = 0; i < nbytes; i++) { - if ((buf[i] & 0x80) == 0) { /* 0xxxxxxx is plain ASCII */ - /* - * Even if the whole file is valid UTF-8 sequences, - * still reject it if it uses weird control characters. - */ - if (text_chars[buf[i]] != T) { - return 0; - } - - if (ubuf != NULL) { - ubuf[(*ulen)++] = buf[i]; - } - } else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */ - - return 0; - } else { /* 11xxxxxx begins UTF-8 */ - int following; - - if ((buf[i] & 0x20) == 0) { /* 110xxxxx */ - c = buf[i] & 0x1f; - following = 1; - } else if ((buf[i] & 0x10) == 0) { /* 1110xxxx */ - c = buf[i] & 0x0f; - following = 2; - } else if ((buf[i] & 0x08) == 0) { /* 11110xxx */ - c = buf[i] & 0x07; - following = 3; - } else if ((buf[i] & 0x04) == 0) { /* 111110xx */ - c = buf[i] & 0x03; - following = 4; - } else if ((buf[i] & 0x02) == 0) { /* 1111110x */ - c = buf[i] & 0x01; - following = 5; - } else { - return 0; - } - - for (n = 0; n < following; n++) { - i++; - if (i >= nbytes) { - goto done; - } - - if ((buf[i] & 0x80) == 0 || (buf[i] & 0x40)) { - return 0; - } - - c = (c << 6) + (buf[i] & 0x3f); - } - - if (ubuf != NULL) { - ubuf[(*ulen)++] = c; - } - gotone = 1; - } - } - done: - return gotone; /* don't claim it's UTF-8 if it's all 7-bit */ -} - -G_LOCK_DEFINE_STATIC (init_validate); - -static char* -validated_strdup (const char *str) -{ - static gchar *locale; - static gboolean initialized = FALSE; - gchar *pout, *pin, *buf; - gint len, ulen = 0, ib, ob; - GIConv fd; - - G_LOCK (init_validate); - if (!initialized) { - /* whee, we are totally unportable (broken too) */ - setlocale (LC_CTYPE, ""); - locale = nl_langinfo (CODESET); - initialized = TRUE; - } - G_UNLOCK (init_validate); - - buf = NULL; - - len = strlen (str); - if (looks_utf8 (str, len, NULL, &ulen)) { - if ((fd = g_iconv_open (locale, "UTF-8")) != (GIConv)-1) { - ib = len; - ob = ib * 3; - pout = buf = g_new0 (gchar, ob); - pin = (char*) str; - - /* not portable either */ - - if (g_iconv (fd, &pin, &ib, &pout, &ob) == (size_t)-1) { - g_free (buf); - buf = NULL; - } - - g_iconv_close (fd); - } - } else { - buf = g_strdup (str); - } - - return buf; -} - -static char* -nautilus_desktop_file_sub_formats (NautilusDesktopFile *df, - const char *src) -{ - GString *new; - const char *p; - const char *end; - char *retval; - - new = g_string_new (""); - - p = src; - end = src; - - p = strchr (p, '%'); - while (p) { - if (p != end) { - /* Append what we just scanned over */ - g_string_append_len (new, end, p - end); - } - - end = p; - - ++p; /* past the % */ - switch (*p) { - case 'f': - case 'F': - case 'u': - case 'U': - case 'd': - case 'D': - case 'n': - case 'N': - case 'i': - case 'm': - case 'c': - case 'k': - case 'v': - /* We don't actually sub anything for now */ - ++p; - break; - case '%': - /* Escaped % */ - g_string_append (new, "%"); - ++p; - break; - default: - /* some broken .desktop-spec-incompliant crack; - * try just skipping it. - */ - ++p; - break; - } - - p = strchr (p, '%'); - } - - g_string_append (new, end); - - retval = new->str; - g_string_free (new, FALSE); - return retval; -} - -void -nautilus_desktop_file_launch (NautilusDesktopFile *df) -{ - char *type; - char *url; - char *exec; - char *subst; - char *name; - - if (!nautilus_desktop_file_get_string (df, NULL, "Type", &type)) { - return; - } - - if (strcmp (type, "Link") == 0) { - url = NULL; - nautilus_desktop_file_get_string (df, NULL, "URL", &url); - - if (url != NULL) { - gnome_url_show (url, NULL); - } - - g_free (url); - } else if (strcmp (type, "Application") == 0) { - exec = NULL; - nautilus_desktop_file_get_string (df, NULL, "Exec", &exec); - - if (exec != NULL) { - gboolean in_terminal; - - subst = nautilus_desktop_file_sub_formats (df, exec); - - in_terminal = FALSE; - nautilus_desktop_file_get_boolean (df, NULL, "Terminal", &in_terminal); - nautilus_desktop_file_get_locale_string (df, NULL, "Name", &name); - - nautilus_launch_application_from_command (name, - subst, - NULL, - in_terminal); - g_free (name); - g_free (subst); - } - - g_free (exec); - } - - g_free (type); -} - - -gboolean -nautilus_desktop_file_set_string (NautilusDesktopFile *df, - const char *section, - const char *keyname, - const char *value) -{ - NautilusDesktopFileSection *sect; - NautilusDesktopFileAddition *addition; - - sect = get_section (df, section); - if (sect == NULL) { - return FALSE; - } - - addition = addition_new (sect, keyname, value); - df->addition_list = g_list_append (df->addition_list, addition); - - return TRUE; -} diff --git a/libnautilus-private/nautilus-desktop-file-loader.h b/libnautilus-private/nautilus-desktop-file-loader.h deleted file mode 100644 index 897a25eeb..000000000 --- a/libnautilus-private/nautilus-desktop-file-loader.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */ - -/* eel-desktop-file-loader.h - - Copyright (C) 2001 Red Hat, Inc. - - Developers: Havoc Pennington <hp@redhat.com> - Alexander Larsson <alexl@redhat.com> - - This 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 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 this 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. - -*/ - -#ifndef NAUTILUS_DESKTOP_FILE_LOADER_H -#define NAUTILUS_DESKTOP_FILE_LOADER_H - -#include <glib.h> -#include <libgnomevfs/gnome-vfs-result.h> - -typedef struct NautilusDesktopFile NautilusDesktopFile; - -/* This is a quick-hack to read and modify .desktop files. - * It has severe limitations, but does what nautilus - * needs right now. You cannot create new sections or add non-existing keys. - * - * The right way to solve this is to write a good desktop file parser - * and put it in another library for use by the panel, nautilus etc. - */ - -NautilusDesktopFile *nautilus_desktop_file_new (void); -GnomeVFSResult nautilus_desktop_file_load (const char *uri, - NautilusDesktopFile **desktop_file); -NautilusDesktopFile *nautilus_desktop_file_from_string (const char *data); -GnomeVFSResult nautilus_desktop_file_save (NautilusDesktopFile *df, - const char *uri); -void nautilus_desktop_file_free (NautilusDesktopFile *df); - -/* This is crap, it just ignores the %f etc. in the exec string, - * and has no error handling. - */ -void nautilus_desktop_file_launch (NautilusDesktopFile *df); - - -gboolean nautilus_desktop_file_get_boolean (NautilusDesktopFile *df, - const char *section, - const char *keyname, - gboolean *val); -gboolean nautilus_desktop_file_get_number (NautilusDesktopFile *df, - const char *section, - const char *keyname, - double *val); -gboolean nautilus_desktop_file_get_string (NautilusDesktopFile *df, - const char *section, - const char *keyname, - char **val); -gboolean nautilus_desktop_file_get_locale_string (NautilusDesktopFile *df, - const char *section, - const char *keyname, - char **val); -gboolean nautilus_desktop_file_get_regexp (NautilusDesktopFile *df, - const char *section, - const char *keyname, - char **val); -gboolean nautilus_desktop_file_set_string (NautilusDesktopFile *df, - const char *section, - const char *keyname, - const char *value); - - -/* Some getters and setters are missing, they should be added as needed */ - - -#endif /* NAUTILUS_DESKTOP_FILE_LOADER_H */ diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c index 161d0fd03..619f4fd73 100644 --- a/libnautilus-private/nautilus-directory-async.c +++ b/libnautilus-private/nautilus-directory-async.c @@ -24,22 +24,24 @@ #include <config.h> -#include "nautilus-metafile.h" #include "nautilus-directory-metafile.h" #include "nautilus-directory-notify.h" #include "nautilus-directory-private.h" #include "nautilus-file-attributes.h" #include "nautilus-file-private.h" -#include <eel/eel-glib-extensions.h> +#include "nautilus-file-utilities.h" #include "nautilus-global-preferences.h" #include "nautilus-link.h" +#include "nautilus-metafile.h" #include "nautilus-search-uri.h" +#include <eel/eel-glib-extensions.h> #include <eel/eel-string.h> +#include <gtk/gtkmain.h> #include <libgnomevfs/gnome-vfs-ops.h> +#include <libgnomevfs/gnome-vfs-utils.h> #include <libxml/parser.h> -#include <gtk/gtkmain.h> -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> /* turn this on to see messages about each load_directory call: */ #if 0 @@ -2785,9 +2787,9 @@ link_info_nautilus_link_read_callback (GnomeVFSResult result, /* The libxml parser requires a zero-terminated array. */ buffer = g_realloc (file_contents, bytes_read + 1); buffer[bytes_read] = '\0'; - uri = nautilus_link_get_link_uri_given_file_contents (buffer, bytes_read); - name = nautilus_link_get_link_name_given_file_contents (buffer, bytes_read); - icon = nautilus_link_get_link_icon_given_file_contents (buffer, bytes_read); + uri = nautilus_link_get_link_uri_given_file_contents (NULL, buffer, bytes_read); + name = nautilus_link_get_link_name_given_file_contents (NULL, buffer, bytes_read); + icon = nautilus_link_get_link_icon_given_file_contents (NULL, buffer, bytes_read); g_free (buffer); } diff --git a/libnautilus-private/nautilus-directory-background.h b/libnautilus-private/nautilus-directory-background.h index d168ea223..e318aed4f 100644 --- a/libnautilus-private/nautilus-directory-background.h +++ b/libnautilus-private/nautilus-directory-background.h @@ -24,16 +24,14 @@ Author: Darin Adler <darin@bentspoon.com> */ -#include <gtk/gtkwidget.h> -#include "nautilus-file.h" #include <eel/eel-background.h> -#include "libnautilus-private/nautilus-icon-container.h" - -void nautilus_connect_background_to_file_metadata (GtkWidget *widget, - NautilusFile *file); -void nautilus_connect_desktop_background_to_file_metadata (NautilusIconContainer *icon_container, - NautilusFile *file); -void nautilus_connect_background_to_file_metadata_by_uri (GtkWidget *widget, - const char *uri); -gboolean nautilus_file_background_is_set (EelBackground *background); +#include <libnautilus-private/nautilus-file.h> +#include <libnautilus-private/nautilus-icon-container.h> +void nautilus_connect_background_to_file_metadata (GtkWidget *widget, + NautilusFile *file); +void nautilus_connect_desktop_background_to_file_metadata (NautilusIconContainer *icon_container, + NautilusFile *file); +void nautilus_connect_background_to_file_metadata_by_uri (GtkWidget *widget, + const char *uri); +gboolean nautilus_file_background_is_set (EelBackground *background); diff --git a/libnautilus-private/nautilus-directory-metafile-monitor.h b/libnautilus-private/nautilus-directory-metafile-monitor.h index 795e2132f..35fa83466 100644 --- a/libnautilus-private/nautilus-directory-metafile-monitor.h +++ b/libnautilus-private/nautilus-directory-metafile-monitor.h @@ -23,10 +23,9 @@ #ifndef NAUTILUS_METAFILE_MONITOR_H #define NAUTILUS_METAFILE_MONITOR_H -#include "nautilus-metafile-server.h" - #include <bonobo/bonobo-object.h> #include <libnautilus-private/nautilus-directory.h> +#include <libnautilus-private/nautilus-metafile-server.h> #define NAUTILUS_TYPE_METAFILE_MONITOR (nautilus_metafile_monitor_get_type ()) #define NAUTILUS_METAFILE_MONITOR(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_METAFILE_MONITOR, NautilusMetafileMonitor)) diff --git a/libnautilus-private/nautilus-directory-metafile.h b/libnautilus-private/nautilus-directory-metafile.h index 2400da573..a6d860720 100644 --- a/libnautilus-private/nautilus-directory-metafile.h +++ b/libnautilus-private/nautilus-directory-metafile.h @@ -22,7 +22,7 @@ Author: Darin Adler <darin@bentspoon.com> */ -#include "nautilus-directory.h" +#include <libnautilus-private/nautilus-directory.h> /* Interface for file metadata. */ gboolean nautilus_directory_is_metadata_read (NautilusDirectory *directory); diff --git a/libnautilus-private/nautilus-directory-notify.h b/libnautilus-private/nautilus-directory-notify.h index ec5adec36..6e71c4933 100644 --- a/libnautilus-private/nautilus-directory-notify.h +++ b/libnautilus-private/nautilus-directory-notify.h @@ -22,8 +22,7 @@ Author: Darin Adler <darin@bentspoon.com> */ -#include <glib.h> -#include <gdk/gdk.h> +#include <gdk/gdktypes.h> #include <libnautilus-private/nautilus-file.h> typedef struct { diff --git a/libnautilus-private/nautilus-directory-private.h b/libnautilus-private/nautilus-directory-private.h index e80ce6634..3353ee781 100644 --- a/libnautilus-private/nautilus-directory-private.h +++ b/libnautilus-private/nautilus-directory-private.h @@ -22,19 +22,18 @@ Author: Darin Adler <darin@bentspoon.com> */ -#include "nautilus-directory-metafile-monitor.h" -#include "nautilus-directory.h" -#include "nautilus-file.h" -#include "nautilus-metafile-server.h" -#include "nautilus-monitor.h" -#include "nautilus-file-queue.h" #include <eel/eel-vfs-extensions.h> -#include <libxml/tree.h> #include <libgnomevfs/gnome-vfs-file-info.h> #include <libgnomevfs/gnome-vfs-types.h> #include <libgnomevfs/gnome-vfs-uri.h> -#include <libgnomevfs/gnome-vfs-utils.h> +#include <libnautilus-private/nautilus-directory-metafile-monitor.h> +#include <libnautilus-private/nautilus-directory.h> +#include <libnautilus-private/nautilus-file-queue.h> +#include <libnautilus-private/nautilus-file.h> +#include <libnautilus-private/nautilus-metafile-server.h> +#include <libnautilus-private/nautilus-monitor.h> #include <libnautilus/nautilus-idle-queue.h> +#include <libxml/tree.h> typedef struct LinkInfoReadState LinkInfoReadState; typedef struct TopLeftTextReadState TopLeftTextReadState; diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c index d66d945c8..9e7d7f3b0 100644 --- a/libnautilus-private/nautilus-directory.c +++ b/libnautilus-private/nautilus-directory.c @@ -41,6 +41,7 @@ #include <eel/eel-string.h> #include <gtk/gtkmain.h> #include <gtk/gtksignal.h> +#include <libgnomevfs/gnome-vfs-utils.h> enum { FILES_ADDED, diff --git a/libnautilus-private/nautilus-file-private.h b/libnautilus-private/nautilus-file-private.h index 668b7fcdc..ce072b9d9 100644 --- a/libnautilus-private/nautilus-file-private.h +++ b/libnautilus-private/nautilus-file-private.h @@ -25,9 +25,9 @@ #ifndef NAUTILUS_FILE_PRIVATE_H #define NAUTILUS_FILE_PRIVATE_H -#include "nautilus-directory.h" -#include "nautilus-file.h" -#include "nautilus-monitor.h" +#include <libnautilus-private/nautilus-directory.h> +#include <libnautilus-private/nautilus-file.h> +#include <libnautilus-private/nautilus-monitor.h> #include <eel/eel-glib-extensions.h> #define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_CHARACTERS_PER_LINE 80 diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c index 9ef482a60..c784aff01 100644 --- a/libnautilus-private/nautilus-file.c +++ b/libnautilus-private/nautilus-file.c @@ -48,6 +48,7 @@ #include <libgnome/gnome-macros.h> #include <libgnomevfs/gnome-vfs-file-info.h> #include <libgnomevfs/gnome-vfs-mime-handlers.h> +#include <libgnomevfs/gnome-vfs-utils.h> #include <libxml/parser.h> #include <pwd.h> #include <stdlib.h> diff --git a/libnautilus-private/nautilus-icon-canvas-item.h b/libnautilus-private/nautilus-icon-canvas-item.h index 1a3373e07..17f9a9d9d 100644 --- a/libnautilus-private/nautilus-icon-canvas-item.h +++ b/libnautilus-private/nautilus-icon-canvas-item.h @@ -26,8 +26,7 @@ #define NAUTILUS_ICON_CANVAS_ITEM_H #include <libgnomecanvas/gnome-canvas.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include "nautilus-icon-factory.h" +#include <libnautilus-private/nautilus-icon-factory.h> G_BEGIN_DECLS diff --git a/libnautilus-private/nautilus-icon-container.h b/libnautilus-private/nautilus-icon-container.h index 95d001eef..e8324e88f 100644 --- a/libnautilus-private/nautilus-icon-container.h +++ b/libnautilus-private/nautilus-icon-container.h @@ -27,7 +27,7 @@ #define NAUTILUS_ICON_CONTAINER_H #include <libgnomecanvas/gnome-canvas.h> -#include "nautilus-icon-factory.h" +#include <libnautilus-private/nautilus-icon-factory.h> #define NAUTILUS_ICON_CONTAINER(obj) \ GTK_CHECK_CAST (obj, nautilus_icon_container_get_type (), NautilusIconContainer) diff --git a/libnautilus-private/nautilus-icon-dnd.h b/libnautilus-private/nautilus-icon-dnd.h index 3f665a783..bab13536b 100644 --- a/libnautilus-private/nautilus-icon-dnd.h +++ b/libnautilus-private/nautilus-icon-dnd.h @@ -28,8 +28,8 @@ #ifndef NAUTILUS_ICON_DND_H #define NAUTILUS_ICON_DND_H -#include "nautilus-icon-container.h" -#include "nautilus-dnd.h" +#include <libnautilus-private/nautilus-icon-container.h> +#include <libnautilus-private/nautilus-dnd.h> /* DnD-related information. */ typedef struct { @@ -41,16 +41,16 @@ typedef struct { } NautilusIconDndInfo; -void nautilus_icon_dnd_init (NautilusIconContainer *container, - GdkBitmap *stipple); -void nautilus_icon_dnd_fini (NautilusIconContainer *container); -void nautilus_icon_dnd_begin_drag (NautilusIconContainer *container, - GdkDragAction actions, - gint button, - GdkEventMotion *event); -void nautilus_icon_dnd_end_drag (NautilusIconContainer *container); +void nautilus_icon_dnd_init (NautilusIconContainer *container, + GdkBitmap *stipple); +void nautilus_icon_dnd_fini (NautilusIconContainer *container); +void nautilus_icon_dnd_begin_drag (NautilusIconContainer *container, + GdkDragAction actions, + gint button, + GdkEventMotion *event); +void nautilus_icon_dnd_end_drag (NautilusIconContainer *container); -GList *nautilus_icon_dnd_uri_list_extract_uris (const char *uri_list); -void nautilus_icon_dnd_uri_list_free_strings (GList *list); +GList *nautilus_icon_dnd_uri_list_extract_uris (const char *uri_list); +void nautilus_icon_dnd_uri_list_free_strings (GList *list); #endif /* NAUTILUS_ICON_DND_H */ diff --git a/libnautilus-private/nautilus-icon-factory-private.h b/libnautilus-private/nautilus-icon-factory-private.h index 2cb61deb9..4e4dd7dd8 100644 --- a/libnautilus-private/nautilus-icon-factory-private.h +++ b/libnautilus-private/nautilus-icon-factory-private.h @@ -26,7 +26,7 @@ #ifndef NAUTILUS_ICON_FACTORY_PRIVATE_H #define NAUTILUS_ICON_FACTORY_PRIVATE_H -#include "nautilus-icon-factory.h" +#include <gdk-pixbuf/gdk-pixbuf.h> /* For now, images are used themselves as thumbnails when they are * below this threshold size. Later we might have to have a more @@ -34,10 +34,9 @@ */ #define SELF_THUMBNAIL_SIZE_THRESHOLD 16384 -void nautilus_icon_factory_remove_by_uri (const char *uri); +void nautilus_icon_factory_remove_by_uri (const char *uri); -/* Convenience routine to return the appropriate thumbnail frame - */ -GdkPixbuf * nautilus_icon_factory_get_thumbnail_frame (void); +/* Convenience routine to return the appropriate thumbnail frame. */ +GdkPixbuf *nautilus_icon_factory_get_thumbnail_frame (void); #endif /* NAUTILUS_ICON_FACTORY_PRIVATE_H */ diff --git a/libnautilus-private/nautilus-icon-factory.c b/libnautilus-private/nautilus-icon-factory.c index a083184b5..cf736f56a 100644 --- a/libnautilus-private/nautilus-icon-factory.c +++ b/libnautilus-private/nautilus-icon-factory.c @@ -56,6 +56,7 @@ #include <libgnomevfs/gnome-vfs-mime-monitor.h> #include <libgnomevfs/gnome-vfs-ops.h> #include <libgnomevfs/gnome-vfs-types.h> +#include <libgnomevfs/gnome-vfs-utils.h> #include <librsvg/rsvg.h> #include <stdio.h> #include <string.h> diff --git a/libnautilus-private/nautilus-icon-private.h b/libnautilus-private/nautilus-icon-private.h index 32838c502..ad4e44f28 100644 --- a/libnautilus-private/nautilus-icon-private.h +++ b/libnautilus-private/nautilus-icon-private.h @@ -25,13 +25,12 @@ #ifndef NAUTILUS_ICON_CONTAINER_PRIVATE_H #define NAUTILUS_ICON_CONTAINER_PRIVATE_H -#include "nautilus-entry.h" #include <eel/eel-glib-extensions.h> #include <libgnomeui/gnome-icon-item.h> -#include "nautilus-icon-container.h" -#include "nautilus-icon-dnd.h" -#include "nautilus-icon-factory.h" -#include "nautilus-icon-canvas-item.h" +#include <libnautilus-private/nautilus-icon-canvas-item.h> +#include <libnautilus-private/nautilus-icon-container.h> +#include <libnautilus-private/nautilus-icon-dnd.h> +#include <libnautilus-private/nautilus-icon-factory.h> /* An Icon. */ diff --git a/libnautilus-private/nautilus-link-desktop-file.c b/libnautilus-private/nautilus-link-desktop-file.c index d803573c4..0f4740912 100644 --- a/libnautilus-private/nautilus-link-desktop-file.c +++ b/libnautilus-private/nautilus-link-desktop-file.c @@ -22,25 +22,25 @@ Authors: Jonathan Blandford <jrb@redhat.com> Alexander Larsson <alexl@redhat.com> */ + #include <config.h> -#include "nautilus-link.h" #include "nautilus-link-desktop-file.h" + #include "nautilus-directory-notify.h" #include "nautilus-directory.h" #include "nautilus-file-attributes.h" +#include "nautilus-file-utilities.h" #include "nautilus-file.h" #include "nautilus-metadata.h" -#include "nautilus-file-utilities.h" -#include "nautilus-desktop-file-loader.h" #include <eel/eel-glib-extensions.h> #include <eel/eel-gnome-extensions.h> #include <eel/eel-stock-dialogs.h> #include <eel/eel-string.h> #include <eel/eel-xml-extensions.h> -#include <libxml/parser.h> #include <libgnome/gnome-i18n.h> #include <libgnome/gnome-util.h> #include <libgnomevfs/gnome-vfs-utils.h> +#include <libxml/parser.h> #include <stdlib.h> #define NAUTILUS_LINK_GENERIC_TAG "Link" @@ -66,49 +66,30 @@ get_tag (NautilusLinkType type) } } -static gchar * +static char * slurp_key_string (const char *path, const char *keyname, gboolean localize) { - NautilusDesktopFile *desktop_file = NULL; - gchar *text; - gboolean set; - GnomeVFSResult result; - gchar *uri; + GnomeDesktopItem *desktop_file; + const char *text; + char *result; - uri = gnome_vfs_get_uri_from_local_path (path); - if (uri == NULL) { - return NULL; - } - - result = nautilus_desktop_file_load (uri, &desktop_file); - - g_free (uri); - - if (result != GNOME_VFS_OK) { + desktop_file = gnome_desktop_item_new_from_file (path, 0, NULL); + if (desktop_file == NULL) { return NULL; } if (localize) { - set = nautilus_desktop_file_get_locale_string (desktop_file, - "Desktop Entry", - keyname, - &text); + text = gnome_desktop_item_get_localestring (desktop_file, keyname); } else { - set = nautilus_desktop_file_get_string (desktop_file, - "Desktop Entry", - keyname, - &text); + text = gnome_desktop_item_get_string (desktop_file, keyname); } - nautilus_desktop_file_free (desktop_file); - - if (set == FALSE) { - return NULL; - } + result = g_strdup (text); + gnome_desktop_item_unref (desktop_file); - return text; + return result; } gboolean @@ -119,7 +100,7 @@ nautilus_link_desktop_file_local_create (const char *directory_path, const GdkPoint *point, NautilusLinkType type) { - gchar *path; + char *path; FILE *file; char *uri; GList dummy_list; @@ -182,34 +163,19 @@ gboolean nautilus_link_desktop_file_local_set_icon (const char *path, const char *icon_name) { - NautilusDesktopFile *desktop_file; - GnomeVFSResult result; - char *uri; - - uri = gnome_vfs_get_uri_from_local_path (path); - if (uri == NULL) { - return FALSE; - } - - result = nautilus_desktop_file_load (uri, &desktop_file); + GnomeDesktopItem *desktop_file; + gboolean success; - if (result != GNOME_VFS_OK) { - g_free (uri); + desktop_file = gnome_desktop_item_new_from_file (path, 0, NULL); + if (desktop_file == NULL) { return FALSE; } - nautilus_desktop_file_set_string (desktop_file, "Desktop Entry", "X-Nautilus-Icon", icon_name); - - result = nautilus_desktop_file_save (desktop_file, uri); - nautilus_desktop_file_free (desktop_file); - - g_free (uri); + gnome_desktop_item_set_string (desktop_file, "X-Nautilus-Icon", icon_name); + success = gnome_desktop_item_save (desktop_file, NULL, FALSE, NULL); + gnome_desktop_item_unref (desktop_file); - if (result != GNOME_VFS_OK) { - return FALSE; - } - - return TRUE; + return success; } char * @@ -227,8 +193,8 @@ nautilus_link_desktop_file_local_get_additional_text (const char *path) */ return NULL; #ifdef THIS_IS_NOT_USED_RIGHT_NOW - gchar *type; - gchar *retval; + char *type; + char *retval; type = slurp_key_string (path, "Type", FALSE); retval = NULL; @@ -249,7 +215,7 @@ nautilus_link_desktop_file_local_get_additional_text (const char *path) NautilusLinkType nautilus_link_desktop_file_local_get_link_type (const char *path) { - gchar *type; + char *type; NautilusLinkType retval; type = slurp_key_string (path, "Type", FALSE); @@ -289,39 +255,29 @@ nautilus_link_desktop_file_local_is_trash_link (const char *path) return (nautilus_link_desktop_file_local_get_link_type (path) == NAUTILUS_LINK_TRASH); } -static gchar * -nautilus_link_desktop_file_get_link_uri_from_desktop (NautilusDesktopFile *desktop_file) +static char * +nautilus_link_desktop_file_get_link_uri_from_desktop (GnomeDesktopItem *desktop_file) { - gchar *terminal_command; - gchar *launch_string; + char *terminal_command; + const char *launch_string; gboolean need_term; - gchar *type; - gchar *retval; + const char *type; + char *retval; retval = NULL; - type = NULL; - if (! nautilus_desktop_file_get_string (desktop_file, - "Desktop Entry", - "Type", - &type)) { + type = gnome_desktop_item_get_string (desktop_file, "Type"); + if (type == NULL) { return NULL; } if (strcmp (type, "Application") == 0) { - if (! nautilus_desktop_file_get_string (desktop_file, - "Desktop Entry", - "Exec", - &launch_string)) { - g_free (type); + launch_string = gnome_desktop_item_get_string (desktop_file, "Exec"); + if (launch_string == NULL) { return NULL; } - need_term = FALSE; - nautilus_desktop_file_get_boolean (desktop_file, - "Desktop Entry", - "Terminal", - &need_term); + need_term = gnome_desktop_item_get_boolean (desktop_file, "Terminal"); if (need_term) { terminal_command = eel_gnome_make_terminal_command (launch_string); retval = g_strconcat ("command:", terminal_command, NULL); @@ -329,165 +285,124 @@ nautilus_link_desktop_file_get_link_uri_from_desktop (NautilusDesktopFile *deskt } else { retval = g_strconcat ("command:", launch_string, NULL); } - g_free (launch_string); } else if (strcmp (type, "URL") == 0) { /* Some old broken desktop files use this nonstandard feature, we need handle it though */ - nautilus_desktop_file_get_string (desktop_file, - "Desktop Entry", - "Exec", - &retval); + retval = g_strdup (gnome_desktop_item_get_string (desktop_file, "Exec")); } else if ((strcmp (type, NAUTILUS_LINK_GENERIC_TAG) == 0) || (strcmp (type, NAUTILUS_LINK_MOUNT_TAG) == 0) || (strcmp (type, NAUTILUS_LINK_TRASH_TAG) == 0) || (strcmp (type, NAUTILUS_LINK_HOME_TAG) == 0)) { - nautilus_desktop_file_get_string (desktop_file, - "Desktop Entry", - "URL", - &retval); + retval = g_strdup (gnome_desktop_item_get_string (desktop_file, "URL")); } - g_free (type); return retval; } -static gchar * -nautilus_link_desktop_file_get_link_name_from_desktop (NautilusDesktopFile *desktop_file) +static char * +nautilus_link_desktop_file_get_link_name_from_desktop (GnomeDesktopItem *desktop_file) { - gchar *name; - - name = NULL; - - if (nautilus_desktop_file_get_locale_string (desktop_file, - "Desktop Entry", - "Name", - &name)) { - return name; - } else { - return NULL; - } + return g_strdup (gnome_desktop_item_get_localestring (desktop_file, "Name")); } -static gchar * -nautilus_link_desktop_file_get_link_icon_from_desktop (NautilusDesktopFile *desktop_file) +static char * +nautilus_link_desktop_file_get_link_icon_from_desktop (GnomeDesktopItem *desktop_file) { char *icon_uri; - gchar *absolute; - gchar *icon_name; + char *absolute; + char *icon_name; - if (nautilus_desktop_file_get_string (desktop_file, "Desktop Entry", "X-Nautilus-Icon", &icon_uri)) { + icon_uri = g_strdup (gnome_desktop_item_get_string (desktop_file, "X-Nautilus-Icon")); + if (icon_uri != NULL) { return icon_uri; } /* Fall back to a standard icon. */ - if (nautilus_desktop_file_get_string (desktop_file, "Desktop Entry", "Icon", &icon_name)) { - if (icon_name == NULL) { - return NULL; - } + icon_name = g_strdup (gnome_desktop_item_get_string (desktop_file, "Icon")); + if (icon_name == NULL) { + return NULL; + } - absolute = gnome_program_locate_file ( - NULL, GNOME_FILE_DOMAIN_PIXMAP, icon_name, TRUE, NULL); - if (absolute != NULL) { - g_free (icon_name); - icon_name = absolute; - } - if (icon_name[0] == '/') { - icon_uri = gnome_vfs_get_uri_from_local_path (icon_name); - } else { - icon_uri = NULL; - } + absolute = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, icon_name, TRUE, NULL); + if (absolute != NULL) { g_free (icon_name); - - return icon_uri; + icon_name = absolute; } - return NULL; + icon_uri = gnome_vfs_get_uri_from_local_path (icon_name); + g_free (icon_name); + + return icon_uri; } char * nautilus_link_desktop_file_local_get_link_uri (const char *path) { - NautilusDesktopFile *desktop_file = NULL; - gchar *retval; - GnomeVFSResult result; - char *uri; + GnomeDesktopItem *desktop_file; + char *retval; - uri = gnome_vfs_get_uri_from_local_path (path); - if (uri == NULL) { - return FALSE; - } - - result = nautilus_desktop_file_load (uri, &desktop_file); - - g_free (uri); - - if (result != GNOME_VFS_OK) { + desktop_file = gnome_desktop_item_new_from_file (path, 0, NULL); + if (desktop_file == NULL) { return NULL; } retval = nautilus_link_desktop_file_get_link_uri_from_desktop (desktop_file); - - nautilus_desktop_file_free (desktop_file); + gnome_desktop_item_unref (desktop_file); + return retval; } char * -nautilus_link_desktop_file_get_link_uri_given_file_contents (const char *link_file_contents, +nautilus_link_desktop_file_get_link_uri_given_file_contents (const char *uri, + const char *link_file_contents, int link_file_size) { - NautilusDesktopFile *desktop_file; - gchar *slurp; - gchar *retval; + GnomeDesktopItem *desktop_file; + char *retval; - slurp = g_strndup (link_file_contents, link_file_size); - desktop_file = nautilus_desktop_file_from_string (slurp); - g_free (slurp); + desktop_file = gnome_desktop_item_new_from_string (uri, link_file_contents, link_file_size, 0, NULL); if (desktop_file == NULL) { return NULL; } retval = nautilus_link_desktop_file_get_link_uri_from_desktop (desktop_file); - nautilus_desktop_file_free (desktop_file); + gnome_desktop_item_unref (desktop_file); return retval; } char * -nautilus_link_desktop_file_get_link_name_given_file_contents (const char *link_file_contents, +nautilus_link_desktop_file_get_link_name_given_file_contents (const char *uri, + const char *link_file_contents, int link_file_size) { - NautilusDesktopFile *desktop_file; - gchar *slurp; - gchar *retval; + GnomeDesktopItem *desktop_file; + char *retval; - slurp = g_strndup (link_file_contents, link_file_size); - desktop_file = nautilus_desktop_file_from_string (slurp); - g_free (slurp); + desktop_file = gnome_desktop_item_new_from_string (uri, link_file_contents, link_file_size, 0, NULL); if (desktop_file == NULL) { return NULL; } retval = nautilus_link_desktop_file_get_link_name_from_desktop (desktop_file); - nautilus_desktop_file_free (desktop_file); + gnome_desktop_item_unref (desktop_file); return retval; } char * -nautilus_link_desktop_file_get_link_icon_given_file_contents (const char *link_file_contents, +nautilus_link_desktop_file_get_link_icon_given_file_contents (const char *uri, + const char *link_file_contents, int link_file_size) { - NautilusDesktopFile *desktop_file; - gchar *slurp; - gchar *retval; + GnomeDesktopItem *desktop_file; + char *retval; - slurp = g_strndup (link_file_contents, link_file_size); - desktop_file = nautilus_desktop_file_from_string (slurp); - g_free (slurp); + desktop_file = gnome_desktop_item_new_from_string (uri, link_file_contents, link_file_size, 0, NULL); if (desktop_file == NULL) { return NULL; } retval = nautilus_link_desktop_file_get_link_icon_from_desktop (desktop_file); - nautilus_desktop_file_free (desktop_file); + gnome_desktop_item_unref (desktop_file); return retval; } diff --git a/libnautilus-private/nautilus-link-desktop-file.h b/libnautilus-private/nautilus-link-desktop-file.h index a36f55b1d..1e418dd3a 100644 --- a/libnautilus-private/nautilus-link-desktop-file.h +++ b/libnautilus-private/nautilus-link-desktop-file.h @@ -25,34 +25,34 @@ #ifndef NAUTILUS_LINK_DESKTOP_FILE_H #define NAUTILUS_LINK_DESKTOP_FILE_H -#include "nautilus-file.h" -#include <gdk/gdk.h> -#include <libgnome/gnome-desktop-item.h> - -gboolean nautilus_link_desktop_file_local_create (const char *directory_path, - const char *name, - const char *image, - const char *target_uri, - const GdkPoint *point, - NautilusLinkType type); -gboolean nautilus_link_desktop_file_local_set_icon (const char *path, - const char *icon_name); -char * nautilus_link_desktop_file_local_get_text (const char *path); -char * nautilus_link_desktop_file_local_get_additional_text (const char *path); -NautilusLinkType nautilus_link_desktop_file_local_get_link_type (const char *path); -gboolean nautilus_link_desktop_file_local_is_volume_link (const char *path); -gboolean nautilus_link_desktop_file_local_is_home_link (const char *path); -gboolean nautilus_link_desktop_file_local_is_trash_link (const char *path); -char * nautilus_link_desktop_file_local_get_link_uri (const char *path); -char * nautilus_link_desktop_file_get_link_uri_given_file_contents (const char *link_file_contents, - int link_file_size); -char * nautilus_link_desktop_file_get_link_name_given_file_contents (const char *link_file_contents, - int link_file_size); -char * nautilus_link_desktop_file_get_link_icon_given_file_contents (const char *link_file_contents, - int link_file_size); -void nautilus_link_desktop_file_local_create_from_gnome_entry (GnomeDesktopItem *entry, - const char *dest_path, - const GdkPoint *position); +#include <libnautilus-private/nautilus-link.h> + +gboolean nautilus_link_desktop_file_local_create (const char *directory_path, + const char *name, + const char *image, + const char *target_uri, + const GdkPoint *point, + NautilusLinkType type); +gboolean nautilus_link_desktop_file_local_set_icon (const char *path, + const char *icon_name); +char * nautilus_link_desktop_file_local_get_text (const char *path); +char * nautilus_link_desktop_file_local_get_additional_text (const char *path); +NautilusLinkType nautilus_link_desktop_file_local_get_link_type (const char *path); +gboolean nautilus_link_desktop_file_local_is_volume_link (const char *path); +gboolean nautilus_link_desktop_file_local_is_home_link (const char *path); +gboolean nautilus_link_desktop_file_local_is_trash_link (const char *path); +char * nautilus_link_desktop_file_local_get_link_uri (const char *path); +char * nautilus_link_desktop_file_get_link_uri_given_file_contents (const char *uri, + const char *link_file_contents, + int link_file_size); +char * nautilus_link_desktop_file_get_link_name_given_file_contents (const char *uri, + const char *link_file_contents, + int link_file_size); +char * nautilus_link_desktop_file_get_link_icon_given_file_contents (const char *uri, + const char *link_file_contents, + int link_file_size); +void nautilus_link_desktop_file_local_create_from_gnome_entry (GnomeDesktopItem *entry, + const char *dest_path, + const GdkPoint *position); #endif /* NAUTILUS_LINK_DESKTOP_FILE_H */ - diff --git a/libnautilus-private/nautilus-link-historical.c b/libnautilus-private/nautilus-link-historical.c index 046db87c2..15ea6fb8e 100644 --- a/libnautilus-private/nautilus-link-historical.c +++ b/libnautilus-private/nautilus-link-historical.c @@ -23,7 +23,6 @@ */ #include <config.h> -#include "nautilus-link.h" #include "nautilus-link-historical.h" #include "nautilus-directory-notify.h" diff --git a/libnautilus-private/nautilus-link-historical.h b/libnautilus-private/nautilus-link-historical.h index af3cdc3f0..e46b1a9b7 100644 --- a/libnautilus-private/nautilus-link-historical.h +++ b/libnautilus-private/nautilus-link-historical.h @@ -26,9 +26,7 @@ #ifndef NAUTILUS_LINK_HISTORICAL_H #define NAUTILUS_LINK_HISTORICAL_H -#include "nautilus-file.h" -#include <gdk/gdk.h> -#include <libgnome/gnome-desktop-item.h> +#include <libnautilus-private/nautilus-link.h> gboolean nautilus_link_historical_local_create (const char *directory_path, const char *name, diff --git a/libnautilus-private/nautilus-link.c b/libnautilus-private/nautilus-link.c index 2d079637f..a243486fb 100644 --- a/libnautilus-private/nautilus-link.c +++ b/libnautilus-private/nautilus-link.c @@ -230,12 +230,13 @@ nautilus_link_local_get_link_type (const char *path) } char * -nautilus_link_get_link_uri_given_file_contents (const char *file_contents, +nautilus_link_get_link_uri_given_file_contents (const char *uri, + const char *file_contents, int file_size) { switch (get_link_style_for_data (file_contents, file_size)) { case desktop: - return nautilus_link_desktop_file_get_link_uri_given_file_contents (file_contents, file_size); + return nautilus_link_desktop_file_get_link_uri_given_file_contents (uri, file_contents, file_size); case historical: return nautilus_link_historical_get_link_uri_given_file_contents (file_contents, file_size); default: @@ -244,12 +245,13 @@ nautilus_link_get_link_uri_given_file_contents (const char *file_contents, } char * -nautilus_link_get_link_name_given_file_contents (const char *file_contents, +nautilus_link_get_link_name_given_file_contents (const char *uri, + const char *file_contents, int file_size) { switch (get_link_style_for_data (file_contents, file_size)) { case desktop: - return nautilus_link_desktop_file_get_link_name_given_file_contents (file_contents, file_size); + return nautilus_link_desktop_file_get_link_name_given_file_contents (uri, file_contents, file_size); case historical: return NULL; default: @@ -258,12 +260,13 @@ nautilus_link_get_link_name_given_file_contents (const char *file_contents, } char * -nautilus_link_get_link_icon_given_file_contents (const char *file_contents, - int file_size) +nautilus_link_get_link_icon_given_file_contents (const char *uri, + const char *file_contents, + int file_size) { switch (get_link_style_for_data (file_contents, file_size)) { case desktop: - return nautilus_link_desktop_file_get_link_icon_given_file_contents (file_contents, file_size); + return nautilus_link_desktop_file_get_link_icon_given_file_contents (uri, file_contents, file_size); case historical: return nautilus_link_historical_get_link_icon_given_file_contents (file_contents, file_size); default: diff --git a/libnautilus-private/nautilus-link.h b/libnautilus-private/nautilus-link.h index fbcf1956a..0c3d9369b 100644 --- a/libnautilus-private/nautilus-link.h +++ b/libnautilus-private/nautilus-link.h @@ -26,8 +26,7 @@ #ifndef NAUTILUS_LINK_H #define NAUTILUS_LINK_H -#include "nautilus-file.h" -#include <gdk/gdk.h> +#include <gdk/gdktypes.h> #include <libgnome/gnome-desktop-item.h> /* Link types */ @@ -41,62 +40,62 @@ typedef enum { /* Create a new link file. Takes a path, works locally, and uses sync. I/O. * Returns TRUE if it succeeds, FALSE if it fails. */ -gboolean nautilus_link_local_create (const char *directory_path, - const char *name, - const char *image, - const char *target_uri, - const GdkPoint *point, - NautilusLinkType type); +gboolean nautilus_link_local_create (const char *directory_path, + const char *name, + const char *image, + const char *target_uri, + const GdkPoint *point, + NautilusLinkType type); /* Change the icon of an existing link file. Takes a path, works * locally, and uses sync. I/O. Returns TRUE if it succeeds, FALSE if * it fails. Does not check and see if it is a link file. */ -gboolean nautilus_link_local_set_icon (const char *path, - const char *icon_name); +gboolean nautilus_link_local_set_icon (const char *path, + const char *icon_name); /* Specify the type of link that is represented * Takes a path, works locally, and uses sync. I/O. * Returns TRUE if it succeeds, FALSE if * it fails. Does not check and see if it is a link file. */ -gboolean nautilus_link_local_set_type (const char *path, - NautilusLinkType type); +gboolean nautilus_link_local_set_type (const char *path, + NautilusLinkType type); /* Specify the link uri of link that is represented * Takes a path, works locally, and uses sync. I/O. * Returns TRUE if it succeeds, FALSE if * it fails. Does not check and see if it is a link file. */ -gboolean nautilus_link_local_set_link_uri (const char *path, - const char *uri); +gboolean nautilus_link_local_set_link_uri (const char *path, + const char *uri); /* Returns additional text to display under the name, NULL if * none. Despite the fact that it takes a URI parameter, works only if * the file is local and does sync. I/O. */ -char * nautilus_link_local_get_additional_text (const char *path); +char * nautilus_link_local_get_additional_text (const char *path); /* Returns the link type of a link file. * Works only if the file is local and does sync. I/O */ -NautilusLinkType nautilus_link_local_get_link_type (const char *path); +NautilusLinkType nautilus_link_local_get_link_type (const char *path); /* Returns if a link is a mount link. * Works only if the file is local and does sync. I/O */ -gboolean nautilus_link_local_is_volume_link (const char *path); +gboolean nautilus_link_local_is_volume_link (const char *path); /* Returns if a link is a home link. * Works only if the file is local and does sync. I/O */ -gboolean nautilus_link_local_is_home_link (const char *path); +gboolean nautilus_link_local_is_home_link (const char *path); /* Returns if a link is a trash link. * Works only if the file is local and does sync. I/O */ -gboolean nautilus_link_local_is_trash_link (const char *path); +gboolean nautilus_link_local_is_trash_link (const char *path); /* Returns the link uri associated with a link file. The first version @@ -104,16 +103,18 @@ gboolean nautilus_link_local_is_trash_link (const char * fact that it takes a URI parameter. The second version takes the * contents of a file already in memory. */ -char * nautilus_link_local_get_link_uri (const char *path); -char * nautilus_link_get_link_uri_given_file_contents (const char *link_file_contents, - int link_file_size); -char * nautilus_link_get_link_name_given_file_contents (const char *file_contents, - int link_file_size); -char * nautilus_link_get_link_icon_given_file_contents (const char *file_contents, - int link_file_size); - -void nautilus_link_local_create_from_gnome_entry (GnomeDesktopItem *item, - const char *dest_path, - const GdkPoint *position); - +char * nautilus_link_local_get_link_uri (const char *path); +char * nautilus_link_get_link_uri_given_file_contents (const char *uri, + const char *link_file_contents, + int link_file_size); +char * nautilus_link_get_link_name_given_file_contents (const char *uri, + const char *file_contents, + int link_file_size); +char * nautilus_link_get_link_icon_given_file_contents (const char *uri, + const char *file_contents, + int link_file_size); +void nautilus_link_local_create_from_gnome_entry (GnomeDesktopItem *item, + const char *dest_path, + const GdkPoint *position); + #endif /* NAUTILUS_LINK_H */ diff --git a/libnautilus-private/nautilus-medusa-support.h b/libnautilus-private/nautilus-medusa-support.h index bc64e338d..048f7860e 100644 --- a/libnautilus-private/nautilus-medusa-support.h +++ b/libnautilus-private/nautilus-medusa-support.h @@ -28,7 +28,7 @@ #ifndef NAUTILUS_MEDUSA_SUPPORT_H #define NAUTILUS_MEDUSA_SUPPORT_H -#include <glib.h> +#include <glib/gtypes.h> typedef void (* NautilusMedusaChangedCallback) (gpointer data); diff --git a/libnautilus-private/nautilus-merged-directory.h b/libnautilus-private/nautilus-merged-directory.h index fd0429712..338aa4770 100644 --- a/libnautilus-private/nautilus-merged-directory.h +++ b/libnautilus-private/nautilus-merged-directory.h @@ -27,7 +27,7 @@ #ifndef NAUTILUS_MERGED_DIRECTORY_H #define NAUTILUS_MERGED_DIRECTORY_H -#include "nautilus-directory.h" +#include <libnautilus-private/nautilus-directory.h> #define NAUTILUS_TYPE_MERGED_DIRECTORY \ (nautilus_merged_directory_get_type ()) diff --git a/libnautilus-private/nautilus-metafile.c b/libnautilus-private/nautilus-metafile.c index 98e111c9d..ce5c01b56 100644 --- a/libnautilus-private/nautilus-metafile.c +++ b/libnautilus-private/nautilus-metafile.c @@ -27,6 +27,7 @@ #include "nautilus-directory.h" #include "nautilus-directory.h" #include "nautilus-file-private.h" +#include "nautilus-file-utilities.h" #include "nautilus-global-preferences.h" #include "nautilus-metadata.h" #include "nautilus-search-uri.h" diff --git a/libnautilus-private/nautilus-metafile.h b/libnautilus-private/nautilus-metafile.h index 6d16a5862..2f3ddf0a9 100644 --- a/libnautilus-private/nautilus-metafile.h +++ b/libnautilus-private/nautilus-metafile.h @@ -23,14 +23,11 @@ #ifndef NAUTILUS_METAFILE_H #define NAUTILUS_METAFILE_H -#include "nautilus-metafile-server.h" - #include <bonobo/bonobo-object.h> +#include <libnautilus-private/nautilus-directory.h> +#include <libnautilus-private/nautilus-metafile-server.h> #include <libxml/tree.h> -#include "nautilus-directory.h" -#include "nautilus-file-utilities.h" - #define NAUTILUS_TYPE_METAFILE (nautilus_metafile_get_type ()) #define NAUTILUS_METAFILE(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_METAFILE, NautilusMetafile)) #define NAUTILUS_METAFILE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_METAFILE, NautilusMetafileClass)) diff --git a/libnautilus-private/nautilus-monitor.h b/libnautilus-private/nautilus-monitor.h index dfb4b0951..df85a4901 100644 --- a/libnautilus-private/nautilus-monitor.h +++ b/libnautilus-private/nautilus-monitor.h @@ -26,7 +26,7 @@ #ifndef NAUTILUS_MONITOR_H #define NAUTILUS_MONITOR_H -#include <glib.h> +#include <glib/gtypes.h> typedef struct NautilusMonitor NautilusMonitor; diff --git a/libnautilus-private/nautilus-program-chooser.h b/libnautilus-private/nautilus-program-chooser.h index c1f7de4a0..9d0aa81c0 100644 --- a/libnautilus-private/nautilus-program-chooser.h +++ b/libnautilus-private/nautilus-program-chooser.h @@ -30,9 +30,8 @@ #include <gtk/gtkdialog.h> #include <libgnomevfs/gnome-vfs-mime-handlers.h> - -#include "nautilus-file.h" -#include "nautilus-view-identifier.h" +#include <libnautilus-private/nautilus-file.h> +#include <libnautilus-private/nautilus-view-identifier.h> #define NAUTILUS_TYPE_PROGRAM_CHOOSER (nautilus_program_chooser_get_type ()) #define NAUTILUS_PROGRAM_CHOOSER(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_PROGRAM_CHOOSER, NautilusProgramChooser)) diff --git a/libnautilus-private/nautilus-program-choosing.h b/libnautilus-private/nautilus-program-choosing.h index e3c374fc2..66efef046 100644 --- a/libnautilus-private/nautilus-program-choosing.h +++ b/libnautilus-private/nautilus-program-choosing.h @@ -26,10 +26,10 @@ #ifndef NAUTILUS_PROGRAM_CHOOSING_H #define NAUTILUS_PROGRAM_CHOOSING_H -#include "nautilus-file.h" -#include "nautilus-view-identifier.h" #include <gtk/gtkwindow.h> #include <libgnomevfs/gnome-vfs-mime-handlers.h> +#include <libnautilus-private/nautilus-file.h> +#include <libnautilus-private/nautilus-view-identifier.h> typedef void (*NautilusApplicationChoiceCallback) (GnomeVFSMimeApplication *application, gpointer callback_data); diff --git a/libnautilus-private/nautilus-search-uri.h b/libnautilus-private/nautilus-search-uri.h index 808ad17fd..6da105699 100644 --- a/libnautilus-private/nautilus-search-uri.h +++ b/libnautilus-private/nautilus-search-uri.h @@ -24,7 +24,7 @@ #ifndef NAUTILUS_SEARCH_URI_H #define NAUTILUS_SEARCH_URI_H -#include <glib.h> +#include <glib/gtypes.h> /* These strings are used programatically; they must not be translated */ #define NAUTILUS_SEARCH_URI_TEXT_NAME "file_name" diff --git a/libnautilus-private/nautilus-sidebar-functions.h b/libnautilus-private/nautilus-sidebar-functions.h index cb5a23598..df9f29b7d 100644 --- a/libnautilus-private/nautilus-sidebar-functions.h +++ b/libnautilus-private/nautilus-sidebar-functions.h @@ -25,7 +25,7 @@ #ifndef NAUTILUS_SIDEBAR_FUNCTIONS_H #define NAUTILUS_SIDEBAR_FUNCTIONS_H -#include <glib.h> +#include <glib/glist.h> extern const char nautilus_sidebar_news_enabled_preference_name[]; extern const char nautilus_sidebar_notes_enabled_preference_name[]; diff --git a/libnautilus-private/nautilus-sound.h b/libnautilus-private/nautilus-sound.h index f71694809..6318256e1 100644 --- a/libnautilus-private/nautilus-sound.h +++ b/libnautilus-private/nautilus-sound.h @@ -25,12 +25,12 @@ #ifndef NAUTILUS_SOUND_H #define NAUTILUS_SOUND_H -#include <glib.h> +#include <glib/gtypes.h> #include <sys/wait.h> -void nautilus_sound_init (void); -gboolean nautilus_sound_can_play_sound (void); -void nautilus_sound_kill_sound (void); -void nautilus_sound_register_sound (pid_t sound_process); +void nautilus_sound_init (void); +gboolean nautilus_sound_can_play_sound (void); +void nautilus_sound_kill_sound (void); +void nautilus_sound_register_sound (pid_t sound_process); #endif /* NAUTILUS_SOUND_H */ diff --git a/libnautilus-private/nautilus-theme.h b/libnautilus-private/nautilus-theme.h index 4a834bf9f..a6e338104 100644 --- a/libnautilus-private/nautilus-theme.h +++ b/libnautilus-private/nautilus-theme.h @@ -25,8 +25,6 @@ #ifndef NAUTILUS_THEME_H #define NAUTILUS_THEME_H - -#include <glib.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <libgnomevfs/gnome-vfs-types.h> diff --git a/libnautilus-private/nautilus-thumbnails.h b/libnautilus-private/nautilus-thumbnails.h index eb6d6223e..fcfa47d20 100644 --- a/libnautilus-private/nautilus-thumbnails.h +++ b/libnautilus-private/nautilus-thumbnails.h @@ -25,8 +25,8 @@ #ifndef NAUTILUS_THUMBNAILS_H #define NAUTILUS_THUMBNAILS_H -#include "nautilus-file.h" #include <gdk-pixbuf/gdk-pixbuf.h> +#include <libnautilus-private/nautilus-file.h> /* Returns NULL if there's no thumbnail yet. */ char * nautilus_get_thumbnail_uri (NautilusFile *file); diff --git a/libnautilus-private/nautilus-trash-directory.c b/libnautilus-private/nautilus-trash-directory.c index d7bd26a22..b55df834c 100644 --- a/libnautilus-private/nautilus-trash-directory.c +++ b/libnautilus-private/nautilus-trash-directory.c @@ -27,15 +27,15 @@ #include "nautilus-trash-directory.h" #include "nautilus-directory-private.h" -#include "nautilus-file.h" #include "nautilus-trash-monitor.h" +#include "nautilus-volume-monitor.h" #include <eel/eel-glib-extensions.h> -#include <eel/eel-stock-dialogs.h> #include <eel/eel-gtk-macros.h> -#include "nautilus-volume-monitor.h" -#include <gtk/gtksignal.h> +#include <eel/eel-stock-dialogs.h> #include <gtk/gtkmain.h> +#include <gtk/gtksignal.h> #include <libgnome/gnome-i18n.h> +#include <libgnomevfs/gnome-vfs-utils.h> struct NautilusTrashDirectoryDetails { GHashTable *volumes; diff --git a/libnautilus-private/nautilus-trash-directory.h b/libnautilus-private/nautilus-trash-directory.h index 10da34187..ae40492bf 100644 --- a/libnautilus-private/nautilus-trash-directory.h +++ b/libnautilus-private/nautilus-trash-directory.h @@ -26,7 +26,7 @@ #ifndef NAUTILUS_TRASH_DIRECTORY_H #define NAUTILUS_TRASH_DIRECTORY_H -#include "nautilus-merged-directory.h" +#include <libnautilus-private/nautilus-merged-directory.h> #define NAUTILUS_TYPE_TRASH_DIRECTORY \ (nautilus_trash_directory_get_type ()) diff --git a/libnautilus-private/nautilus-trash-file.h b/libnautilus-private/nautilus-trash-file.h index 19b495fee..7f50b9425 100644 --- a/libnautilus-private/nautilus-trash-file.h +++ b/libnautilus-private/nautilus-trash-file.h @@ -26,7 +26,7 @@ #ifndef NAUTILUS_TRASH_FILE_H #define NAUTILUS_TRASH_FILE_H -#include "nautilus-file.h" +#include <libnautilus-private/nautilus-file.h> #define NAUTILUS_TYPE_TRASH_FILE \ (nautilus_trash_file_get_type ()) diff --git a/libnautilus-private/nautilus-trash-monitor.c b/libnautilus-private/nautilus-trash-monitor.c index 47d571733..803d7a7a1 100644 --- a/libnautilus-private/nautilus-trash-monitor.c +++ b/libnautilus-private/nautilus-trash-monitor.c @@ -37,6 +37,7 @@ #include <libgnomevfs/gnome-vfs-find-directory.h> #include <libgnomevfs/gnome-vfs-types.h> #include <libgnomevfs/gnome-vfs-uri.h> +#include <libgnomevfs/gnome-vfs-utils.h> struct NautilusTrashMonitorDetails { NautilusDirectory *trash_directory; diff --git a/libnautilus-private/nautilus-trash-monitor.h b/libnautilus-private/nautilus-trash-monitor.h index 7bcf3ff06..226fa1f12 100644 --- a/libnautilus-private/nautilus-trash-monitor.h +++ b/libnautilus-private/nautilus-trash-monitor.h @@ -27,9 +27,7 @@ #define NAUTILUS_TRASH_MONITOR_H #include <gtk/gtkobject.h> -#include <libgnomevfs/gnome-vfs.h> - -#include "nautilus-volume-monitor.h" +#include <libnautilus-private/nautilus-volume-monitor.h> typedef struct NautilusTrashMonitor NautilusTrashMonitor; typedef struct NautilusTrashMonitorClass NautilusTrashMonitorClass; diff --git a/libnautilus-private/nautilus-vfs-directory.h b/libnautilus-private/nautilus-vfs-directory.h index 059ff6524..040e6729d 100644 --- a/libnautilus-private/nautilus-vfs-directory.h +++ b/libnautilus-private/nautilus-vfs-directory.h @@ -26,7 +26,7 @@ #ifndef NAUTILUS_VFS_DIRECTORY_H #define NAUTILUS_VFS_DIRECTORY_H -#include "nautilus-directory.h" +#include <libnautilus-private/nautilus-directory.h> #define NAUTILUS_TYPE_VFS_DIRECTORY \ (nautilus_vfs_directory_get_type ()) diff --git a/libnautilus-private/nautilus-vfs-file.h b/libnautilus-private/nautilus-vfs-file.h index 2b1ee607e..94e5fe419 100644 --- a/libnautilus-private/nautilus-vfs-file.h +++ b/libnautilus-private/nautilus-vfs-file.h @@ -26,7 +26,7 @@ #ifndef NAUTILUS_VFS_FILE_H #define NAUTILUS_VFS_FILE_H -#include "nautilus-file.h" +#include <libnautilus-private/nautilus-file.h> #define NAUTILUS_TYPE_VFS_FILE \ (nautilus_vfs_file_get_type ()) |