summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-05-04 15:46:22 +0000
committerDarin Adler <darin@src.gnome.org>2000-05-04 15:46:22 +0000
commite0e2e07eabc3000686e276e17bed6200b5eb55bf (patch)
tree7072f1c6f31f540effc715199e9c9ff54e0686b4
parent9c14235dcd8ee598563d4a72c61d0570ccbb5623 (diff)
downloadnautilus-e0e2e07eabc3000686e276e17bed6200b5eb55bf.tar.gz
Some more instructions and cleanup. Removed one gratuitous renaming we
* HACKING: Some more instructions and cleanup. * RENAMING: Removed one gratuitous renaming we won't do. * components/html/ntl-web-browser.c: Removed stray "#include <config.h>" that I added by accident. * components/hardware/main.c: (main): * components/help/hyperbola-main.c: (main): * components/html/ntl-web-browser.c: (main): * components/music/main.c: (main): * components/notes/ntl-notes.c: (main): * components/rpmview/main.c: (main): * components/websearch/ntl-web-search.c: (main): * src/file-manager/gnome-desktop.c (main): * src/ntl-main.c (main): Added ifdefs so you don't get warnings when building with localization turned off. Ugly, but needed I think. * components/help/converters/gnome-db2html2/gdb3html.c: (ulink_start_element), (start_element): * components/help/converters/gnome-db2html2/sect-elements.c: (sect_sect_start_element), (sect_sect_end_element), (sect_title_start_element), (sect_xref_start_element), (sect_graphic_start_element), (sect_get_infobox_logo): * components/help/converters/gnome-db2html2/sect-preparse.c: (sect_preparse_sect_start_element), (sect_preparse_title_characters): * components/help/converters/gnome-db2html2/toc-elements.c: (toc_sect_start_element), (toc_title_start_element): * components/help/converters/gnome-info2html2/html.c: (write_node_link_html): * components/help/hyperbola-filefmt.c: (tree_key_compare): * components/help/hyperbola-nav-index.c: (start_element), (end_element), (hyperbola_navigation_index_new): * components/html/ntl-web-browser.c: (browser_submit): Replaced all uses of strcasecmp with g_strcasecmp. Why? Because Michael Meeks said so and that's good enough for me (in this case :-). * components/music/nautilus-music-view.c: (nautilus_music_view_update_from_uri): * libnautilus-extensions/nautilus-file.c: (nautilus_file_get_mime_type_as_string_attribute), (nautilus_file_get_mime_type): * libnautilus-extensions/nautilus-icon-factory.c: (nautilus_icon_factory_get_icon_name_for_regular_file): * src/file-manager/fm-icon-view.c (get_icon_property_callback): * src/ntl-index-panel.c (nautilus_index_panel_update_buttons): * src/ntl-uri-map.c (file_list_to_mime_type_hash_table): Changed get_mime_type to be like all other text functions and return a strdup'd string. John said it was a good idea. * libnautilus-extensions/nautilus-file-private.h: * libnautilus-extensions/nautilus-directory-async.c: (metafile_read_callback), (metafile_read_some), (set_up_request_by_file_attributes), (nautilus_directory_monitor_add_internal), (directory_list_get_next_position), (directory_load_callback), (ready_callback_call), (nautilus_directory_call_when_ready_internal), (wants_directory_count), (has_problem), (ready_callback_is_satisfied), (is_anyone_monitoring_file_list), (is_anyone_waiting_for_metafile), (is_wanted), (select_needy_file), (start_getting_directory_counts): Reorganize to get ready for adding code to read the top left text. * libnautilus-extensions/nautilus-file-attributes.h: Added name for the "top left text" attribute. * libnautilus-extensions/nautilus-file.h: * libnautilus-extensions/nautilus-file.c: (nautilus_file_get_top_left_text): Added call to get the top left text. * libnautilus-extensions/nautilus-icon-canvas-item.c: (draw_embedded_text): Tiny format tweak. * libnautilus-extensions/nautilus-icon-container.c: (nautilus_icon_container_update_icon): Tiny format tweak. * libnautilus-extensions/nautilus-icon-factory.h: * libnautilus-extensions/nautilus-icon-factory.c: (nautilus_icon_factory_get_pixbuf_for_file), (nautilus_icon_factory_get_pixmap_and_mask_for_file), (nautilus_icon_factory_embed_text), (nautilus_icon_factory_embed_file_text): Added support for embedded text. Not completely deployed yet.
-rw-r--r--ChangeLog111
-rw-r--r--HACKING30
-rw-r--r--RENAMING2
-rw-r--r--components/hardware/main.c2
-rw-r--r--components/help/converters/gnome-db2html2/gdb3html.c6
-rw-r--r--components/help/converters/gnome-db2html2/sect-elements.c24
-rw-r--r--components/help/converters/gnome-db2html2/sect-preparse.c4
-rw-r--r--components/help/converters/gnome-db2html2/toc-elements.c4
-rw-r--r--components/help/converters/gnome-info2html2/html.c2
-rw-r--r--components/help/hyperbola-filefmt.c2
-rw-r--r--components/help/hyperbola-main.c3
-rw-r--r--components/help/hyperbola-nav-index.c28
-rw-r--r--components/html/ntl-web-browser.c6
-rw-r--r--components/music/main.c2
-rw-r--r--components/music/nautilus-music-view.c3
-rw-r--r--components/notes/nautilus-notes.c2
-rw-r--r--components/notes/ntl-notes.c2
-rw-r--r--components/rpmview/main.c2
-rw-r--r--components/websearch/ntl-web-search.c2
-rw-r--r--libnautilus-extensions/nautilus-directory-async.c221
-rw-r--r--libnautilus-extensions/nautilus-file-attributes.h3
-rw-r--r--libnautilus-extensions/nautilus-file-private.h10
-rw-r--r--libnautilus-extensions/nautilus-file.c35
-rw-r--r--libnautilus-extensions/nautilus-file.h6
-rw-r--r--libnautilus-extensions/nautilus-icon-canvas-item.c2
-rw-r--r--libnautilus-extensions/nautilus-icon-container.c2
-rw-r--r--libnautilus-extensions/nautilus-icon-factory.c182
-rw-r--r--libnautilus-extensions/nautilus-icon-factory.h9
-rw-r--r--libnautilus-private/nautilus-directory-async.c221
-rw-r--r--libnautilus-private/nautilus-file-attributes.h3
-rw-r--r--libnautilus-private/nautilus-file-private.h10
-rw-r--r--libnautilus-private/nautilus-file.c35
-rw-r--r--libnautilus-private/nautilus-file.h6
-rw-r--r--libnautilus-private/nautilus-icon-canvas-item.c2
-rw-r--r--libnautilus-private/nautilus-icon-container.c2
-rw-r--r--libnautilus-private/nautilus-icon-factory.c182
-rw-r--r--libnautilus-private/nautilus-icon-factory.h9
-rw-r--r--src/file-manager/fm-icon-view.c4
-rw-r--r--src/file-manager/gnome-desktop.c6
-rw-r--r--src/nautilus-applicable-views.c4
-rw-r--r--src/nautilus-information-panel.c6
-rw-r--r--src/nautilus-main.c2
-rw-r--r--src/nautilus-sidebar.c6
-rw-r--r--src/ntl-index-panel.c6
-rw-r--r--src/ntl-main.c2
-rw-r--r--src/ntl-uri-map.c4
46 files changed, 887 insertions, 330 deletions
diff --git a/ChangeLog b/ChangeLog
index 6921de71f..ee06600d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,92 @@
+2000-05-04 Darin Adler <darin@eazel.com>
+
+ * HACKING: Some more instructions and cleanup.
+ * RENAMING: Removed one gratuitous renaming we won't do.
+
+ * components/html/ntl-web-browser.c:
+ Removed stray "#include <config.h>" that I added by accident.
+
+ * components/hardware/main.c: (main):
+ * components/help/hyperbola-main.c: (main):
+ * components/html/ntl-web-browser.c: (main):
+ * components/music/main.c: (main):
+ * components/notes/ntl-notes.c: (main):
+ * components/rpmview/main.c: (main):
+ * components/websearch/ntl-web-search.c: (main):
+ * src/file-manager/gnome-desktop.c (main):
+ * src/ntl-main.c (main):
+ Added ifdefs so you don't get warnings when building with
+ localization turned off. Ugly, but needed I think.
+
+ * components/help/converters/gnome-db2html2/gdb3html.c:
+ (ulink_start_element), (start_element):
+ * components/help/converters/gnome-db2html2/sect-elements.c:
+ (sect_sect_start_element), (sect_sect_end_element),
+ (sect_title_start_element), (sect_xref_start_element),
+ (sect_graphic_start_element), (sect_get_infobox_logo):
+ * components/help/converters/gnome-db2html2/sect-preparse.c:
+ (sect_preparse_sect_start_element),
+ (sect_preparse_title_characters):
+ * components/help/converters/gnome-db2html2/toc-elements.c:
+ (toc_sect_start_element), (toc_title_start_element):
+ * components/help/converters/gnome-info2html2/html.c:
+ (write_node_link_html):
+ * components/help/hyperbola-filefmt.c: (tree_key_compare):
+ * components/help/hyperbola-nav-index.c: (start_element),
+ (end_element), (hyperbola_navigation_index_new):
+ * components/html/ntl-web-browser.c: (browser_submit):
+ Replaced all uses of strcasecmp with g_strcasecmp.
+ Why? Because Michael Meeks said so and that's good enough
+ for me (in this case :-).
+
+ * components/music/nautilus-music-view.c:
+ (nautilus_music_view_update_from_uri):
+ * libnautilus-extensions/nautilus-file.c:
+ (nautilus_file_get_mime_type_as_string_attribute),
+ (nautilus_file_get_mime_type):
+ * libnautilus-extensions/nautilus-icon-factory.c:
+ (nautilus_icon_factory_get_icon_name_for_regular_file):
+ * src/file-manager/fm-icon-view.c (get_icon_property_callback):
+ * src/ntl-index-panel.c (nautilus_index_panel_update_buttons):
+ * src/ntl-uri-map.c (file_list_to_mime_type_hash_table):
+ Changed get_mime_type to be like all other text functions and
+ return a strdup'd string. John said it was a good idea.
+
+ * libnautilus-extensions/nautilus-file-private.h:
+ * libnautilus-extensions/nautilus-directory-async.c:
+ (metafile_read_callback), (metafile_read_some),
+ (set_up_request_by_file_attributes),
+ (nautilus_directory_monitor_add_internal),
+ (directory_list_get_next_position), (directory_load_callback),
+ (ready_callback_call),
+ (nautilus_directory_call_when_ready_internal),
+ (wants_directory_count), (has_problem),
+ (ready_callback_is_satisfied), (is_anyone_monitoring_file_list),
+ (is_anyone_waiting_for_metafile), (is_wanted), (select_needy_file),
+ (start_getting_directory_counts):
+ Reorganize to get ready for adding code to read the top left text.
+
+ * libnautilus-extensions/nautilus-file-attributes.h:
+ Added name for the "top left text" attribute.
+
+ * libnautilus-extensions/nautilus-file.h:
+ * libnautilus-extensions/nautilus-file.c:
+ (nautilus_file_get_top_left_text):
+ Added call to get the top left text.
+
+ * libnautilus-extensions/nautilus-icon-canvas-item.c:
+ (draw_embedded_text): Tiny format tweak.
+ * libnautilus-extensions/nautilus-icon-container.c:
+ (nautilus_icon_container_update_icon): Tiny format tweak.
+
+ * libnautilus-extensions/nautilus-icon-factory.h:
+ * libnautilus-extensions/nautilus-icon-factory.c:
+ (nautilus_icon_factory_get_pixbuf_for_file),
+ (nautilus_icon_factory_get_pixmap_and_mask_for_file),
+ (nautilus_icon_factory_embed_text),
+ (nautilus_icon_factory_embed_file_text):
+ Added support for embedded text. Not completely deployed yet.
+
2000-05-03 Pavel Cisler <pavel@eazel.com>
* src/file-manager/dfos-xfer.c (create_xfer_dialog),
@@ -47,7 +136,7 @@
* libnautilus-extensions/nautilus-undo-manager.c
(nautilus_undo_manager_unregister_object):
- New function to unregister a GtkObject form the undo manager.
+ New function to unregister a GtkObject from the undo manager.
Any transaction that contains the object is removed from the
undo and redo lists. This should be called for any object that
is no longer available for user interaction.
@@ -61,7 +150,7 @@
* src/file-manager/fm-icon-view.c:
* src/file-manager/fm-properties-window.c
(create_properties_window):
- Added call to unregister rename widget form undo manager.
+ Added call to unregister rename widget from undo manager.
* src/nautilus-bookmarks-window.c
Added undo support for entry widgets.
@@ -88,16 +177,16 @@
2000-05-03 Fatih Demir <kabalak@gmx.net>
- * nautilus.desktop : Yes,yes , nautilus can be such a
- typotic word ( nautlius->nautilus in Name entry .. )
+ * nautilus.desktop: Yes, yes, nautilus can be such a
+ typotic word (nautlius->nautilus in Name entry...)
- * configure.in : Added ko to ALL_LINGUAS .
+ * configure.in: Added ko to ALL_LINGUAS .
-2000-05-03 Andy Hertzfeld <andy@eazel.com>
+2000-05-02 Andy Hertzfeld <andy@eazel.com>
* src/nautilus-index-title.c,h:
- made it display the emblems associated with a file. Also, added a routine
- to return the current title.
+ made it display the emblems associated with a file. Also, added a
+ routine to return the current title.
* src/ntl-index-panel.c:
made dropping emblems on the index panel work by adding a new
receive_dropped_keyword routine
@@ -109,7 +198,7 @@
added new background image
* data/backgrounds/white_ribs.png:
added new "white_ribs" background image
-
+
2000-05-02 Gene Z. Ragan <gzr@eazel.com>
* libnautilus-extensions/nautilus-entry.c
@@ -135,7 +224,7 @@
Removed special case for "core" files, which are now
handled by the MIME type database used in gnome-vfs.
-2000-05-02 Andy Hertzfeld <andy@eazel.com>
+2000-05-02 Andy Hertzfeld <andy@eazel.com>
1st cut at property browser for drag and drop customization;
Backgrounds are fully implemented, emblems are only partially there,
@@ -235,7 +324,7 @@
(get_pixmap_and_mask_for_properties_window):
Removed the FIXME from this file, since the bug is fixed.
-2000-05-2 Cody Russell <car0969@gamma2.uta.edu>
+2000-05-02 Cody Russell <car0969@gamma2.uta.edu>
* src/ntl-window.c: Respect the user's GNOME preferences. Lock
down the "Location" toolbar if the user has "Can detach and
diff --git a/HACKING b/HACKING
index 86877d191..8d73c1614 100644
--- a/HACKING
+++ b/HACKING
@@ -8,10 +8,14 @@ the --prefix option to autogen.sh or configure.
Specifically, you will need to:
+
* Install all the needed modules into your selected prefix.
-Nautilus currently requires the following modules (built in the given order):
+Nautilus currently requires the following modules from GNOME CVS
+(built in the given order):
+module branch configure options
+------ ------ -----------------
glib: glib-1-2
gtk+: gtk-1-2
gnome-xml: LIB_XML_1_X
@@ -19,19 +23,31 @@ ORBit: orbit-stable-0-5
oaf: HEAD
gconf: HEAD
gnome-libs: gnome-libs-1-0
-gdk-pixbuf: HEAD (with --enable-canvas-pixbuf)
+gdk-pixbuf: HEAD --enable-canvas-pixbuf
gnome-print: HEAD
-bonobo: HEAD (with --enable-oaf=yes)
-gnome-vfs: HEAD (with --enable-oaf=yes)
+bonobo: HEAD --enable-oaf=yes
+gnome-vfs: HEAD --enable-oaf=yes
libglade: HEAD
-gtkhtml: HEAD (with --without-bonobo)
-eog: HEAD (with --enable-oaf=yes)
+gtkhtml: HEAD --without-bonobo
+eog: HEAD --enable-oaf=yes
gnet: HEAD
-ORBit requires you to install popt-1.5, which can be fetched from:
+Other modules for Red Hat users:
+
+- For other modules, the versions in Red Hat 6.1 will do.
+- ORBit requires popt-1.5, which can be fetched from:
ftp://ftp.valinux.com/pub/mirrors/redhat/rawhide/i386/RedHat/RPMS/popt-1.5-0.45.i386.rpm
+Other modules for Debian users (we haven't tried this ourselves):
+
+- You'll need libwww, which can be found at:
+
+ ftp://ftp.internatif.org/pub/debian/UNOFFICIAL/libw3c-libwww5_5.2.8-1_i386.deb
+ ftp://ftp.internatif.org/pub/debian/UNOFFICIAL/libw3c-libwww-dev_5.2.8-1_i386.deb
+
+
+
* Build and install nautilus into your selected prefix.
Also, you need to do a "killall oafd; killall gconfd" before
diff --git a/RENAMING b/RENAMING
index 5c97b3f44..b07d553d3 100644
--- a/RENAMING
+++ b/RENAMING
@@ -2,8 +2,6 @@ We put plans for renaming in here so we can think about them for a while.
Note that when we rename a class, it usually involves renaming some files too.
---
-[dD]etails -> [dD]etail
-
ntl* -> nautilus* (1)
NautilusViewFrame <--> NautilusView (2)
ntl-view-bonobo-subdoc -> ntl-view-bonobo-embeddable (see also 1, 2)
diff --git a/components/hardware/main.c b/components/hardware/main.c
index 57d2360b6..b15ed3453 100644
--- a/components/hardware/main.c
+++ b/components/hardware/main.c
@@ -71,8 +71,10 @@ int main(int argc, char *argv[])
CORBA_Environment ev;
/* Initialize gettext support */
+#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
+#endif
CORBA_exception_init(&ev);
diff --git a/components/help/converters/gnome-db2html2/gdb3html.c b/components/help/converters/gnome-db2html2/gdb3html.c
index 3d458f130..f651c41a9 100644
--- a/components/help/converters/gnome-db2html2/gdb3html.c
+++ b/components/help/converters/gnome-db2html2/gdb3html.c
@@ -35,7 +35,7 @@ ulink_start_element (Context *context, const gchar *name, const xmlChar **atrs)
atrs_ptr = (gchar **) atrs;
while (atrs_ptr && *atrs_ptr) {
- if (!strcasecmp (*atrs_ptr, "url")) {
+ if (!g_strcasecmp (*atrs_ptr, "url")) {
atrs_ptr++;
if (index == UNDEFINED) {
g_print ("<A HREF=\"%s\">", *atrs_ptr);
@@ -200,9 +200,9 @@ start_element(Context *context,
if (element && element->start_element_func)
(* element->start_element_func) (context, name, attrs);
- if (!strcasecmp (name, "xref")) {
+ if (!g_strcasecmp (name, "xref")) {
context->stack = g_list_remove_link (context->stack, context->stack);
- } else if (!strcasecmp (name, "void")) {
+ } else if (!g_strcasecmp (name, "void")) {
context->stack = g_list_remove_link (context->stack, context->stack);
}
}
diff --git a/components/help/converters/gnome-db2html2/sect-elements.c b/components/help/converters/gnome-db2html2/sect-elements.c
index 9a14c4a69..fd6e75308 100644
--- a/components/help/converters/gnome-db2html2/sect-elements.c
+++ b/components/help/converters/gnome-db2html2/sect-elements.c
@@ -327,7 +327,7 @@ sect_sect_start_element (Context *context,
g_return_if_fail (strlen (name) >= 5);
atrs_ptr = (gchar **) atrs;
while (atrs_ptr && *atrs_ptr) {
- if (!strcasecmp (*atrs_ptr, "id")) {
+ if (!g_strcasecmp (*atrs_ptr, "id")) {
atrs_ptr++;
((StackElement *)context->stack->data)->atrs = g_new0 (gchar *, 3);
((StackElement *)context->stack->data)->atrs[0] = g_strdup ("id");
@@ -397,7 +397,7 @@ sect_sect_end_element (Context *context,
atrs_ptr = ((StackElement *) context->stack->data)->atrs;
while (atrs_ptr && *atrs_ptr) {
- if (!strcasecmp (*atrs_ptr, "id")) {
+ if (!g_strcasecmp (*atrs_ptr, "id")) {
atrs_ptr++;
if (!strcmp (*atrs_ptr, context->target_section)) {
((SectContext *)context->data)->state = LOOKING_FOR_POST_SECT;
@@ -565,7 +565,7 @@ sect_title_start_element (Context *context,
atrs_ptr = (stack_el->atrs);
while (atrs_ptr && *atrs_ptr) {
- if (!strcasecmp (*atrs_ptr, "id")) {
+ if (!g_strcasecmp (*atrs_ptr, "id")) {
atrs_ptr++;
sect_print (context, "%s", *atrs_ptr);
break;
@@ -747,7 +747,7 @@ sect_xref_start_element (Context *context,
sect_print (context, "<A HREF=\"ghelp:%s", context->base_file);
atrs_ptr = (gchar **) atrs;
while (atrs_ptr && *atrs_ptr) {
- if (!strcasecmp (*atrs_ptr, "linkend")) {
+ if (!g_strcasecmp (*atrs_ptr, "linkend")) {
atrs_ptr++;
sect_print (context, "?%s", *atrs_ptr);
break;
@@ -847,17 +847,17 @@ sect_graphic_start_element (Context *context,
atrs_ptr = (gchar **) atrs;
while (atrs_ptr && *atrs_ptr) {
- if (!strcasecmp (*atrs_ptr, "format")) {
+ if (!g_strcasecmp (*atrs_ptr, "format")) {
atrs_ptr++;
format = *atrs_ptr;
atrs_ptr++;
continue;
- } else if (!strcasecmp (*atrs_ptr, "fileref")) {
+ } else if (!g_strcasecmp (*atrs_ptr, "fileref")) {
atrs_ptr++;
fileref = *atrs_ptr;
atrs_ptr++;
continue;
- } else if (!strcasecmp (*atrs_ptr, "id")) {
+ } else if (!g_strcasecmp (*atrs_ptr, "id")) {
atrs_ptr++;
sect_context->figure->id = g_strdup (*atrs_ptr);
atrs_ptr++;
@@ -869,7 +869,7 @@ sect_graphic_start_element (Context *context,
if (fileref == NULL)
return;
- if (format == NULL || (!strcasecmp (format, "gif")))
+ if (format == NULL || (!g_strcasecmp (format, "gif")))
sect_context->figure->img = g_strdup_printf ("%s.gif", fileref);
else
sect_context->figure->img = g_strdup_printf ("%s.png", fileref);
@@ -1109,13 +1109,13 @@ sect_programlisting_end_element (Context *context,
static gchar *
sect_get_infobox_logo (const gchar *name)
{
- if (!strcasecmp (name, "tip"))
+ if (!g_strcasecmp (name, "tip"))
return gnome_pixmap_file ("gnome-info.png");
- else if (!strcasecmp (name, "warning"))
+ else if (!g_strcasecmp (name, "warning"))
return gnome_pixmap_file ("gnome-warning.png");
- else if (!strcasecmp (name, "important"))
+ else if (!g_strcasecmp (name, "important"))
return gnome_pixmap_file ("gnome-info.png");
- else if (!strcasecmp (name, "note"))
+ else if (!g_strcasecmp (name, "note"))
return gnome_pixmap_file ("gnome-info.png");
return gnome_pixmap_file ("gnome-info.png");
}
diff --git a/components/help/converters/gnome-db2html2/sect-preparse.c b/components/help/converters/gnome-db2html2/sect-preparse.c
index d84ead78a..18b3cf442 100644
--- a/components/help/converters/gnome-db2html2/sect-preparse.c
+++ b/components/help/converters/gnome-db2html2/sect-preparse.c
@@ -89,7 +89,7 @@ sect_preparse_sect_start_element (Context *context,
g_return_if_fail (strlen (name) >= 5);
atrs_ptr = (gchar **) atrs;
while (atrs_ptr && *atrs_ptr) {
- if (!strcasecmp (*atrs_ptr, "id")) {
+ if (!g_strcasecmp (*atrs_ptr, "id")) {
atrs_ptr++;
((StackElement *)context->stack->data)->atrs = g_new0 (gchar *, 3);
((StackElement *)context->stack->data)->atrs[0] = g_strdup ("id");
@@ -126,7 +126,7 @@ sect_preparse_title_characters (Context *context,
atrs_ptr = stack_el->atrs;
while (atrs_ptr && *atrs_ptr) {
- if (!strcasecmp (*atrs_ptr, "id")) {
+ if (!g_strcasecmp (*atrs_ptr, "id")) {
gchar *temp;
temp = g_strndup (chars, len);
diff --git a/components/help/converters/gnome-db2html2/toc-elements.c b/components/help/converters/gnome-db2html2/toc-elements.c
index f007f848b..2493529f3 100644
--- a/components/help/converters/gnome-db2html2/toc-elements.c
+++ b/components/help/converters/gnome-db2html2/toc-elements.c
@@ -151,7 +151,7 @@ toc_sect_start_element (Context *context,
atrs_ptr = (gchar **) atrs;
while (atrs_ptr && *atrs_ptr) {
- if (!strcasecmp (*atrs_ptr, "id")) {
+ if (!g_strcasecmp (*atrs_ptr, "id")) {
atrs_ptr++;
((StackElement *)context->stack->data)->atrs = g_new0 (gchar *, 3);
((StackElement *)context->stack->data)->atrs[0] = g_strdup ("id");
@@ -367,7 +367,7 @@ toc_title_start_element (Context *context,
atrs_ptr = (stack_el->atrs);
while (atrs_ptr && *atrs_ptr) {
- if (!strcasecmp (*atrs_ptr, "id")) {
+ if (!g_strcasecmp (*atrs_ptr, "id")) {
atrs_ptr++;
g_print ("?%s", *atrs_ptr);
break;
diff --git a/components/help/converters/gnome-info2html2/html.c b/components/help/converters/gnome-info2html2/html.c
index ef0d74a9e..ebeaa7e3a 100644
--- a/components/help/converters/gnome-info2html2/html.c
+++ b/components/help/converters/gnome-info2html2/html.c
@@ -137,7 +137,7 @@ void write_node_link_html( FILE *f, char *nodefile, char *refname, char *ref )
char *href;
if (ref) {
- if (strcasecmp(ref, "(dir)")) {
+ if (g_strcasecmp(ref, "(dir)")) {
converted_nodename = g_strdup( ref );
map_spaces_to_underscores( converted_nodename );
href = form_info_tag_href(nodefile, converted_nodename);
diff --git a/components/help/hyperbola-filefmt.c b/components/help/hyperbola-filefmt.c
index 6c06e49df..ccfe0a0a0 100644
--- a/components/help/hyperbola-filefmt.c
+++ b/components/help/hyperbola-filefmt.c
@@ -50,7 +50,7 @@ tree_node_destroy(gpointer key, gpointer data, gpointer user_data)
static gint
tree_key_compare(gconstpointer k1, gconstpointer k2)
{
- return strcasecmp(k1, k2);
+ return g_strcasecmp(k1, k2);
}
HyperbolaDocTree *
diff --git a/components/help/hyperbola-main.c b/components/help/hyperbola-main.c
index 666bb2c20..1e0c2a7e0 100644
--- a/components/help/hyperbola-main.c
+++ b/components/help/hyperbola-main.c
@@ -51,9 +51,10 @@ main(int argc, char *argv[])
CORBA_ORB orb;
/* Initialize gettext support */
+#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
-
+#endif
gnome_init_with_popt_table("hyperbola", VERSION,
argc, argv,
diff --git a/components/help/hyperbola-nav-index.c b/components/help/hyperbola-nav-index.c
index 7cd32c3e2..81efd2b79 100644
--- a/components/help/hyperbola-nav-index.c
+++ b/components/help/hyperbola-nav-index.c
@@ -282,13 +282,13 @@ start_element(SAXParseInfo *spi,
const gchar *name,
const xmlChar **attrs)
{
- if(!strcasecmp(name, "indexterm"))
+ if(!g_strcasecmp(name, "indexterm"))
{
int i;
for(i = 0; attrs[i]; i++)
{
- if(!strcasecmp(attrs[i], "id"))
+ if(!g_strcasecmp(attrs[i], "id"))
{
i++;
break;
@@ -309,19 +309,19 @@ start_element(SAXParseInfo *spi,
if(!spi->in_term || spi->sub_type != NONE)
return;
- if(!strcasecmp(name, "primary"))
+ if(!g_strcasecmp(name, "primary"))
{
spi->sub_type = PRIMARY;
}
- else if(!strcasecmp(name, "secondary"))
+ else if(!g_strcasecmp(name, "secondary"))
{
spi->sub_type = SECONDARY;
}
- else if(!strcasecmp(name, "seealso"))
+ else if(!g_strcasecmp(name, "seealso"))
{
spi->sub_type = SEEALSO;
}
- else if(!strcasecmp(name, "see"))
+ else if(!g_strcasecmp(name, "see"))
{
spi->sub_type = SEE;
}
@@ -381,7 +381,7 @@ end_element (SAXParseInfo *spi,
{
int this_type;
- if(!strcasecmp(name, "indexterm"))
+ if(!g_strcasecmp(name, "indexterm"))
{
int i;
IndexItem *parent_ii = NULL, *ii = NULL;
@@ -410,7 +410,7 @@ end_element (SAXParseInfo *spi,
}
if(!parent_ii->subitems)
- parent_ii->subitems = g_tree_new((GCompareFunc)strcasecmp);
+ parent_ii->subitems = g_tree_new((GCompareFunc)g_strcasecmp);
parent_tree = parent_ii->subitems;
if(spi->stinfo[SECONDARY])
@@ -435,7 +435,7 @@ end_element (SAXParseInfo *spi,
}
if(!ii->subitems)
- ii->subitems = g_tree_new((GCompareFunc)strcasecmp);
+ ii->subitems = g_tree_new((GCompareFunc)g_strcasecmp);
parent_ii = ii;
parent_tree = parent_ii->subitems;
@@ -518,19 +518,19 @@ end_element (SAXParseInfo *spi,
if(!spi->in_term || spi->sub_type == NONE)
return;
- if(!strcasecmp(name, "primary"))
+ if(!g_strcasecmp(name, "primary"))
{
this_type = PRIMARY;
}
- else if(!strcasecmp(name, "secondary"))
+ else if(!g_strcasecmp(name, "secondary"))
{
this_type = SECONDARY;
}
- else if(!strcasecmp(name, "seealso"))
+ else if(!g_strcasecmp(name, "seealso"))
{
this_type = SEEALSO;
}
- else if(!strcasecmp(name, "see"))
+ else if(!g_strcasecmp(name, "see"))
{
this_type = SEE;
}
@@ -683,7 +683,7 @@ BonoboObject *hyperbola_navigation_index_new(void)
char *dir;
hni = g_new0(HyperbolaNavigationIndex, 1);
- hni->all_items = g_tree_new((GCompareFunc)strcasecmp);
+ hni->all_items = g_tree_new((GCompareFunc)g_strcasecmp);
dir = gnome_datadir_file("gnome/help");
if(!dir)
diff --git a/components/html/ntl-web-browser.c b/components/html/ntl-web-browser.c
index c39b4a16f..c3157cc98 100644
--- a/components/html/ntl-web-browser.c
+++ b/components/html/ntl-web-browser.c
@@ -1,4 +1,3 @@
-#include <config.h>
#include <WWWCore.h>
#include <WWWStream.h>
#include <WWWTrans.h>
@@ -528,7 +527,7 @@ browser_submit(GtkWidget *htmlw, const char *method, const char *url, const char
{
g_free(bi->post_data); bi->post_data = NULL;
- if(!strcasecmp(method, "POST"))
+ if(!g_strcasecmp(method, "POST"))
{
char **pieces = g_strsplit(encoding, "&", -1);
@@ -622,9 +621,12 @@ int main(int argc, char *argv[])
(G_LOG_DOMAIN, g_log_domain_glib, "Gdk", "Gtk", "GnomeVFS", "GnomeUI", "Bonobo",
"Nautilus-HTML", "gtkhtml", NULL);
+
/* Initialize gettext support */
+#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
+#endif
gnome_init_with_popt_table("ntl-web-browser", VERSION,
argc, argv,
diff --git a/components/music/main.c b/components/music/main.c
index b099bb92a..328e0f4dd 100644
--- a/components/music/main.c
+++ b/components/music/main.c
@@ -71,8 +71,10 @@ int main(int argc, char *argv[])
CORBA_Environment ev;
/* Initialize gettext support */
+#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
+#endif
CORBA_exception_init(&ev);
diff --git a/components/music/nautilus-music-view.c b/components/music/nautilus-music-view.c
index 57d1b5b01..9c0fea45b 100644
--- a/components/music/nautilus-music-view.c
+++ b/components/music/nautilus-music-view.c
@@ -437,7 +437,7 @@ nautilus_music_view_update_from_uri (NautilusMusicView *music_view, const char *
} else {
/* it's not an mp3 file, so see if it's an image */
NautilusFile *file = nautilus_file_get (path_name);
- const char *mime_type = nautilus_file_get_mime_type (file);
+ char *mime_type = nautilus_file_get_mime_type (file);
if (nautilus_str_has_prefix (mime_type, "image/")) {
/* for now, just keep the first image */
@@ -448,6 +448,7 @@ nautilus_music_view_update_from_uri (NautilusMusicView *music_view, const char *
nautilus_file_unref (file);
g_free (path_name);
+ g_free (mime_type);
}
}
diff --git a/components/notes/nautilus-notes.c b/components/notes/nautilus-notes.c
index 62f24f388..9401a9c85 100644
--- a/components/notes/nautilus-notes.c
+++ b/components/notes/nautilus-notes.c
@@ -211,8 +211,10 @@ main(int argc, char *argv[])
}
/* Initialize gettext support */
+#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
+#endif
/* initialize CORBA and Bonobo */
diff --git a/components/notes/ntl-notes.c b/components/notes/ntl-notes.c
index 62f24f388..9401a9c85 100644
--- a/components/notes/ntl-notes.c
+++ b/components/notes/ntl-notes.c
@@ -211,8 +211,10 @@ main(int argc, char *argv[])
}
/* Initialize gettext support */
+#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
+#endif
/* initialize CORBA and Bonobo */
diff --git a/components/rpmview/main.c b/components/rpmview/main.c
index 4e0b99810..a98898cae 100644
--- a/components/rpmview/main.c
+++ b/components/rpmview/main.c
@@ -70,8 +70,10 @@ int main(int argc, char *argv[])
CORBA_ORB orb;
/* Initialize gettext support */
+#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
+#endif
gnome_init_with_popt_table("nautilus-rpm-view", VERSION,
argc, argv,
diff --git a/components/websearch/ntl-web-search.c b/components/websearch/ntl-web-search.c
index c8666dec1..85b70b4e6 100644
--- a/components/websearch/ntl-web-search.c
+++ b/components/websearch/ntl-web-search.c
@@ -246,8 +246,10 @@ int main(int argc, char *argv[])
CORBA_ORB orb;
/* Initialize gettext support */
+#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
+#endif
gnome_init_with_popt_table("ntl-web-search", VERSION,
argc, argv,
diff --git a/libnautilus-extensions/nautilus-directory-async.c b/libnautilus-extensions/nautilus-directory-async.c
index d17b57554..8e1cdc941 100644
--- a/libnautilus-extensions/nautilus-directory-async.c
+++ b/libnautilus-extensions/nautilus-directory-async.c
@@ -57,67 +57,71 @@ struct MetafileWriteState {
gboolean write_again;
};
+/* A request for information about one or more files. */
typedef struct {
- NautilusFile *file; /* Which file to monitor, NULL to monitor all. */
+ gboolean metafile;
+ gboolean file_list; /* always FALSE if file != NULL */
+ gboolean directory_count;
+ gboolean top_left_text;
+} Request;
+
+typedef struct {
+ NautilusFile *file; /* Which file, NULL means all. */
union {
NautilusDirectoryCallback directory;
NautilusFileCallback file;
} callback;
gpointer callback_data;
-
- gboolean wait_for_metafile;
- gboolean wait_for_file_list; /* always FALSE if file != NULL */
- gboolean wait_for_directory_count;
+ Request request;
} ReadyCallback;
typedef struct {
- NautilusFile *file; /* Which file to monitor, NULL to monitor all. */
+ NautilusFile *file; /* Which file, NULL means all. */
gconstpointer client;
-
- gboolean monitor_file_list; /* always FALSE if file != NULL */
- gboolean monitor_directory_count;
+ Request request;
} Monitor;
-#define READ_CHUNK_SIZE (4 * 1024)
-
-static gboolean dequeue_pending_idle_callback (gpointer callback_data);
-static void directory_load_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- GnomeVFSDirectoryList *list,
- guint entries_read,
- gpointer callback_data);
-static void directory_load_done (NautilusDirectory *directory,
- GnomeVFSResult result);
-static void directory_load_one (NautilusDirectory *directory,
- GnomeVFSFileInfo *info);
-static void metafile_read_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer buffer,
- GnomeVFSFileSize bytes_requested,
- GnomeVFSFileSize bytes_read,
- gpointer callback_data);
-static void metafile_read_complete (NautilusDirectory *directory);
-static void metafile_read_failed (NautilusDirectory *directory,
- GnomeVFSResult result);
-static void metafile_read_open_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer callback_data);
-static void metafile_read_some (NautilusDirectory *directory);
-static void metafile_read_start (NautilusDirectory *directory);
-static void metafile_write_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gconstpointer buffer,
- GnomeVFSFileSize bytes_requested,
- GnomeVFSFileSize bytes_read,
- gpointer callback_data);
-static void metafile_write_complete (NautilusDirectory *directory);
-static void metafile_write_failed (NautilusDirectory *directory,
- GnomeVFSResult result);
-static GnomeVFSDirectoryListPosition nautilus_gnome_vfs_directory_list_get_next_position (GnomeVFSDirectoryList *list,
- GnomeVFSDirectoryListPosition position);
-static int ready_callback_key_compare (gconstpointer a,
- gconstpointer b);
-static void state_changed (NautilusDirectory *directory);
+typedef gboolean (* RequestCheck) (const Request *);
+typedef gboolean (* FileCheck) (NautilusFile *);
+
+#define METAFILE_READ_CHUNK_SIZE (4 * 1024)
+
+static gboolean dequeue_pending_idle_callback (gpointer callback_data);
+static void directory_load_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ GnomeVFSDirectoryList *list,
+ guint entries_read,
+ gpointer callback_data);
+static void directory_load_done (NautilusDirectory *directory,
+ GnomeVFSResult result);
+static void directory_load_one (NautilusDirectory *directory,
+ GnomeVFSFileInfo *info);
+static void metafile_read_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ gpointer buffer,
+ GnomeVFSFileSize bytes_requested,
+ GnomeVFSFileSize bytes_read,
+ gpointer callback_data);
+static void metafile_read_complete (NautilusDirectory *directory);
+static void metafile_read_failed (NautilusDirectory *directory,
+ GnomeVFSResult result);
+static void metafile_read_open_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ gpointer callback_data);
+static void metafile_read_some (NautilusDirectory *directory);
+static void metafile_read_start (NautilusDirectory *directory);
+static void metafile_write_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ gconstpointer buffer,
+ GnomeVFSFileSize bytes_requested,
+ GnomeVFSFileSize bytes_read,
+ gpointer callback_data);
+static void metafile_write_complete (NautilusDirectory *directory);
+static void metafile_write_failed (NautilusDirectory *directory,
+ GnomeVFSResult result);
+static int ready_callback_key_compare (gconstpointer a,
+ gconstpointer b);
+static void state_changed (NautilusDirectory *directory);
static void
empty_close_callback (GnomeVFSAsyncHandle *handle,
@@ -222,7 +226,7 @@ metafile_read_callback (GnomeVFSAsyncHandle *handle,
{
NautilusDirectory *directory;
- g_assert (bytes_requested == READ_CHUNK_SIZE);
+ g_assert (bytes_requested == METAFILE_READ_CHUNK_SIZE);
directory = NAUTILUS_DIRECTORY (callback_data);
g_assert (directory->details->read_state->handle == handle);
@@ -257,12 +261,12 @@ metafile_read_some (NautilusDirectory *directory)
{
directory->details->read_state->buffer = g_realloc
(directory->details->read_state->buffer,
- directory->details->read_state->bytes_read + READ_CHUNK_SIZE);
+ directory->details->read_state->bytes_read + METAFILE_READ_CHUNK_SIZE);
gnome_vfs_async_read (directory->details->read_state->handle,
(char *) directory->details->read_state->buffer
+ directory->details->read_state->bytes_read,
- READ_CHUNK_SIZE,
+ METAFILE_READ_CHUNK_SIZE,
metafile_read_callback,
directory);
}
@@ -550,6 +554,20 @@ remove_monitor (NautilusDirectory *directory,
remove_monitor_link (directory, find_monitor (directory, file, client));
}
+static void
+set_up_request_by_file_attributes (Request *request,
+ GList *file_attributes)
+{
+ request->directory_count = g_list_find_custom
+ (file_attributes,
+ NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT,
+ nautilus_str_compare) != NULL;
+ request->top_left_text = g_list_find_custom
+ (file_attributes,
+ NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT,
+ nautilus_str_compare) != NULL;
+}
+
void
nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
NautilusFile *file,
@@ -577,11 +595,8 @@ nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
monitor = g_new (Monitor, 1);
monitor->file = file;
monitor->client = client;
- monitor->monitor_file_list = file == NULL;
- monitor->monitor_directory_count = g_list_find_custom
- (file_attributes,
- NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT,
- nautilus_str_compare) != NULL;
+ monitor->request.file_list = file == NULL;
+ set_up_request_by_file_attributes (&monitor->request, file_attributes);
directory->details->monitor_list =
g_list_prepend (directory->details->monitor_list, monitor);
@@ -730,8 +745,8 @@ directory_load_done (NautilusDirectory *directory,
}
static GnomeVFSDirectoryListPosition
-nautilus_gnome_vfs_directory_list_get_next_position (GnomeVFSDirectoryList *list,
- GnomeVFSDirectoryListPosition position)
+directory_list_get_next_position (GnomeVFSDirectoryList *list,
+ GnomeVFSDirectoryListPosition position)
{
if (position != GNOME_VFS_DIRECTORY_LIST_POSITION_NONE) {
return gnome_vfs_directory_list_position_next (position);
@@ -742,7 +757,7 @@ nautilus_gnome_vfs_directory_list_get_next_position (GnomeVFSDirectoryList *list
return gnome_vfs_directory_list_get_first_position (list);
}
-void
+static void
directory_load_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
GnomeVFSDirectoryList *list,
@@ -764,7 +779,7 @@ directory_load_callback (GnomeVFSAsyncHandle *handle,
*/
last_handled = directory->details->directory_load_list_last_handled;
p = last_handled;
- while ((p = nautilus_gnome_vfs_directory_list_get_next_position (list, p))
+ while ((p = directory_list_get_next_position (list, p))
!= GNOME_VFS_DIRECTORY_LIST_POSITION_NONE) {
directory_load_one
(directory, gnome_vfs_directory_list_get (list, p));
@@ -838,7 +853,7 @@ ready_callback_call (NautilusDirectory *directory,
(* callback->callback.file) (callback->file,
callback->callback_data);
} else {
- if (directory == NULL || !callback->wait_for_file_list) {
+ if (directory == NULL || !callback->request.file_list) {
file_list = NULL;
} else {
file_list = directory->details->files;
@@ -880,15 +895,12 @@ nautilus_directory_call_when_ready_internal (NautilusDirectory *directory,
callback.callback.file = file_callback;
}
callback.callback_data = callback_data;
- callback.wait_for_metafile = directory_metadata_keys != NULL
+ callback.request.metafile = directory_metadata_keys != NULL
|| file_metadata_keys != NULL;
- callback.wait_for_file_list = file == NULL
+ callback.request.file_list = file == NULL
&& (file_attributes != NULL
|| file_metadata_keys != NULL);
- callback.wait_for_directory_count = g_list_find_custom
- (file_attributes,
- NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT,
- nautilus_str_compare) != NULL;
+ set_up_request_by_file_attributes (&callback.request, file_attributes);
/* Handle the NULL case. */
if (directory == NULL) {
@@ -1103,39 +1115,45 @@ lacks_directory_count (NautilusFile *file)
}
static gboolean
-any_lack_directory_count (GList *files)
+wants_directory_count (const Request *request)
+{
+ return request->directory_count;
+}
+
+static gboolean
+has_problem (NautilusDirectory *directory, NautilusFile *file, FileCheck problem)
{
GList *p;
- for (p = files; p != NULL; p = p->next) {
- if (lacks_directory_count (p->data)) {
+ if (file != NULL) {
+ return (* problem) (file);
+ }
+
+ for (p = directory->details->files; p != NULL; p = p->next) {
+ if ((* problem) (p->data)) {
return TRUE;
}
}
+
return FALSE;
+
}
static gboolean
ready_callback_is_satisfied (NautilusDirectory *directory,
ReadyCallback *callback)
{
- if (callback->wait_for_metafile && !directory->details->metafile_read) {
+ if (callback->request.metafile && !directory->details->metafile_read) {
return FALSE;
}
- if (callback->wait_for_file_list && !directory->details->directory_loaded) {
+ if (callback->request.file_list && !directory->details->directory_loaded) {
return FALSE;
}
- if (callback->wait_for_directory_count) {
- if (callback->file == NULL) {
- if (any_lack_directory_count (directory->details->files)) {
- return FALSE;
- }
- } else {
- if (lacks_directory_count (callback->file)) {
- return FALSE;
- }
+ if (callback->request.directory_count) {
+ if (has_problem (directory, callback->file, lacks_directory_count)) {
+ return FALSE;
}
}
@@ -1181,14 +1199,14 @@ is_anyone_monitoring_file_list (NautilusDirectory *directory)
for (p = directory->details->call_when_ready_list; p != NULL; p = p->next) {
callback = p->data;
- if (callback->wait_for_file_list) {
+ if (callback->request.file_list) {
return TRUE;
}
}
for (p = directory->details->monitor_list; p != NULL; p = p->next) {
monitor = p->data;
- if (monitor->monitor_file_list) {
+ if (monitor->request.file_list) {
return TRUE;
}
}
@@ -1205,7 +1223,7 @@ is_anyone_waiting_for_metafile (NautilusDirectory *directory)
for (p = directory->details->call_when_ready_list; p != NULL; p = p->next) {
callback = p->data;
- if (callback->wait_for_metafile) {
+ if (callback->request.metafile) {
return TRUE;
}
}
@@ -1275,7 +1293,7 @@ nautilus_directory_stop_monitoring_file_list (NautilusDirectory *directory)
}
static gboolean
-is_directory_count_wanted (NautilusFile *file)
+is_wanted (NautilusFile *file, RequestCheck check_wanted)
{
GList *p;
ReadyCallback *callback;
@@ -1285,14 +1303,14 @@ is_directory_count_wanted (NautilusFile *file)
for (p = file->details->directory->details->call_when_ready_list; p != NULL; p = p->next) {
callback = p->data;
- if (callback->wait_for_directory_count
+ if ((* check_wanted) (&callback->request)
&& (callback->file == NULL || callback->file == file)) {
return TRUE;
}
}
for (p = file->details->directory->details->monitor_list; p != NULL; p = p->next) {
monitor = p->data;
- if (monitor->monitor_directory_count
+ if ((* check_wanted) (&monitor->request)
&& (monitor->file == NULL || monitor->file == file)) {
return TRUE;
}
@@ -1301,24 +1319,26 @@ is_directory_count_wanted (NautilusFile *file)
}
static NautilusFile *
-select_file_to_get_directory_count_for (NautilusDirectory *directory)
+select_needy_file (NautilusDirectory *directory,
+ FileCheck check_missing,
+ RequestCheck check_wanted)
{
GList *p, *p2;
ReadyCallback *callback;
Monitor *monitor;
NautilusFile *file;
- /* Quick out if no one wants directory count monitored. */
+ /* Quick out if no one is interested. */
for (p = directory->details->call_when_ready_list; p != NULL; p = p->next) {
callback = p->data;
- if (callback->wait_for_directory_count) {
+ if ((* check_wanted) (&callback->request)) {
break;
}
}
if (p == NULL) {
for (p = directory->details->monitor_list; p != NULL; p = p->next) {
monitor = p->data;
- if (monitor->monitor_directory_count) {
+ if ((* check_wanted) (&monitor->request)) {
break;
}
}
@@ -1327,14 +1347,14 @@ select_file_to_get_directory_count_for (NautilusDirectory *directory)
}
}
- /* Search for a file that's a directory that needs a count. */
+ /* Search for a file that has an unfulfilled request. */
for (p = directory->details->files; p != NULL; p = p->next) {
file = p->data;
- if (lacks_directory_count (file)) {
+ if ((* check_missing) (file)) {
/* Make sure that someone cares about this particular directory's count. */
for (p2 = directory->details->call_when_ready_list; p2 != NULL; p2 = p2->next) {
callback = p2->data;
- if (callback->wait_for_directory_count
+ if ((* check_wanted) (&callback->request)
&& (callback->file == NULL || callback->file == file)) {
break;
}
@@ -1344,14 +1364,14 @@ select_file_to_get_directory_count_for (NautilusDirectory *directory)
}
for (p2 = directory->details->monitor_list; p2 != NULL; p2 = p2->next) {
monitor = p2->data;
- if (monitor->monitor_directory_count
+ if ((* check_wanted) (&monitor->request)
&& (monitor->file == NULL || monitor->file == file)) {
break;
}
}
if (p2 != NULL) {
return file;
- }
+ }
}
}
return NULL;
@@ -1369,7 +1389,8 @@ start_getting_directory_counts (NautilusDirectory *directory)
if (directory->details->count_in_progress != NULL) {
g_assert (NAUTILUS_IS_FILE (directory->details->count_file));
g_assert (directory->details->count_file->details->directory == directory);
- if (is_directory_count_wanted (directory->details->count_file)) {
+ if (is_wanted (directory->details->count_file,
+ wants_directory_count)) {
return;
}
@@ -1379,7 +1400,9 @@ start_getting_directory_counts (NautilusDirectory *directory)
}
/* Figure out which file to get a count for. */
- file = select_file_to_get_directory_count_for (directory);
+ file = select_needy_file (directory,
+ lacks_directory_count,
+ wants_directory_count);
if (file == NULL) {
return;
}
diff --git a/libnautilus-extensions/nautilus-file-attributes.h b/libnautilus-extensions/nautilus-file-attributes.h
index 873c68838..4472ecbbe 100644
--- a/libnautilus-extensions/nautilus-file-attributes.h
+++ b/libnautilus-extensions/nautilus-file-attributes.h
@@ -29,7 +29,8 @@
* in changes to the attributes.
*/
-#define NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE "MIME type"
#define NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT "directory item count"
+#define NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE "MIME type"
+#define NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT "top left text"
#endif /* NAUTILUS_FILE_ATTRIBUTES_H */
diff --git a/libnautilus-extensions/nautilus-file-private.h b/libnautilus-extensions/nautilus-file-private.h
index a0ab58f5f..a1a4b2919 100644
--- a/libnautilus-extensions/nautilus-file-private.h
+++ b/libnautilus-extensions/nautilus-file-private.h
@@ -28,13 +28,21 @@
struct NautilusFileDetails
{
NautilusDirectory *directory;
+ gboolean is_gone;
GnomeVFSFileInfo *info;
+
gboolean got_directory_count;
gboolean directory_count_failed;
guint directory_count;
- gboolean is_gone;
+
+ gboolean got_top_left_text;
+ char *top_left_text;
};
+#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_CHARACTERS_PER_LINE 80
+#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_LINES 20
+#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_BYTES 1000
+
NautilusFile *nautilus_file_new (NautilusDirectory *directory,
GnomeVFSFileInfo *info);
void nautilus_file_emit_changed (NautilusFile *file);
diff --git a/libnautilus-extensions/nautilus-file.c b/libnautilus-extensions/nautilus-file.c
index 725b07721..8a7d069e0 100644
--- a/libnautilus-extensions/nautilus-file.c
+++ b/libnautilus-extensions/nautilus-file.c
@@ -57,7 +57,7 @@ typedef enum {
NAUTILUS_DATE_TYPE_ACCESSED
} NautilusDateType;
-#define EMBLEM_NAME_SYMBOLIC_LINK "symbolic-link"
+#define EMBLEM_NAME_SYMBOLIC_LINK "symbolic-link"
enum {
CHANGED,
@@ -449,8 +449,7 @@ nautilus_file_rename (NautilusFile *file, const char *new_name)
g_return_val_if_fail (!nautilus_file_is_gone (file), GNOME_VFS_ERROR_BADPARAMS);
g_return_val_if_fail (nautilus_strlen (new_name) > 0, GNOME_VFS_ERROR_BADPARAMS);
- /*
- * Test the name-hasn't-changed case explicitly, for two reasons.
+ /* Test the name-hasn't-changed case explicitly, for two reasons.
* (1) gnome_vfs_move returns an error if new & old are same.
* (2) We don't want to send file-changed signal if nothing changed.
*/
@@ -1214,14 +1213,15 @@ nautilus_file_get_group_as_string (NautilusFile *file)
static char *
nautilus_file_get_mime_type_as_string_attribute (NautilusFile *file)
{
- const char *mime_string;
+ char *mime_string;
mime_string = nautilus_file_get_mime_type (file);
- if (nautilus_strlen (mime_string) > 0) {
- return g_strdup (mime_string);
+ if (mime_string != NULL) {
+ return mime_string;
}
- return g_strdup ("unknown MIME type");
+ g_free (mime_string);
+ return g_strdup (_("unknown MIME type"));
}
/**
@@ -1400,12 +1400,12 @@ nautilus_file_get_file_type (NautilusFile *file)
* Returns: The mime type.
*
**/
-const char *
+char *
nautilus_file_get_mime_type (NautilusFile *file)
{
g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
- return file->details->info->mime_type;
+ return g_strdup (file->details->info->mime_type);
}
/**
@@ -1656,6 +1656,23 @@ nautilus_file_is_executable (NautilusFile *file)
}
/**
+ * nautilus_file_get_top_left_text
+ *
+ * Get the text from the top left of the file.
+ * @file: NautilusFile representing the file in question.
+ *
+ * Returns: NULL if there is no text readable, otherwise, the text.
+ *
+ **/
+char *
+nautilus_file_get_top_left_text (NautilusFile *file)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
+
+ return NULL; /* g_strdup ("DARIN IMPLEMENT THIS"); */
+}
+
+/**
* nautilus_file_delete
*
* Delete this file.
diff --git a/libnautilus-extensions/nautilus-file.h b/libnautilus-extensions/nautilus-file.h
index 9b55f17e7..e5b1186c4 100644
--- a/libnautilus-extensions/nautilus-file.h
+++ b/libnautilus-extensions/nautilus-file.h
@@ -101,7 +101,7 @@ char * nautilus_file_get_uri (NautilusFile *
char * nautilus_file_get_mapped_uri (NautilusFile *file);
GnomeVFSFileSize nautilus_file_get_size (NautilusFile *file);
GnomeVFSFileType nautilus_file_get_file_type (NautilusFile *file);
-const char * nautilus_file_get_mime_type (NautilusFile *file);
+char * nautilus_file_get_mime_type (NautilusFile *file);
gboolean nautilus_file_is_mime_type (NautilusFile *file,
const char *mime_type);
gboolean nautilus_file_is_symbolic_link (NautilusFile *file);
@@ -114,6 +114,7 @@ GList * nautilus_file_get_keywords (NautilusFile *
void nautilus_file_set_keywords (NautilusFile *file,
GList *keywords);
GList * nautilus_file_get_emblem_names (NautilusFile *file);
+char * nautilus_file_get_top_left_text (NautilusFile *file);
/* Basic operations for file objects. */
gboolean nautilus_file_can_read (NautilusFile *file);
@@ -142,7 +143,7 @@ void nautilus_file_set_metadata (NautilusFile *
char * nautilus_file_get_string_attribute (NautilusFile *file,
const char *attribute_name);
-/* Matching with another URI*/
+/* Matching with another URI. */
gboolean nautilus_file_matches_uri (NautilusFile *file,
const char *uri);
@@ -151,6 +152,7 @@ gboolean nautilus_file_matches_uri (NautilusFile *
*/
gboolean nautilus_file_update (NautilusFile *file,
GnomeVFSFileInfo *info);
+
/* Comparing two file objects for sorting */
int nautilus_file_compare_for_sort (NautilusFile *file_1,
NautilusFile *file_2,
diff --git a/libnautilus-extensions/nautilus-icon-canvas-item.c b/libnautilus-extensions/nautilus-icon-canvas-item.c
index 9dd760432..05f38ec77 100644
--- a/libnautilus-extensions/nautilus-icon-canvas-item.c
+++ b/libnautilus-extensions/nautilus-icon-canvas-item.c
@@ -801,7 +801,7 @@ draw_embedded_text (GnomeCanvasItem* item,
cur_y += embedded_text_font->descent + embedded_text_font->ascent;
}
- gdk_gc_unref(gc);
+ gdk_gc_unref (gc);
fclose (text_file);
}
diff --git a/libnautilus-extensions/nautilus-icon-container.c b/libnautilus-extensions/nautilus-icon-container.c
index 18432c801..975be5315 100644
--- a/libnautilus-extensions/nautilus-icon-container.c
+++ b/libnautilus-extensions/nautilus-icon-container.c
@@ -2413,7 +2413,7 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
icon->data,
&additional_text);
- end_renaming_mode(container, TRUE);
+ end_renaming_mode (container, TRUE);
font = details->label_font[details->zoom_level];
diff --git a/libnautilus-extensions/nautilus-icon-factory.c b/libnautilus-extensions/nautilus-icon-factory.c
index 730e5e685..c8377207f 100644
--- a/libnautilus-extensions/nautilus-icon-factory.c
+++ b/libnautilus-extensions/nautilus-icon-factory.c
@@ -42,16 +42,17 @@
#include <parser.h>
#include <xmlmemory.h>
-#include "librsvg/rsvg.h"
+#include <librsvg/rsvg.h>
-#include "nautilus-string.h"
#include "nautilus-default-file-icon.h"
-#include "nautilus-metadata.h"
-#include "nautilus-lib-self-check-functions.h"
-#include "nautilus-link.h"
+#include "nautilus-gdk-extensions.h"
#include "nautilus-glib-extensions.h"
#include "nautilus-global-preferences.h"
#include "nautilus-gtk-macros.h"
+#include "nautilus-lib-self-check-functions.h"
+#include "nautilus-link.h"
+#include "nautilus-metadata.h"
+#include "nautilus-string.h"
#include "nautilus-xml-extensions.h"
/* List of suffixes to search when looking for an icon file. */
@@ -435,18 +436,21 @@ nautilus_icon_factory_set_theme (const char *theme_name)
static const char *
nautilus_icon_factory_get_icon_name_for_regular_file (NautilusFile *file)
{
- const char *mime_type;
+ char *mime_type;
const char *icon_name;
mime_type = nautilus_file_get_mime_type (file);
if (mime_type != NULL) {
icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename");
+ g_free (mime_type);
if (icon_name != NULL) {
return icon_name;
}
}
- /* GNOME didn't give us a file name, so we have to fall back on special icon sets. */
+ /* gnome_vfs_mime didn't give us an icon name, so we have to
+ * fall back on default icons.
+ */
if (nautilus_file_is_executable (file)) {
return ICON_NAME_EXECUTABLE;
}
@@ -578,7 +582,10 @@ get_themed_icon_file_path (const char *theme_name,
/* Choose the file name to load, taking into account theme vs. non-theme icons. */
static char *
-get_icon_file_path (const char *name, const char* modifier, guint size_in_pixels, ArtIRect *text_rect)
+get_icon_file_path (const char *name,
+ const char* modifier,
+ guint size_in_pixels,
+ ArtIRect *text_rect)
{
gboolean use_theme_icon;
const char *theme_name;
@@ -608,9 +615,9 @@ get_icon_file_path (const char *name, const char* modifier, guint size_in_pixels
if (modifier && strlen(modifier)) {
char* modified_name = g_strdup_printf("%s-%s", name, modifier);
path = get_themed_icon_file_path (use_theme_icon ? theme_name : NULL,
- modified_name,
- size_in_pixels,
- text_rect);
+ modified_name,
+ size_in_pixels,
+ text_rect);
g_free(modified_name);
if (path)
return path;
@@ -1618,18 +1625,27 @@ nautilus_icon_factory_get_pixbuf_for_file (NautilusFile *file,
guint size_in_pixels)
{
NautilusScalableIcon *icon;
- GdkPixbuf *pixbuf;
+ GdkPixbuf *pixbuf_without_text, *pixbuf_with_text;
+ ArtIRect embedded_text_rect;
g_return_val_if_fail (file != NULL, NULL);
+ /* Get the pixbuf for this file. */
icon = nautilus_icon_factory_get_icon_for_file (file, NULL);
- pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
+ pixbuf_without_text = nautilus_icon_factory_get_pixbuf_for_icon
(icon,
size_in_pixels, size_in_pixels,
size_in_pixels, size_in_pixels,
- NULL);
+ &embedded_text_rect);
nautilus_scalable_icon_unref (icon);
- return pixbuf;
+
+ pixbuf_with_text = nautilus_icon_factory_embed_file_text
+ (pixbuf_without_text,
+ &embedded_text_rect,
+ file);
+ gdk_pixbuf_unref (pixbuf_without_text);
+
+ return pixbuf_with_text;
}
/* Convenience cover for nautilus_icon_factory_get_icon_for_file,
@@ -1657,6 +1673,142 @@ nautilus_icon_factory_get_pixmap_and_mask_for_file (NautilusFile *file,
gdk_pixbuf_unref (pixbuf);
}
+GdkPixbuf *
+nautilus_icon_factory_embed_text (GdkPixbuf *pixbuf_without_text,
+ const ArtIRect *embedded_text_rect,
+ const char *text)
+{
+ static GdkFont *font;
+
+ ArtIRect pixbuf_rect, text_rect;
+ int width, height;
+ GdkVisual *visual;
+ GdkPixmap *pixmap;
+ GdkGC *gc;
+ GdkColormap *colormap;
+ int y;
+ const char *line, *end_of_line;
+ int line_length;
+ GdkPixbuf *text_pixbuf, *text_pixbuf_with_alpha, *pixbuf_with_text;
+
+ g_return_val_if_fail (pixbuf_without_text != NULL, NULL);
+ g_return_val_if_fail (embedded_text_rect != NULL, gdk_pixbuf_ref (pixbuf_without_text));
+
+ /* Get the font the first time through. */
+ if (font == NULL) {
+ /* FIXME bugzilla.eazel.com 667: the font shouldn't be hard-wired like this */
+ font = gdk_font_load ("-bitstream-charter-medium-r-normal-*-9-*-*-*-*-*-*-*");
+ g_return_val_if_fail (font != NULL, gdk_pixbuf_ref (pixbuf_without_text));
+ }
+
+ /* Quick out for the case where there's no place to embed the
+ * text or no text.
+ */
+ if (art_irect_empty (embedded_text_rect) || nautilus_strlen (text) == 0) {
+ return gdk_pixbuf_ref (pixbuf_without_text);
+ }
+
+ /* Compute the intersection of the text rectangle with the pixbuf.
+ * This is only to prevent pathological cases from upsetting the
+ * GdkPixbuf routines. It should not happen in any normal circumstance.
+ */
+ pixbuf_rect.x0 = 0;
+ pixbuf_rect.y0 = 0;
+ pixbuf_rect.x1 = gdk_pixbuf_get_width (pixbuf_without_text);
+ pixbuf_rect.y1 = gdk_pixbuf_get_height (pixbuf_without_text);
+ art_irect_intersect (&text_rect, embedded_text_rect, &pixbuf_rect);
+
+ /* Get the system visual. I wish I could do this all in 1-bit mode,
+ * but I can't.
+ */
+ visual = gdk_visual_get_system ();
+
+ /* Allocate a GdkPixmap of the appropriate size. */
+ width = text_rect.x1 - text_rect.x0;
+ height = text_rect.y1 - text_rect.y0;
+ pixmap = gdk_pixmap_new (NULL, width, height, visual->depth);
+ gc = gdk_gc_new (pixmap);
+
+ /* Set up a white background. */
+ gdk_rgb_gc_set_foreground (gc, NAUTILUS_RGB_COLOR_WHITE);
+ gdk_draw_rectangle (pixmap, gc, TRUE, 0, 0, width, height);
+
+ /* Draw black text. */
+ gdk_rgb_gc_set_foreground (gc, NAUTILUS_RGB_COLOR_BLACK);
+ gdk_gc_set_font (gc, font);
+ line = text;
+ for (y = font->ascent;
+ y + font->descent <= height;
+ y += font->ascent + font->descent) {
+
+ /* Extract the next line of text. */
+ end_of_line = strchr (line, '\n');
+ line_length = end_of_line == NULL
+ ? strlen (line)
+ : end_of_line - line;
+
+ /* Draw the next line of text. */
+ gdk_draw_text (pixmap, font, gc, 0, y,
+ line, line_length);
+
+ /* Move on to the subsequent line. */
+ line = end_of_line == NULL
+ ? ""
+ : end_of_line + 1;
+ }
+ gdk_gc_unref (gc);
+
+ /* Convert into a GdkPixbuf with gdk_pixbuf_get_from_drawable. */
+ colormap = gdk_colormap_new (visual, FALSE);
+ text_pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, colormap,
+ 0, 0,
+ 0, 0, width, height);
+ gdk_colormap_unref (colormap);
+ gdk_pixmap_unref (pixmap);
+ text_pixbuf_with_alpha = gdk_pixbuf_add_alpha (text_pixbuf,
+ TRUE, 0xFF, 0xFF, 0xFF);
+ gdk_pixbuf_unref (text_pixbuf);
+ pixbuf_with_text = gdk_pixbuf_copy (pixbuf_without_text);
+ gdk_pixbuf_composite (text_pixbuf_with_alpha,
+ pixbuf_with_text,
+ text_rect.x0,
+ text_rect.y0,
+ width, height,
+ text_rect.x0,
+ text_rect.y0,
+ 1, 1,
+ GDK_INTERP_BILINEAR,
+ 0xFF);
+ gdk_pixbuf_unref (text_pixbuf_with_alpha);
+
+ return pixbuf_with_text;
+}
+
+GdkPixbuf *
+nautilus_icon_factory_embed_file_text (GdkPixbuf *pixbuf_without_text,
+ const ArtIRect *embedded_text_rect,
+ NautilusFile *file)
+{
+ char *text;
+ GdkPixbuf *pixbuf_with_text;
+
+ g_return_val_if_fail (pixbuf_without_text != NULL, NULL);
+ g_return_val_if_fail (embedded_text_rect != NULL, NULL);
+ g_return_val_if_fail (file == NULL || NAUTILUS_IS_FILE (file), NULL);
+
+ /* Quick out to save us getting the file's text. */
+ if (art_irect_empty (embedded_text_rect) && file == NULL) {
+ return gdk_pixbuf_ref (pixbuf_without_text);
+ }
+
+ /* Embed the text. */
+ text = nautilus_file_get_top_left_text (file);
+ pixbuf_with_text = nautilus_icon_factory_embed_text
+ (pixbuf_without_text, embedded_text_rect, text);
+ g_free (text);
+ return pixbuf_with_text;
+}
+
/* Convenience function for unrefing and then freeing an entire list. */
void
nautilus_scalable_icon_list_free (GList *icon_list)
diff --git a/libnautilus-extensions/nautilus-icon-factory.h b/libnautilus-extensions/nautilus-icon-factory.h
index 831712d1f..84545404d 100644
--- a/libnautilus-extensions/nautilus-icon-factory.h
+++ b/libnautilus-extensions/nautilus-icon-factory.h
@@ -94,7 +94,6 @@ guint nautilus_get_icon_size_for_zoom_level (Nautil
/* Choose the appropriate icon, but don't render it yet. */
NautilusScalableIcon *nautilus_icon_factory_get_icon_for_file (NautilusFile *file,
const char *modifier);
-
NautilusScalableIcon *nautilus_icon_factory_get_icon_by_name (const char *icon_name);
GList * nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file);
@@ -112,6 +111,14 @@ GdkPixbuf * nautilus_icon_factory_get_pixbuf_for_icon (Nautil
guint maximum_size_in_pixels_y,
ArtIRect *embedded_text_rectangle);
+/* Superimposing embedded text on an icon. */
+GdkPixbuf * nautilus_icon_factory_embed_text (GdkPixbuf *pixbuf_without_text,
+ const ArtIRect *embedded_text_rectangle,
+ const char *text);
+GdkPixbuf * nautilus_icon_factory_embed_file_text (GdkPixbuf *pixbuf_without_text,
+ const ArtIRect *embedded_text_rectangle,
+ NautilusFile *file);
+
/* Convenience functions for the common case where you want to choose
* and render the icon into a pixbuf all at once.
*/
diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c
index d17b57554..8e1cdc941 100644
--- a/libnautilus-private/nautilus-directory-async.c
+++ b/libnautilus-private/nautilus-directory-async.c
@@ -57,67 +57,71 @@ struct MetafileWriteState {
gboolean write_again;
};
+/* A request for information about one or more files. */
typedef struct {
- NautilusFile *file; /* Which file to monitor, NULL to monitor all. */
+ gboolean metafile;
+ gboolean file_list; /* always FALSE if file != NULL */
+ gboolean directory_count;
+ gboolean top_left_text;
+} Request;
+
+typedef struct {
+ NautilusFile *file; /* Which file, NULL means all. */
union {
NautilusDirectoryCallback directory;
NautilusFileCallback file;
} callback;
gpointer callback_data;
-
- gboolean wait_for_metafile;
- gboolean wait_for_file_list; /* always FALSE if file != NULL */
- gboolean wait_for_directory_count;
+ Request request;
} ReadyCallback;
typedef struct {
- NautilusFile *file; /* Which file to monitor, NULL to monitor all. */
+ NautilusFile *file; /* Which file, NULL means all. */
gconstpointer client;
-
- gboolean monitor_file_list; /* always FALSE if file != NULL */
- gboolean monitor_directory_count;
+ Request request;
} Monitor;
-#define READ_CHUNK_SIZE (4 * 1024)
-
-static gboolean dequeue_pending_idle_callback (gpointer callback_data);
-static void directory_load_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- GnomeVFSDirectoryList *list,
- guint entries_read,
- gpointer callback_data);
-static void directory_load_done (NautilusDirectory *directory,
- GnomeVFSResult result);
-static void directory_load_one (NautilusDirectory *directory,
- GnomeVFSFileInfo *info);
-static void metafile_read_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer buffer,
- GnomeVFSFileSize bytes_requested,
- GnomeVFSFileSize bytes_read,
- gpointer callback_data);
-static void metafile_read_complete (NautilusDirectory *directory);
-static void metafile_read_failed (NautilusDirectory *directory,
- GnomeVFSResult result);
-static void metafile_read_open_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer callback_data);
-static void metafile_read_some (NautilusDirectory *directory);
-static void metafile_read_start (NautilusDirectory *directory);
-static void metafile_write_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gconstpointer buffer,
- GnomeVFSFileSize bytes_requested,
- GnomeVFSFileSize bytes_read,
- gpointer callback_data);
-static void metafile_write_complete (NautilusDirectory *directory);
-static void metafile_write_failed (NautilusDirectory *directory,
- GnomeVFSResult result);
-static GnomeVFSDirectoryListPosition nautilus_gnome_vfs_directory_list_get_next_position (GnomeVFSDirectoryList *list,
- GnomeVFSDirectoryListPosition position);
-static int ready_callback_key_compare (gconstpointer a,
- gconstpointer b);
-static void state_changed (NautilusDirectory *directory);
+typedef gboolean (* RequestCheck) (const Request *);
+typedef gboolean (* FileCheck) (NautilusFile *);
+
+#define METAFILE_READ_CHUNK_SIZE (4 * 1024)
+
+static gboolean dequeue_pending_idle_callback (gpointer callback_data);
+static void directory_load_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ GnomeVFSDirectoryList *list,
+ guint entries_read,
+ gpointer callback_data);
+static void directory_load_done (NautilusDirectory *directory,
+ GnomeVFSResult result);
+static void directory_load_one (NautilusDirectory *directory,
+ GnomeVFSFileInfo *info);
+static void metafile_read_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ gpointer buffer,
+ GnomeVFSFileSize bytes_requested,
+ GnomeVFSFileSize bytes_read,
+ gpointer callback_data);
+static void metafile_read_complete (NautilusDirectory *directory);
+static void metafile_read_failed (NautilusDirectory *directory,
+ GnomeVFSResult result);
+static void metafile_read_open_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ gpointer callback_data);
+static void metafile_read_some (NautilusDirectory *directory);
+static void metafile_read_start (NautilusDirectory *directory);
+static void metafile_write_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ gconstpointer buffer,
+ GnomeVFSFileSize bytes_requested,
+ GnomeVFSFileSize bytes_read,
+ gpointer callback_data);
+static void metafile_write_complete (NautilusDirectory *directory);
+static void metafile_write_failed (NautilusDirectory *directory,
+ GnomeVFSResult result);
+static int ready_callback_key_compare (gconstpointer a,
+ gconstpointer b);
+static void state_changed (NautilusDirectory *directory);
static void
empty_close_callback (GnomeVFSAsyncHandle *handle,
@@ -222,7 +226,7 @@ metafile_read_callback (GnomeVFSAsyncHandle *handle,
{
NautilusDirectory *directory;
- g_assert (bytes_requested == READ_CHUNK_SIZE);
+ g_assert (bytes_requested == METAFILE_READ_CHUNK_SIZE);
directory = NAUTILUS_DIRECTORY (callback_data);
g_assert (directory->details->read_state->handle == handle);
@@ -257,12 +261,12 @@ metafile_read_some (NautilusDirectory *directory)
{
directory->details->read_state->buffer = g_realloc
(directory->details->read_state->buffer,
- directory->details->read_state->bytes_read + READ_CHUNK_SIZE);
+ directory->details->read_state->bytes_read + METAFILE_READ_CHUNK_SIZE);
gnome_vfs_async_read (directory->details->read_state->handle,
(char *) directory->details->read_state->buffer
+ directory->details->read_state->bytes_read,
- READ_CHUNK_SIZE,
+ METAFILE_READ_CHUNK_SIZE,
metafile_read_callback,
directory);
}
@@ -550,6 +554,20 @@ remove_monitor (NautilusDirectory *directory,
remove_monitor_link (directory, find_monitor (directory, file, client));
}
+static void
+set_up_request_by_file_attributes (Request *request,
+ GList *file_attributes)
+{
+ request->directory_count = g_list_find_custom
+ (file_attributes,
+ NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT,
+ nautilus_str_compare) != NULL;
+ request->top_left_text = g_list_find_custom
+ (file_attributes,
+ NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT,
+ nautilus_str_compare) != NULL;
+}
+
void
nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
NautilusFile *file,
@@ -577,11 +595,8 @@ nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
monitor = g_new (Monitor, 1);
monitor->file = file;
monitor->client = client;
- monitor->monitor_file_list = file == NULL;
- monitor->monitor_directory_count = g_list_find_custom
- (file_attributes,
- NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT,
- nautilus_str_compare) != NULL;
+ monitor->request.file_list = file == NULL;
+ set_up_request_by_file_attributes (&monitor->request, file_attributes);
directory->details->monitor_list =
g_list_prepend (directory->details->monitor_list, monitor);
@@ -730,8 +745,8 @@ directory_load_done (NautilusDirectory *directory,
}
static GnomeVFSDirectoryListPosition
-nautilus_gnome_vfs_directory_list_get_next_position (GnomeVFSDirectoryList *list,
- GnomeVFSDirectoryListPosition position)
+directory_list_get_next_position (GnomeVFSDirectoryList *list,
+ GnomeVFSDirectoryListPosition position)
{
if (position != GNOME_VFS_DIRECTORY_LIST_POSITION_NONE) {
return gnome_vfs_directory_list_position_next (position);
@@ -742,7 +757,7 @@ nautilus_gnome_vfs_directory_list_get_next_position (GnomeVFSDirectoryList *list
return gnome_vfs_directory_list_get_first_position (list);
}
-void
+static void
directory_load_callback (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
GnomeVFSDirectoryList *list,
@@ -764,7 +779,7 @@ directory_load_callback (GnomeVFSAsyncHandle *handle,
*/
last_handled = directory->details->directory_load_list_last_handled;
p = last_handled;
- while ((p = nautilus_gnome_vfs_directory_list_get_next_position (list, p))
+ while ((p = directory_list_get_next_position (list, p))
!= GNOME_VFS_DIRECTORY_LIST_POSITION_NONE) {
directory_load_one
(directory, gnome_vfs_directory_list_get (list, p));
@@ -838,7 +853,7 @@ ready_callback_call (NautilusDirectory *directory,
(* callback->callback.file) (callback->file,
callback->callback_data);
} else {
- if (directory == NULL || !callback->wait_for_file_list) {
+ if (directory == NULL || !callback->request.file_list) {
file_list = NULL;
} else {
file_list = directory->details->files;
@@ -880,15 +895,12 @@ nautilus_directory_call_when_ready_internal (NautilusDirectory *directory,
callback.callback.file = file_callback;
}
callback.callback_data = callback_data;
- callback.wait_for_metafile = directory_metadata_keys != NULL
+ callback.request.metafile = directory_metadata_keys != NULL
|| file_metadata_keys != NULL;
- callback.wait_for_file_list = file == NULL
+ callback.request.file_list = file == NULL
&& (file_attributes != NULL
|| file_metadata_keys != NULL);
- callback.wait_for_directory_count = g_list_find_custom
- (file_attributes,
- NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT,
- nautilus_str_compare) != NULL;
+ set_up_request_by_file_attributes (&callback.request, file_attributes);
/* Handle the NULL case. */
if (directory == NULL) {
@@ -1103,39 +1115,45 @@ lacks_directory_count (NautilusFile *file)
}
static gboolean
-any_lack_directory_count (GList *files)
+wants_directory_count (const Request *request)
+{
+ return request->directory_count;
+}
+
+static gboolean
+has_problem (NautilusDirectory *directory, NautilusFile *file, FileCheck problem)
{
GList *p;
- for (p = files; p != NULL; p = p->next) {
- if (lacks_directory_count (p->data)) {
+ if (file != NULL) {
+ return (* problem) (file);
+ }
+
+ for (p = directory->details->files; p != NULL; p = p->next) {
+ if ((* problem) (p->data)) {
return TRUE;
}
}
+
return FALSE;
+
}
static gboolean
ready_callback_is_satisfied (NautilusDirectory *directory,
ReadyCallback *callback)
{
- if (callback->wait_for_metafile && !directory->details->metafile_read) {
+ if (callback->request.metafile && !directory->details->metafile_read) {
return FALSE;
}
- if (callback->wait_for_file_list && !directory->details->directory_loaded) {
+ if (callback->request.file_list && !directory->details->directory_loaded) {
return FALSE;
}
- if (callback->wait_for_directory_count) {
- if (callback->file == NULL) {
- if (any_lack_directory_count (directory->details->files)) {
- return FALSE;
- }
- } else {
- if (lacks_directory_count (callback->file)) {
- return FALSE;
- }
+ if (callback->request.directory_count) {
+ if (has_problem (directory, callback->file, lacks_directory_count)) {
+ return FALSE;
}
}
@@ -1181,14 +1199,14 @@ is_anyone_monitoring_file_list (NautilusDirectory *directory)
for (p = directory->details->call_when_ready_list; p != NULL; p = p->next) {
callback = p->data;
- if (callback->wait_for_file_list) {
+ if (callback->request.file_list) {
return TRUE;
}
}
for (p = directory->details->monitor_list; p != NULL; p = p->next) {
monitor = p->data;
- if (monitor->monitor_file_list) {
+ if (monitor->request.file_list) {
return TRUE;
}
}
@@ -1205,7 +1223,7 @@ is_anyone_waiting_for_metafile (NautilusDirectory *directory)
for (p = directory->details->call_when_ready_list; p != NULL; p = p->next) {
callback = p->data;
- if (callback->wait_for_metafile) {
+ if (callback->request.metafile) {
return TRUE;
}
}
@@ -1275,7 +1293,7 @@ nautilus_directory_stop_monitoring_file_list (NautilusDirectory *directory)
}
static gboolean
-is_directory_count_wanted (NautilusFile *file)
+is_wanted (NautilusFile *file, RequestCheck check_wanted)
{
GList *p;
ReadyCallback *callback;
@@ -1285,14 +1303,14 @@ is_directory_count_wanted (NautilusFile *file)
for (p = file->details->directory->details->call_when_ready_list; p != NULL; p = p->next) {
callback = p->data;
- if (callback->wait_for_directory_count
+ if ((* check_wanted) (&callback->request)
&& (callback->file == NULL || callback->file == file)) {
return TRUE;
}
}
for (p = file->details->directory->details->monitor_list; p != NULL; p = p->next) {
monitor = p->data;
- if (monitor->monitor_directory_count
+ if ((* check_wanted) (&monitor->request)
&& (monitor->file == NULL || monitor->file == file)) {
return TRUE;
}
@@ -1301,24 +1319,26 @@ is_directory_count_wanted (NautilusFile *file)
}
static NautilusFile *
-select_file_to_get_directory_count_for (NautilusDirectory *directory)
+select_needy_file (NautilusDirectory *directory,
+ FileCheck check_missing,
+ RequestCheck check_wanted)
{
GList *p, *p2;
ReadyCallback *callback;
Monitor *monitor;
NautilusFile *file;
- /* Quick out if no one wants directory count monitored. */
+ /* Quick out if no one is interested. */
for (p = directory->details->call_when_ready_list; p != NULL; p = p->next) {
callback = p->data;
- if (callback->wait_for_directory_count) {
+ if ((* check_wanted) (&callback->request)) {
break;
}
}
if (p == NULL) {
for (p = directory->details->monitor_list; p != NULL; p = p->next) {
monitor = p->data;
- if (monitor->monitor_directory_count) {
+ if ((* check_wanted) (&monitor->request)) {
break;
}
}
@@ -1327,14 +1347,14 @@ select_file_to_get_directory_count_for (NautilusDirectory *directory)
}
}
- /* Search for a file that's a directory that needs a count. */
+ /* Search for a file that has an unfulfilled request. */
for (p = directory->details->files; p != NULL; p = p->next) {
file = p->data;
- if (lacks_directory_count (file)) {
+ if ((* check_missing) (file)) {
/* Make sure that someone cares about this particular directory's count. */
for (p2 = directory->details->call_when_ready_list; p2 != NULL; p2 = p2->next) {
callback = p2->data;
- if (callback->wait_for_directory_count
+ if ((* check_wanted) (&callback->request)
&& (callback->file == NULL || callback->file == file)) {
break;
}
@@ -1344,14 +1364,14 @@ select_file_to_get_directory_count_for (NautilusDirectory *directory)
}
for (p2 = directory->details->monitor_list; p2 != NULL; p2 = p2->next) {
monitor = p2->data;
- if (monitor->monitor_directory_count
+ if ((* check_wanted) (&monitor->request)
&& (monitor->file == NULL || monitor->file == file)) {
break;
}
}
if (p2 != NULL) {
return file;
- }
+ }
}
}
return NULL;
@@ -1369,7 +1389,8 @@ start_getting_directory_counts (NautilusDirectory *directory)
if (directory->details->count_in_progress != NULL) {
g_assert (NAUTILUS_IS_FILE (directory->details->count_file));
g_assert (directory->details->count_file->details->directory == directory);
- if (is_directory_count_wanted (directory->details->count_file)) {
+ if (is_wanted (directory->details->count_file,
+ wants_directory_count)) {
return;
}
@@ -1379,7 +1400,9 @@ start_getting_directory_counts (NautilusDirectory *directory)
}
/* Figure out which file to get a count for. */
- file = select_file_to_get_directory_count_for (directory);
+ file = select_needy_file (directory,
+ lacks_directory_count,
+ wants_directory_count);
if (file == NULL) {
return;
}
diff --git a/libnautilus-private/nautilus-file-attributes.h b/libnautilus-private/nautilus-file-attributes.h
index 873c68838..4472ecbbe 100644
--- a/libnautilus-private/nautilus-file-attributes.h
+++ b/libnautilus-private/nautilus-file-attributes.h
@@ -29,7 +29,8 @@
* in changes to the attributes.
*/
-#define NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE "MIME type"
#define NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT "directory item count"
+#define NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE "MIME type"
+#define NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT "top left text"
#endif /* NAUTILUS_FILE_ATTRIBUTES_H */
diff --git a/libnautilus-private/nautilus-file-private.h b/libnautilus-private/nautilus-file-private.h
index a0ab58f5f..a1a4b2919 100644
--- a/libnautilus-private/nautilus-file-private.h
+++ b/libnautilus-private/nautilus-file-private.h
@@ -28,13 +28,21 @@
struct NautilusFileDetails
{
NautilusDirectory *directory;
+ gboolean is_gone;
GnomeVFSFileInfo *info;
+
gboolean got_directory_count;
gboolean directory_count_failed;
guint directory_count;
- gboolean is_gone;
+
+ gboolean got_top_left_text;
+ char *top_left_text;
};
+#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_CHARACTERS_PER_LINE 80
+#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_LINES 20
+#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_BYTES 1000
+
NautilusFile *nautilus_file_new (NautilusDirectory *directory,
GnomeVFSFileInfo *info);
void nautilus_file_emit_changed (NautilusFile *file);
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 725b07721..8a7d069e0 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -57,7 +57,7 @@ typedef enum {
NAUTILUS_DATE_TYPE_ACCESSED
} NautilusDateType;
-#define EMBLEM_NAME_SYMBOLIC_LINK "symbolic-link"
+#define EMBLEM_NAME_SYMBOLIC_LINK "symbolic-link"
enum {
CHANGED,
@@ -449,8 +449,7 @@ nautilus_file_rename (NautilusFile *file, const char *new_name)
g_return_val_if_fail (!nautilus_file_is_gone (file), GNOME_VFS_ERROR_BADPARAMS);
g_return_val_if_fail (nautilus_strlen (new_name) > 0, GNOME_VFS_ERROR_BADPARAMS);
- /*
- * Test the name-hasn't-changed case explicitly, for two reasons.
+ /* Test the name-hasn't-changed case explicitly, for two reasons.
* (1) gnome_vfs_move returns an error if new & old are same.
* (2) We don't want to send file-changed signal if nothing changed.
*/
@@ -1214,14 +1213,15 @@ nautilus_file_get_group_as_string (NautilusFile *file)
static char *
nautilus_file_get_mime_type_as_string_attribute (NautilusFile *file)
{
- const char *mime_string;
+ char *mime_string;
mime_string = nautilus_file_get_mime_type (file);
- if (nautilus_strlen (mime_string) > 0) {
- return g_strdup (mime_string);
+ if (mime_string != NULL) {
+ return mime_string;
}
- return g_strdup ("unknown MIME type");
+ g_free (mime_string);
+ return g_strdup (_("unknown MIME type"));
}
/**
@@ -1400,12 +1400,12 @@ nautilus_file_get_file_type (NautilusFile *file)
* Returns: The mime type.
*
**/
-const char *
+char *
nautilus_file_get_mime_type (NautilusFile *file)
{
g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
- return file->details->info->mime_type;
+ return g_strdup (file->details->info->mime_type);
}
/**
@@ -1656,6 +1656,23 @@ nautilus_file_is_executable (NautilusFile *file)
}
/**
+ * nautilus_file_get_top_left_text
+ *
+ * Get the text from the top left of the file.
+ * @file: NautilusFile representing the file in question.
+ *
+ * Returns: NULL if there is no text readable, otherwise, the text.
+ *
+ **/
+char *
+nautilus_file_get_top_left_text (NautilusFile *file)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
+
+ return NULL; /* g_strdup ("DARIN IMPLEMENT THIS"); */
+}
+
+/**
* nautilus_file_delete
*
* Delete this file.
diff --git a/libnautilus-private/nautilus-file.h b/libnautilus-private/nautilus-file.h
index 9b55f17e7..e5b1186c4 100644
--- a/libnautilus-private/nautilus-file.h
+++ b/libnautilus-private/nautilus-file.h
@@ -101,7 +101,7 @@ char * nautilus_file_get_uri (NautilusFile *
char * nautilus_file_get_mapped_uri (NautilusFile *file);
GnomeVFSFileSize nautilus_file_get_size (NautilusFile *file);
GnomeVFSFileType nautilus_file_get_file_type (NautilusFile *file);
-const char * nautilus_file_get_mime_type (NautilusFile *file);
+char * nautilus_file_get_mime_type (NautilusFile *file);
gboolean nautilus_file_is_mime_type (NautilusFile *file,
const char *mime_type);
gboolean nautilus_file_is_symbolic_link (NautilusFile *file);
@@ -114,6 +114,7 @@ GList * nautilus_file_get_keywords (NautilusFile *
void nautilus_file_set_keywords (NautilusFile *file,
GList *keywords);
GList * nautilus_file_get_emblem_names (NautilusFile *file);
+char * nautilus_file_get_top_left_text (NautilusFile *file);
/* Basic operations for file objects. */
gboolean nautilus_file_can_read (NautilusFile *file);
@@ -142,7 +143,7 @@ void nautilus_file_set_metadata (NautilusFile *
char * nautilus_file_get_string_attribute (NautilusFile *file,
const char *attribute_name);
-/* Matching with another URI*/
+/* Matching with another URI. */
gboolean nautilus_file_matches_uri (NautilusFile *file,
const char *uri);
@@ -151,6 +152,7 @@ gboolean nautilus_file_matches_uri (NautilusFile *
*/
gboolean nautilus_file_update (NautilusFile *file,
GnomeVFSFileInfo *info);
+
/* Comparing two file objects for sorting */
int nautilus_file_compare_for_sort (NautilusFile *file_1,
NautilusFile *file_2,
diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c
index 9dd760432..05f38ec77 100644
--- a/libnautilus-private/nautilus-icon-canvas-item.c
+++ b/libnautilus-private/nautilus-icon-canvas-item.c
@@ -801,7 +801,7 @@ draw_embedded_text (GnomeCanvasItem* item,
cur_y += embedded_text_font->descent + embedded_text_font->ascent;
}
- gdk_gc_unref(gc);
+ gdk_gc_unref (gc);
fclose (text_file);
}
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index 18432c801..975be5315 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -2413,7 +2413,7 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
icon->data,
&additional_text);
- end_renaming_mode(container, TRUE);
+ end_renaming_mode (container, TRUE);
font = details->label_font[details->zoom_level];
diff --git a/libnautilus-private/nautilus-icon-factory.c b/libnautilus-private/nautilus-icon-factory.c
index 730e5e685..c8377207f 100644
--- a/libnautilus-private/nautilus-icon-factory.c
+++ b/libnautilus-private/nautilus-icon-factory.c
@@ -42,16 +42,17 @@
#include <parser.h>
#include <xmlmemory.h>
-#include "librsvg/rsvg.h"
+#include <librsvg/rsvg.h>
-#include "nautilus-string.h"
#include "nautilus-default-file-icon.h"
-#include "nautilus-metadata.h"
-#include "nautilus-lib-self-check-functions.h"
-#include "nautilus-link.h"
+#include "nautilus-gdk-extensions.h"
#include "nautilus-glib-extensions.h"
#include "nautilus-global-preferences.h"
#include "nautilus-gtk-macros.h"
+#include "nautilus-lib-self-check-functions.h"
+#include "nautilus-link.h"
+#include "nautilus-metadata.h"
+#include "nautilus-string.h"
#include "nautilus-xml-extensions.h"
/* List of suffixes to search when looking for an icon file. */
@@ -435,18 +436,21 @@ nautilus_icon_factory_set_theme (const char *theme_name)
static const char *
nautilus_icon_factory_get_icon_name_for_regular_file (NautilusFile *file)
{
- const char *mime_type;
+ char *mime_type;
const char *icon_name;
mime_type = nautilus_file_get_mime_type (file);
if (mime_type != NULL) {
icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename");
+ g_free (mime_type);
if (icon_name != NULL) {
return icon_name;
}
}
- /* GNOME didn't give us a file name, so we have to fall back on special icon sets. */
+ /* gnome_vfs_mime didn't give us an icon name, so we have to
+ * fall back on default icons.
+ */
if (nautilus_file_is_executable (file)) {
return ICON_NAME_EXECUTABLE;
}
@@ -578,7 +582,10 @@ get_themed_icon_file_path (const char *theme_name,
/* Choose the file name to load, taking into account theme vs. non-theme icons. */
static char *
-get_icon_file_path (const char *name, const char* modifier, guint size_in_pixels, ArtIRect *text_rect)
+get_icon_file_path (const char *name,
+ const char* modifier,
+ guint size_in_pixels,
+ ArtIRect *text_rect)
{
gboolean use_theme_icon;
const char *theme_name;
@@ -608,9 +615,9 @@ get_icon_file_path (const char *name, const char* modifier, guint size_in_pixels
if (modifier && strlen(modifier)) {
char* modified_name = g_strdup_printf("%s-%s", name, modifier);
path = get_themed_icon_file_path (use_theme_icon ? theme_name : NULL,
- modified_name,
- size_in_pixels,
- text_rect);
+ modified_name,
+ size_in_pixels,
+ text_rect);
g_free(modified_name);
if (path)
return path;
@@ -1618,18 +1625,27 @@ nautilus_icon_factory_get_pixbuf_for_file (NautilusFile *file,
guint size_in_pixels)
{
NautilusScalableIcon *icon;
- GdkPixbuf *pixbuf;
+ GdkPixbuf *pixbuf_without_text, *pixbuf_with_text;
+ ArtIRect embedded_text_rect;
g_return_val_if_fail (file != NULL, NULL);
+ /* Get the pixbuf for this file. */
icon = nautilus_icon_factory_get_icon_for_file (file, NULL);
- pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
+ pixbuf_without_text = nautilus_icon_factory_get_pixbuf_for_icon
(icon,
size_in_pixels, size_in_pixels,
size_in_pixels, size_in_pixels,
- NULL);
+ &embedded_text_rect);
nautilus_scalable_icon_unref (icon);
- return pixbuf;
+
+ pixbuf_with_text = nautilus_icon_factory_embed_file_text
+ (pixbuf_without_text,
+ &embedded_text_rect,
+ file);
+ gdk_pixbuf_unref (pixbuf_without_text);
+
+ return pixbuf_with_text;
}
/* Convenience cover for nautilus_icon_factory_get_icon_for_file,
@@ -1657,6 +1673,142 @@ nautilus_icon_factory_get_pixmap_and_mask_for_file (NautilusFile *file,
gdk_pixbuf_unref (pixbuf);
}
+GdkPixbuf *
+nautilus_icon_factory_embed_text (GdkPixbuf *pixbuf_without_text,
+ const ArtIRect *embedded_text_rect,
+ const char *text)
+{
+ static GdkFont *font;
+
+ ArtIRect pixbuf_rect, text_rect;
+ int width, height;
+ GdkVisual *visual;
+ GdkPixmap *pixmap;
+ GdkGC *gc;
+ GdkColormap *colormap;
+ int y;
+ const char *line, *end_of_line;
+ int line_length;
+ GdkPixbuf *text_pixbuf, *text_pixbuf_with_alpha, *pixbuf_with_text;
+
+ g_return_val_if_fail (pixbuf_without_text != NULL, NULL);
+ g_return_val_if_fail (embedded_text_rect != NULL, gdk_pixbuf_ref (pixbuf_without_text));
+
+ /* Get the font the first time through. */
+ if (font == NULL) {
+ /* FIXME bugzilla.eazel.com 667: the font shouldn't be hard-wired like this */
+ font = gdk_font_load ("-bitstream-charter-medium-r-normal-*-9-*-*-*-*-*-*-*");
+ g_return_val_if_fail (font != NULL, gdk_pixbuf_ref (pixbuf_without_text));
+ }
+
+ /* Quick out for the case where there's no place to embed the
+ * text or no text.
+ */
+ if (art_irect_empty (embedded_text_rect) || nautilus_strlen (text) == 0) {
+ return gdk_pixbuf_ref (pixbuf_without_text);
+ }
+
+ /* Compute the intersection of the text rectangle with the pixbuf.
+ * This is only to prevent pathological cases from upsetting the
+ * GdkPixbuf routines. It should not happen in any normal circumstance.
+ */
+ pixbuf_rect.x0 = 0;
+ pixbuf_rect.y0 = 0;
+ pixbuf_rect.x1 = gdk_pixbuf_get_width (pixbuf_without_text);
+ pixbuf_rect.y1 = gdk_pixbuf_get_height (pixbuf_without_text);
+ art_irect_intersect (&text_rect, embedded_text_rect, &pixbuf_rect);
+
+ /* Get the system visual. I wish I could do this all in 1-bit mode,
+ * but I can't.
+ */
+ visual = gdk_visual_get_system ();
+
+ /* Allocate a GdkPixmap of the appropriate size. */
+ width = text_rect.x1 - text_rect.x0;
+ height = text_rect.y1 - text_rect.y0;
+ pixmap = gdk_pixmap_new (NULL, width, height, visual->depth);
+ gc = gdk_gc_new (pixmap);
+
+ /* Set up a white background. */
+ gdk_rgb_gc_set_foreground (gc, NAUTILUS_RGB_COLOR_WHITE);
+ gdk_draw_rectangle (pixmap, gc, TRUE, 0, 0, width, height);
+
+ /* Draw black text. */
+ gdk_rgb_gc_set_foreground (gc, NAUTILUS_RGB_COLOR_BLACK);
+ gdk_gc_set_font (gc, font);
+ line = text;
+ for (y = font->ascent;
+ y + font->descent <= height;
+ y += font->ascent + font->descent) {
+
+ /* Extract the next line of text. */
+ end_of_line = strchr (line, '\n');
+ line_length = end_of_line == NULL
+ ? strlen (line)
+ : end_of_line - line;
+
+ /* Draw the next line of text. */
+ gdk_draw_text (pixmap, font, gc, 0, y,
+ line, line_length);
+
+ /* Move on to the subsequent line. */
+ line = end_of_line == NULL
+ ? ""
+ : end_of_line + 1;
+ }
+ gdk_gc_unref (gc);
+
+ /* Convert into a GdkPixbuf with gdk_pixbuf_get_from_drawable. */
+ colormap = gdk_colormap_new (visual, FALSE);
+ text_pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, colormap,
+ 0, 0,
+ 0, 0, width, height);
+ gdk_colormap_unref (colormap);
+ gdk_pixmap_unref (pixmap);
+ text_pixbuf_with_alpha = gdk_pixbuf_add_alpha (text_pixbuf,
+ TRUE, 0xFF, 0xFF, 0xFF);
+ gdk_pixbuf_unref (text_pixbuf);
+ pixbuf_with_text = gdk_pixbuf_copy (pixbuf_without_text);
+ gdk_pixbuf_composite (text_pixbuf_with_alpha,
+ pixbuf_with_text,
+ text_rect.x0,
+ text_rect.y0,
+ width, height,
+ text_rect.x0,
+ text_rect.y0,
+ 1, 1,
+ GDK_INTERP_BILINEAR,
+ 0xFF);
+ gdk_pixbuf_unref (text_pixbuf_with_alpha);
+
+ return pixbuf_with_text;
+}
+
+GdkPixbuf *
+nautilus_icon_factory_embed_file_text (GdkPixbuf *pixbuf_without_text,
+ const ArtIRect *embedded_text_rect,
+ NautilusFile *file)
+{
+ char *text;
+ GdkPixbuf *pixbuf_with_text;
+
+ g_return_val_if_fail (pixbuf_without_text != NULL, NULL);
+ g_return_val_if_fail (embedded_text_rect != NULL, NULL);
+ g_return_val_if_fail (file == NULL || NAUTILUS_IS_FILE (file), NULL);
+
+ /* Quick out to save us getting the file's text. */
+ if (art_irect_empty (embedded_text_rect) && file == NULL) {
+ return gdk_pixbuf_ref (pixbuf_without_text);
+ }
+
+ /* Embed the text. */
+ text = nautilus_file_get_top_left_text (file);
+ pixbuf_with_text = nautilus_icon_factory_embed_text
+ (pixbuf_without_text, embedded_text_rect, text);
+ g_free (text);
+ return pixbuf_with_text;
+}
+
/* Convenience function for unrefing and then freeing an entire list. */
void
nautilus_scalable_icon_list_free (GList *icon_list)
diff --git a/libnautilus-private/nautilus-icon-factory.h b/libnautilus-private/nautilus-icon-factory.h
index 831712d1f..84545404d 100644
--- a/libnautilus-private/nautilus-icon-factory.h
+++ b/libnautilus-private/nautilus-icon-factory.h
@@ -94,7 +94,6 @@ guint nautilus_get_icon_size_for_zoom_level (Nautil
/* Choose the appropriate icon, but don't render it yet. */
NautilusScalableIcon *nautilus_icon_factory_get_icon_for_file (NautilusFile *file,
const char *modifier);
-
NautilusScalableIcon *nautilus_icon_factory_get_icon_by_name (const char *icon_name);
GList * nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file);
@@ -112,6 +111,14 @@ GdkPixbuf * nautilus_icon_factory_get_pixbuf_for_icon (Nautil
guint maximum_size_in_pixels_y,
ArtIRect *embedded_text_rectangle);
+/* Superimposing embedded text on an icon. */
+GdkPixbuf * nautilus_icon_factory_embed_text (GdkPixbuf *pixbuf_without_text,
+ const ArtIRect *embedded_text_rectangle,
+ const char *text);
+GdkPixbuf * nautilus_icon_factory_embed_file_text (GdkPixbuf *pixbuf_without_text,
+ const ArtIRect *embedded_text_rectangle,
+ NautilusFile *file);
+
/* Convenience functions for the common case where you want to choose
* and render the icon into a pixbuf all at once.
*/
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index 8461fe69c..160c26559 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -1298,7 +1298,7 @@ get_icon_property_callback (NautilusIconContainer *container,
const char *property_name,
FMIconView *icon_view)
{
- const char *mime_type;
+ char *mime_type;
g_assert (NAUTILUS_IS_ICON_CONTAINER (container));
g_assert (NAUTILUS_IS_FILE (file));
@@ -1308,8 +1308,10 @@ get_icon_property_callback (NautilusIconContainer *container,
if (strcmp (property_name, "contents_as_text") == 0) {
mime_type = nautilus_file_get_mime_type (file);
if (mime_type == NULL || nautilus_str_has_prefix (mime_type, "text/")) {
+ g_free (mime_type);
return nautilus_file_get_uri (file);
}
+ g_free (mime_type);
}
/* nothing applied, so return nothing */
diff --git a/src/file-manager/gnome-desktop.c b/src/file-manager/gnome-desktop.c
index 9be2a41e7..c8735b9d1 100644
--- a/src/file-manager/gnome-desktop.c
+++ b/src/file-manager/gnome-desktop.c
@@ -47,8 +47,10 @@ main (int argc, char *argv[])
GtkWidget *canvas;
CORBA_Environment ev;
- (void)bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
- (void)textdomain (PACKAGE);
+#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
+ bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
+ textdomain (PACKAGE);
+#endf
CORBA_exception_init(&ev);
diff --git a/src/nautilus-applicable-views.c b/src/nautilus-applicable-views.c
index bd14dc5f3..d09afd243 100644
--- a/src/nautilus-applicable-views.c
+++ b/src/nautilus-applicable-views.c
@@ -371,7 +371,7 @@ file_list_to_mime_type_hash_table (GList *files)
for (p = files; p != NULL; p = p->next) {
if (p->data != NULL) {
- mime_type = (char *) nautilus_file_get_mime_type ((NautilusFile *) p->data);
+ mime_type = nautilus_file_get_mime_type ((NautilusFile *) p->data);
if (NULL != mime_type) {
if (g_hash_table_lookup (result, mime_type) == NULL) {
@@ -381,6 +381,8 @@ file_list_to_mime_type_hash_table (GList *files)
g_hash_table_insert (result, mime_type, mime_type);
}
}
+
+ g_free (mime_type);
}
}
diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c
index 092dbd12d..d1c9609c3 100644
--- a/src/nautilus-information-panel.c
+++ b/src/nautilus-information-panel.c
@@ -743,7 +743,7 @@ nautilus_index_panel_update_buttons (NautilusIndexPanel *index_panel)
{
NautilusFile *file;
GList *command_list;
- const char *mime_type;
+ char *mime_type;
/* dispose any existing buttons */
if (index_panel->details->has_buttons) {
@@ -760,7 +760,9 @@ nautilus_index_panel_update_buttons (NautilusIndexPanel *index_panel)
/* generate a command list from the mime-type */
if (mime_type != NULL) {
- command_list = nautilus_mime_type_get_commands (mime_type);
+ command_list = nautilus_mime_type_get_commands (mime_type);
+ g_free (mime_type);
+
/* install a button for each command in the list */
if (command_list != NULL) {
add_command_buttons (index_panel, command_list);
diff --git a/src/nautilus-main.c b/src/nautilus-main.c
index c8e8164df..803b81341 100644
--- a/src/nautilus-main.c
+++ b/src/nautilus-main.c
@@ -70,8 +70,10 @@ main(int argc, char *argv[])
}
/* Initialize gettext support */
+#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
+#endif
/* Initialize the services that we use. */
CORBA_exception_init (&ev);
diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c
index 092dbd12d..d1c9609c3 100644
--- a/src/nautilus-sidebar.c
+++ b/src/nautilus-sidebar.c
@@ -743,7 +743,7 @@ nautilus_index_panel_update_buttons (NautilusIndexPanel *index_panel)
{
NautilusFile *file;
GList *command_list;
- const char *mime_type;
+ char *mime_type;
/* dispose any existing buttons */
if (index_panel->details->has_buttons) {
@@ -760,7 +760,9 @@ nautilus_index_panel_update_buttons (NautilusIndexPanel *index_panel)
/* generate a command list from the mime-type */
if (mime_type != NULL) {
- command_list = nautilus_mime_type_get_commands (mime_type);
+ command_list = nautilus_mime_type_get_commands (mime_type);
+ g_free (mime_type);
+
/* install a button for each command in the list */
if (command_list != NULL) {
add_command_buttons (index_panel, command_list);
diff --git a/src/ntl-index-panel.c b/src/ntl-index-panel.c
index 092dbd12d..d1c9609c3 100644
--- a/src/ntl-index-panel.c
+++ b/src/ntl-index-panel.c
@@ -743,7 +743,7 @@ nautilus_index_panel_update_buttons (NautilusIndexPanel *index_panel)
{
NautilusFile *file;
GList *command_list;
- const char *mime_type;
+ char *mime_type;
/* dispose any existing buttons */
if (index_panel->details->has_buttons) {
@@ -760,7 +760,9 @@ nautilus_index_panel_update_buttons (NautilusIndexPanel *index_panel)
/* generate a command list from the mime-type */
if (mime_type != NULL) {
- command_list = nautilus_mime_type_get_commands (mime_type);
+ command_list = nautilus_mime_type_get_commands (mime_type);
+ g_free (mime_type);
+
/* install a button for each command in the list */
if (command_list != NULL) {
add_command_buttons (index_panel, command_list);
diff --git a/src/ntl-main.c b/src/ntl-main.c
index c8e8164df..803b81341 100644
--- a/src/ntl-main.c
+++ b/src/ntl-main.c
@@ -70,8 +70,10 @@ main(int argc, char *argv[])
}
/* Initialize gettext support */
+#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
+#endif
/* Initialize the services that we use. */
CORBA_exception_init (&ev);
diff --git a/src/ntl-uri-map.c b/src/ntl-uri-map.c
index bd14dc5f3..d09afd243 100644
--- a/src/ntl-uri-map.c
+++ b/src/ntl-uri-map.c
@@ -371,7 +371,7 @@ file_list_to_mime_type_hash_table (GList *files)
for (p = files; p != NULL; p = p->next) {
if (p->data != NULL) {
- mime_type = (char *) nautilus_file_get_mime_type ((NautilusFile *) p->data);
+ mime_type = nautilus_file_get_mime_type ((NautilusFile *) p->data);
if (NULL != mime_type) {
if (g_hash_table_lookup (result, mime_type) == NULL) {
@@ -381,6 +381,8 @@ file_list_to_mime_type_hash_table (GList *files)
g_hash_table_insert (result, mime_type, mime_type);
}
}
+
+ g_free (mime_type);
}
}