mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-09-13 04:51:15 +00:00
Ignore some Makefile and Makefile.in files.
* components/services/install/idl/.cvsignore: * components/services/time/idl/.cvsignore: Ignore some Makefile and Makefile.in files. * data/linksets/Makefile.am: * data/linksets/desktop.xml: Added a link set for the trash on the desktop. * icons/Makefile.am: Added a trash icon (actually a copy of the Nautilus icon right now :-). * libnautilus-extensions/nautilus-link-set.h: * libnautilus-extensions/nautilus-link-set.c: (create_new_link), (nautilus_link_set_install), (nautilus_link_set_remove): Fixed some URI-related issues and added a special case for the ~ character so we can have link sets that are for the home directory. * libnautilus-extensions/nautilus-string.c: (nautilus_str_capitalize): Got rid of the unneeded call to strlen. strlen == 0 is the slowest way I know to check for an empty string. Also check islower before calling toupper for paranoia like the calls in glib do (internally). * src/nautilus-desktop-window.c: (nautilus_desktop_window_new): Install the desktop link set when we are created. For now this installs the trash (in a fairly lame way). * src/nautilus-property-browser.c: (remove_color), (add_color_to_file), (make_properties_from_xml_node), (nautilus_property_browser_update_contents): Changed code to not reference "childs" directly so it's easy to switch to a new version of gnome-xml. * test/.cvsignore: Ignore test-nautilus-mime-actions-set.
This commit is contained in:
parent
8e29ec7faf
commit
a51a8ee58c
39
ChangeLog
39
ChangeLog
|
@ -1,3 +1,41 @@
|
||||||
|
2000-06-02 Darin Adler <darin@eazel.com>
|
||||||
|
|
||||||
|
* components/services/install/idl/.cvsignore:
|
||||||
|
* components/services/time/idl/.cvsignore:
|
||||||
|
Ignore some Makefile and Makefile.in files.
|
||||||
|
|
||||||
|
* data/linksets/Makefile.am:
|
||||||
|
* data/linksets/desktop.xml:
|
||||||
|
Added a link set for the trash on the desktop.
|
||||||
|
|
||||||
|
* icons/Makefile.am:
|
||||||
|
Added a trash icon (actually a copy of the Nautilus icon right
|
||||||
|
now :-).
|
||||||
|
|
||||||
|
* libnautilus-extensions/nautilus-link-set.h:
|
||||||
|
* libnautilus-extensions/nautilus-link-set.c: (create_new_link),
|
||||||
|
(nautilus_link_set_install), (nautilus_link_set_remove):
|
||||||
|
Fixed some URI-related issues and added a special case for the ~
|
||||||
|
character so we can have link sets that are for the home directory.
|
||||||
|
|
||||||
|
* libnautilus-extensions/nautilus-string.c:
|
||||||
|
(nautilus_str_capitalize): Got rid of the unneeded call to strlen.
|
||||||
|
strlen == 0 is the slowest way I know to check for an empty string.
|
||||||
|
Also check islower before calling toupper for paranoia like the
|
||||||
|
calls in glib do (internally).
|
||||||
|
|
||||||
|
* src/nautilus-desktop-window.c: (nautilus_desktop_window_new):
|
||||||
|
Install the desktop link set when we are created. For now this
|
||||||
|
installs the trash (in a fairly lame way).
|
||||||
|
|
||||||
|
* src/nautilus-property-browser.c: (remove_color),
|
||||||
|
(add_color_to_file), (make_properties_from_xml_node),
|
||||||
|
(nautilus_property_browser_update_contents):
|
||||||
|
Changed code to not reference "childs" directly so it's easy to
|
||||||
|
switch to a new version of gnome-xml.
|
||||||
|
|
||||||
|
* test/.cvsignore: Ignore test-nautilus-mime-actions-set.
|
||||||
|
|
||||||
2000-06-02 Ramiro Estrugo <ramiro@eazel.com>
|
2000-06-02 Ramiro Estrugo <ramiro@eazel.com>
|
||||||
|
|
||||||
Task 518. Support for changing preferecens individually
|
Task 518. Support for changing preferecens individually
|
||||||
|
@ -122,7 +160,6 @@
|
||||||
|
|
||||||
It would be a lot nicer it the contents updated on the fly instead
|
It would be a lot nicer it the contents updated on the fly instead
|
||||||
of rebuilding the whole thing. I can do that later.
|
of rebuilding the whole thing. I can do that later.
|
||||||
|
|
||||||
|
|
||||||
2000-06-02 Pavel Cisler <pavel@eazel.com>
|
2000-06-02 Pavel Cisler <pavel@eazel.com>
|
||||||
|
|
||||||
|
|
2
components/services/install/idl/.cvsignore
Normal file
2
components/services/install/idl/.cvsignore
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
2
components/services/time/idl/.cvsignore
Normal file
2
components/services/time/idl/.cvsignore
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
|
@ -4,6 +4,7 @@ linkdir = $(datadir)/nautilus/linksets
|
||||||
|
|
||||||
link_DATA = \
|
link_DATA = \
|
||||||
apps.xml \
|
apps.xml \
|
||||||
|
desktop.xml \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
EXTRA_DIST = $(link_DATA)
|
EXTRA_DIST = $(link_DATA)
|
||||||
|
|
4
data/linksets/desktop.xml
Normal file
4
data/linksets/desktop.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<linkset name="Desktop">
|
||||||
|
<link name="Trash" image="trash.png" uri="~/Trash"/>
|
||||||
|
</linkset>
|
|
@ -141,6 +141,7 @@ icon_DATA =\
|
||||||
rightarrow.png \
|
rightarrow.png \
|
||||||
tableft.png \
|
tableft.png \
|
||||||
tabright.png \
|
tabright.png \
|
||||||
|
trash.png \
|
||||||
uparrow.png \
|
uparrow.png \
|
||||||
zoom.png \
|
zoom.png \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
BIN
icons/trash.png
Normal file
BIN
icons/trash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -23,32 +23,34 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include "nautilus-link-set.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <parser.h>
|
#include <parser.h>
|
||||||
#include <xmlmemory.h>
|
#include <xmlmemory.h>
|
||||||
|
|
||||||
|
#include <libgnomevfs/gnome-vfs-utils.h>
|
||||||
|
|
||||||
#include "nautilus-file.h"
|
#include "nautilus-file.h"
|
||||||
#include "nautilus-link.h"
|
#include "nautilus-link.h"
|
||||||
#include "nautilus-metadata.h"
|
#include "nautilus-metadata.h"
|
||||||
#include "nautilus-string.h"
|
#include "nautilus-string.h"
|
||||||
#include "nautilus-xml-extensions.h"
|
#include "nautilus-xml-extensions.h"
|
||||||
#include "nautilus-global-preferences.h"
|
#include "nautilus-global-preferences.h"
|
||||||
#include "nautilus-widgets/nautilus-preferences.h"
|
#include <nautilus-widgets/nautilus-preferences.h>
|
||||||
|
|
||||||
#include "nautilus-link-set.h"
|
|
||||||
|
|
||||||
/* routine to create a new .link file in the specified directory */
|
/* routine to create a new .link file in the specified directory */
|
||||||
static void
|
static gboolean
|
||||||
create_new_link(const char *directory_path, const char *name, const char *image, const char *uri)
|
create_new_link (const char *directory_path, const char *name, const char *image, const char *uri)
|
||||||
{
|
{
|
||||||
xmlDocPtr output_document;
|
xmlDocPtr output_document;
|
||||||
xmlNodePtr root_node;
|
xmlNodePtr root_node;
|
||||||
char *file_name;
|
char *file_name;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
/* create a new xml document */
|
/* create a new xml document */
|
||||||
output_document = xmlNewDoc ("1.0");
|
output_document = xmlNewDoc ("1.0");
|
||||||
|
|
||||||
/* add the root node to the output document */
|
/* add the root node to the output document */
|
||||||
root_node = xmlNewDocNode (output_document, NULL, "NAUTILUS_OBJECT", NULL);
|
root_node = xmlNewDocNode (output_document, NULL, "NAUTILUS_OBJECT", NULL);
|
||||||
|
@ -57,12 +59,14 @@ create_new_link(const char *directory_path, const char *name, const char *image,
|
||||||
xmlSetProp (root_node, "CUSTOM_ICON", image);
|
xmlSetProp (root_node, "CUSTOM_ICON", image);
|
||||||
xmlSetProp (root_node, "LINK", uri);
|
xmlSetProp (root_node, "LINK", uri);
|
||||||
|
|
||||||
/* all done , so save the xml document as a link file */
|
/* all done, so save the xml document as a link file */
|
||||||
file_name = g_strdup_printf("%s/%s.link", directory_path, name);
|
file_name = g_strdup_printf ("%s/%s.link", directory_path, name);
|
||||||
result = xmlSaveFile(file_name, output_document);
|
result = xmlSaveFile (file_name, output_document);
|
||||||
g_free(file_name);
|
g_free (file_name);
|
||||||
|
|
||||||
xmlFreeDoc(output_document);
|
xmlFreeDoc (output_document);
|
||||||
|
|
||||||
|
return result > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* install a link set into the specified directory */
|
/* install a link set into the specified directory */
|
||||||
|
@ -70,54 +74,62 @@ create_new_link(const char *directory_path, const char *name, const char *image,
|
||||||
gboolean
|
gboolean
|
||||||
nautilus_link_set_install (const char *directory_path, const char *link_set_name)
|
nautilus_link_set_install (const char *directory_path, const char *link_set_name)
|
||||||
{
|
{
|
||||||
NautilusFile *file;
|
|
||||||
xmlDocPtr document;
|
xmlDocPtr document;
|
||||||
xmlNodePtr cur_node;
|
xmlNodePtr node;
|
||||||
char *temp_str, *link_set_path;
|
char *temp_str, *link_set_path;
|
||||||
char *link_name, *image_name, *uri_name;
|
char *link_name, *image_name, *uri, *full_uri, *home_in_uri_format;
|
||||||
|
|
||||||
file = nautilus_file_get(directory_path);
|
|
||||||
if (file == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* make sure the target is a writable directory */
|
|
||||||
|
|
||||||
if (!nautilus_file_is_directory(file) || !nautilus_file_can_write(file)) {
|
|
||||||
nautilus_file_unref(file);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* compose the path of the link set file */
|
/* compose the path of the link set file */
|
||||||
temp_str = g_strdup_printf ("nautilus/linksets/%s.xml", link_set_name);
|
temp_str = g_strdup_printf ("nautilus/linksets/%s.xml", link_set_name);
|
||||||
link_set_path = gnome_datadir_file (temp_str);
|
link_set_path = gnome_datadir_file (temp_str);
|
||||||
|
g_free (temp_str);
|
||||||
|
|
||||||
/* load and parse the linkset xml file */
|
/* load and parse the linkset xml file */
|
||||||
document = xmlParseFile (link_set_path);
|
document = xmlParseFile (link_set_path);
|
||||||
g_free(temp_str);
|
g_free (link_set_path);
|
||||||
g_free(link_set_path);
|
if (document == NULL) {
|
||||||
|
|
||||||
if (document == NULL)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* loop through the entries, generating .link files */
|
/* loop through the entries, generating .link files */
|
||||||
for (cur_node = document->root->childs; cur_node != NULL; cur_node = cur_node->next) {
|
for (node = nautilus_xml_get_children (xmlDocGetRootElement (document));
|
||||||
if (strcmp(cur_node->name, "link") == 0) {
|
node != NULL; node = node->next) {
|
||||||
link_name = xmlGetProp (cur_node, "name");
|
if (strcmp (node->name, "link") == 0) {
|
||||||
image_name = xmlGetProp (cur_node, "image");
|
link_name = xmlGetProp (node, "name");
|
||||||
uri_name = xmlGetProp (cur_node, "uri");
|
image_name = xmlGetProp (node, "image");
|
||||||
create_new_link(directory_path, link_name, image_name, uri_name);
|
uri = xmlGetProp (node, "uri");
|
||||||
|
|
||||||
|
/* Expand special URIs */
|
||||||
|
full_uri = NULL;
|
||||||
|
if (uri[0] == '~') {
|
||||||
|
home_in_uri_format = gnome_vfs_escape_string
|
||||||
|
(g_get_home_dir (), GNOME_VFS_URI_UNSAFE_PATH);
|
||||||
|
full_uri = g_strconcat ("file://", home_in_uri_format, uri + 1, NULL);
|
||||||
|
g_free (home_in_uri_format);
|
||||||
|
uri = full_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!create_new_link (directory_path, link_name, image_name, uri)) {
|
||||||
|
g_free (full_uri);
|
||||||
|
xmlFreeDoc (document);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (full_uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all done so return TRUE */
|
xmlFreeDoc (document);
|
||||||
xmlFreeDoc(document);
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
|
/* all done so return TRUE */
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove a link set from the specified directory */
|
/* remove a link set from the specified directory */
|
||||||
|
/* FIXME: Not implemented. */
|
||||||
|
#if 0
|
||||||
void
|
void
|
||||||
nautilus_link_set_remove (const char *directory_uri, const char *link_set_name)
|
nautilus_link_set_remove (const char *directory_uri, const char *link_set_name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -27,8 +27,9 @@
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
gboolean nautilus_link_set_install (const char *file_uri, const char *link_set_name);
|
gboolean nautilus_link_set_install (const char *directory_path,
|
||||||
void nautilus_link_set_remove (const char *file_uri, const char *link_set_name);
|
const char *link_set_name);
|
||||||
|
void nautilus_link_set_remove (const char *directory_path,
|
||||||
|
const char *link_set_name);
|
||||||
|
|
||||||
|
#endif /* NAUTILUS_LINK_SET_H */
|
||||||
#endif /* NAUTILUS_LINK_H */
|
|
||||||
|
|
|
@ -353,8 +353,8 @@ nautilus_str_capitalize (const char *string)
|
||||||
|
|
||||||
capitalized = g_strdup (string);
|
capitalized = g_strdup (string);
|
||||||
|
|
||||||
if (strlen (string) > 0) {
|
if (islower (capitalized[0])) {
|
||||||
capitalized[0] = toupper (string[0]);
|
capitalized[0] = toupper (capitalized[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return capitalized;
|
return capitalized;
|
||||||
|
|
|
@ -23,32 +23,34 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include "nautilus-link-set.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <parser.h>
|
#include <parser.h>
|
||||||
#include <xmlmemory.h>
|
#include <xmlmemory.h>
|
||||||
|
|
||||||
|
#include <libgnomevfs/gnome-vfs-utils.h>
|
||||||
|
|
||||||
#include "nautilus-file.h"
|
#include "nautilus-file.h"
|
||||||
#include "nautilus-link.h"
|
#include "nautilus-link.h"
|
||||||
#include "nautilus-metadata.h"
|
#include "nautilus-metadata.h"
|
||||||
#include "nautilus-string.h"
|
#include "nautilus-string.h"
|
||||||
#include "nautilus-xml-extensions.h"
|
#include "nautilus-xml-extensions.h"
|
||||||
#include "nautilus-global-preferences.h"
|
#include "nautilus-global-preferences.h"
|
||||||
#include "nautilus-widgets/nautilus-preferences.h"
|
#include <nautilus-widgets/nautilus-preferences.h>
|
||||||
|
|
||||||
#include "nautilus-link-set.h"
|
|
||||||
|
|
||||||
/* routine to create a new .link file in the specified directory */
|
/* routine to create a new .link file in the specified directory */
|
||||||
static void
|
static gboolean
|
||||||
create_new_link(const char *directory_path, const char *name, const char *image, const char *uri)
|
create_new_link (const char *directory_path, const char *name, const char *image, const char *uri)
|
||||||
{
|
{
|
||||||
xmlDocPtr output_document;
|
xmlDocPtr output_document;
|
||||||
xmlNodePtr root_node;
|
xmlNodePtr root_node;
|
||||||
char *file_name;
|
char *file_name;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
/* create a new xml document */
|
/* create a new xml document */
|
||||||
output_document = xmlNewDoc ("1.0");
|
output_document = xmlNewDoc ("1.0");
|
||||||
|
|
||||||
/* add the root node to the output document */
|
/* add the root node to the output document */
|
||||||
root_node = xmlNewDocNode (output_document, NULL, "NAUTILUS_OBJECT", NULL);
|
root_node = xmlNewDocNode (output_document, NULL, "NAUTILUS_OBJECT", NULL);
|
||||||
|
@ -57,12 +59,14 @@ create_new_link(const char *directory_path, const char *name, const char *image,
|
||||||
xmlSetProp (root_node, "CUSTOM_ICON", image);
|
xmlSetProp (root_node, "CUSTOM_ICON", image);
|
||||||
xmlSetProp (root_node, "LINK", uri);
|
xmlSetProp (root_node, "LINK", uri);
|
||||||
|
|
||||||
/* all done , so save the xml document as a link file */
|
/* all done, so save the xml document as a link file */
|
||||||
file_name = g_strdup_printf("%s/%s.link", directory_path, name);
|
file_name = g_strdup_printf ("%s/%s.link", directory_path, name);
|
||||||
result = xmlSaveFile(file_name, output_document);
|
result = xmlSaveFile (file_name, output_document);
|
||||||
g_free(file_name);
|
g_free (file_name);
|
||||||
|
|
||||||
xmlFreeDoc(output_document);
|
xmlFreeDoc (output_document);
|
||||||
|
|
||||||
|
return result > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* install a link set into the specified directory */
|
/* install a link set into the specified directory */
|
||||||
|
@ -70,54 +74,62 @@ create_new_link(const char *directory_path, const char *name, const char *image,
|
||||||
gboolean
|
gboolean
|
||||||
nautilus_link_set_install (const char *directory_path, const char *link_set_name)
|
nautilus_link_set_install (const char *directory_path, const char *link_set_name)
|
||||||
{
|
{
|
||||||
NautilusFile *file;
|
|
||||||
xmlDocPtr document;
|
xmlDocPtr document;
|
||||||
xmlNodePtr cur_node;
|
xmlNodePtr node;
|
||||||
char *temp_str, *link_set_path;
|
char *temp_str, *link_set_path;
|
||||||
char *link_name, *image_name, *uri_name;
|
char *link_name, *image_name, *uri, *full_uri, *home_in_uri_format;
|
||||||
|
|
||||||
file = nautilus_file_get(directory_path);
|
|
||||||
if (file == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* make sure the target is a writable directory */
|
|
||||||
|
|
||||||
if (!nautilus_file_is_directory(file) || !nautilus_file_can_write(file)) {
|
|
||||||
nautilus_file_unref(file);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* compose the path of the link set file */
|
/* compose the path of the link set file */
|
||||||
temp_str = g_strdup_printf ("nautilus/linksets/%s.xml", link_set_name);
|
temp_str = g_strdup_printf ("nautilus/linksets/%s.xml", link_set_name);
|
||||||
link_set_path = gnome_datadir_file (temp_str);
|
link_set_path = gnome_datadir_file (temp_str);
|
||||||
|
g_free (temp_str);
|
||||||
|
|
||||||
/* load and parse the linkset xml file */
|
/* load and parse the linkset xml file */
|
||||||
document = xmlParseFile (link_set_path);
|
document = xmlParseFile (link_set_path);
|
||||||
g_free(temp_str);
|
g_free (link_set_path);
|
||||||
g_free(link_set_path);
|
if (document == NULL) {
|
||||||
|
|
||||||
if (document == NULL)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* loop through the entries, generating .link files */
|
/* loop through the entries, generating .link files */
|
||||||
for (cur_node = document->root->childs; cur_node != NULL; cur_node = cur_node->next) {
|
for (node = nautilus_xml_get_children (xmlDocGetRootElement (document));
|
||||||
if (strcmp(cur_node->name, "link") == 0) {
|
node != NULL; node = node->next) {
|
||||||
link_name = xmlGetProp (cur_node, "name");
|
if (strcmp (node->name, "link") == 0) {
|
||||||
image_name = xmlGetProp (cur_node, "image");
|
link_name = xmlGetProp (node, "name");
|
||||||
uri_name = xmlGetProp (cur_node, "uri");
|
image_name = xmlGetProp (node, "image");
|
||||||
create_new_link(directory_path, link_name, image_name, uri_name);
|
uri = xmlGetProp (node, "uri");
|
||||||
|
|
||||||
|
/* Expand special URIs */
|
||||||
|
full_uri = NULL;
|
||||||
|
if (uri[0] == '~') {
|
||||||
|
home_in_uri_format = gnome_vfs_escape_string
|
||||||
|
(g_get_home_dir (), GNOME_VFS_URI_UNSAFE_PATH);
|
||||||
|
full_uri = g_strconcat ("file://", home_in_uri_format, uri + 1, NULL);
|
||||||
|
g_free (home_in_uri_format);
|
||||||
|
uri = full_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!create_new_link (directory_path, link_name, image_name, uri)) {
|
||||||
|
g_free (full_uri);
|
||||||
|
xmlFreeDoc (document);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (full_uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all done so return TRUE */
|
xmlFreeDoc (document);
|
||||||
xmlFreeDoc(document);
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
|
/* all done so return TRUE */
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove a link set from the specified directory */
|
/* remove a link set from the specified directory */
|
||||||
|
/* FIXME: Not implemented. */
|
||||||
|
#if 0
|
||||||
void
|
void
|
||||||
nautilus_link_set_remove (const char *directory_uri, const char *link_set_name)
|
nautilus_link_set_remove (const char *directory_uri, const char *link_set_name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -27,8 +27,9 @@
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
gboolean nautilus_link_set_install (const char *file_uri, const char *link_set_name);
|
gboolean nautilus_link_set_install (const char *directory_path,
|
||||||
void nautilus_link_set_remove (const char *file_uri, const char *link_set_name);
|
const char *link_set_name);
|
||||||
|
void nautilus_link_set_remove (const char *directory_path,
|
||||||
|
const char *link_set_name);
|
||||||
|
|
||||||
|
#endif /* NAUTILUS_LINK_SET_H */
|
||||||
#endif /* NAUTILUS_LINK_H */
|
|
||||||
|
|
|
@ -353,8 +353,8 @@ nautilus_str_capitalize (const char *string)
|
||||||
|
|
||||||
capitalized = g_strdup (string);
|
capitalized = g_strdup (string);
|
||||||
|
|
||||||
if (strlen (string) > 0) {
|
if (islower (capitalized[0])) {
|
||||||
capitalized[0] = toupper (string[0]);
|
capitalized[0] = toupper (capitalized[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return capitalized;
|
return capitalized;
|
||||||
|
|
|
@ -28,7 +28,9 @@
|
||||||
#include <libnautilus-extensions/nautilus-gtk-macros.h>
|
#include <libnautilus-extensions/nautilus-gtk-macros.h>
|
||||||
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
|
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
|
||||||
#include <libnautilus-extensions/nautilus-file-utilities.h>
|
#include <libnautilus-extensions/nautilus-file-utilities.h>
|
||||||
|
#include <libnautilus-extensions/nautilus-link-set.h>
|
||||||
#include <libgnomeui/gnome-winhints.h>
|
#include <libgnomeui/gnome-winhints.h>
|
||||||
|
#include <libgnomevfs/gnome-vfs-utils.h>
|
||||||
|
|
||||||
struct NautilusDesktopWindowDetails {
|
struct NautilusDesktopWindowDetails {
|
||||||
GList *unref_list;
|
GList *unref_list;
|
||||||
|
@ -83,7 +85,9 @@ NautilusDesktopWindow *
|
||||||
nautilus_desktop_window_new (NautilusApp *application)
|
nautilus_desktop_window_new (NautilusApp *application)
|
||||||
{
|
{
|
||||||
NautilusDesktopWindow *window;
|
NautilusDesktopWindow *window;
|
||||||
char *desktop_directory;
|
const char *desktop_directory_path;
|
||||||
|
char *desktop_directory_path_in_uri_format;
|
||||||
|
char *desktop_directory_uri;
|
||||||
|
|
||||||
window = NAUTILUS_DESKTOP_WINDOW
|
window = NAUTILUS_DESKTOP_WINDOW
|
||||||
(gtk_object_new (nautilus_desktop_window_get_type(),
|
(gtk_object_new (nautilus_desktop_window_get_type(),
|
||||||
|
@ -91,12 +95,29 @@ nautilus_desktop_window_new (NautilusApp *application)
|
||||||
"app_id", "nautilus",
|
"app_id", "nautilus",
|
||||||
NULL));
|
NULL));
|
||||||
|
|
||||||
|
desktop_directory_path = nautilus_get_desktop_directory ();
|
||||||
|
|
||||||
|
/* Create the trash.
|
||||||
|
* We can do this at some other time if we want, but this
|
||||||
|
* might be a good time.
|
||||||
|
*/
|
||||||
|
nautilus_link_set_install (desktop_directory_path, "desktop");
|
||||||
|
|
||||||
|
/* FIXME: This little ditty is just the way you convert a
|
||||||
|
* local path to a file: URI. Should be a utility somewhere
|
||||||
|
* to do the two steps at once.
|
||||||
|
*/
|
||||||
|
desktop_directory_path_in_uri_format = gnome_vfs_escape_string
|
||||||
|
(desktop_directory_path, GNOME_VFS_URI_UNSAFE_PATH);
|
||||||
|
desktop_directory_uri = g_strconcat
|
||||||
|
("file://", desktop_directory_path_in_uri_format, NULL);
|
||||||
|
g_free (desktop_directory_path_in_uri_format);
|
||||||
|
|
||||||
/* Point window at the desktop folder.
|
/* Point window at the desktop folder.
|
||||||
* Note that nautilus_desktop_window_initialize is too early to do this.
|
* Note that nautilus_desktop_window_initialize is too early to do this.
|
||||||
*/
|
*/
|
||||||
desktop_directory = g_strconcat ("file://", nautilus_get_desktop_directory (), NULL);
|
nautilus_window_goto_uri (NAUTILUS_WINDOW (window), desktop_directory_uri);
|
||||||
nautilus_window_goto_uri (NAUTILUS_WINDOW (window), desktop_directory);
|
g_free (desktop_directory_uri);
|
||||||
g_free (desktop_directory);
|
|
||||||
|
|
||||||
gtk_widget_show (GTK_WIDGET (window));
|
gtk_widget_show (GTK_WIDGET (window));
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include <libnautilus-extensions/nautilus-gnome-extensions.h>
|
#include <libnautilus-extensions/nautilus-gnome-extensions.h>
|
||||||
#include <libnautilus-extensions/nautilus-metadata.h>
|
#include <libnautilus-extensions/nautilus-metadata.h>
|
||||||
#include <libnautilus-extensions/nautilus-string.h>
|
#include <libnautilus-extensions/nautilus-string.h>
|
||||||
|
#include <libnautilus-extensions/nautilus-xml-extensions.h>
|
||||||
|
|
||||||
struct NautilusPropertyBrowserDetails {
|
struct NautilusPropertyBrowserDetails {
|
||||||
GtkVBox *container;
|
GtkVBox *container;
|
||||||
|
@ -513,16 +514,18 @@ remove_color(NautilusPropertyBrowser *property_browser, const char* color_value)
|
||||||
xmlDocPtr document = xmlParseFile (xml_path);
|
xmlDocPtr document = xmlParseFile (xml_path);
|
||||||
g_free(xml_path);
|
g_free(xml_path);
|
||||||
|
|
||||||
if (document == NULL)
|
if (document == NULL) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* find the colors category */
|
/* find the colors category */
|
||||||
for (cur_node = document->root->childs; cur_node != NULL; cur_node = cur_node->next) {
|
for (cur_node = nautilus_xml_get_children (xmlDocGetRootElement (document));
|
||||||
|
cur_node != NULL; cur_node = cur_node->next) {
|
||||||
if (strcmp(cur_node->name, "category") == 0) {
|
if (strcmp(cur_node->name, "category") == 0) {
|
||||||
char* category_name = xmlGetProp (cur_node, "name");
|
char* category_name = xmlGetProp (cur_node, "name");
|
||||||
if (strcmp(category_name, "colors") == 0) {
|
if (strcmp(category_name, "colors") == 0) {
|
||||||
/* loop through the colors to find one that matches */
|
/* loop through the colors to find one that matches */
|
||||||
xmlNodePtr color_node = cur_node->childs;
|
xmlNodePtr color_node = nautilus_xml_get_children (cur_node);
|
||||||
while (color_node != NULL) {
|
while (color_node != NULL) {
|
||||||
char* color_content = xmlNodeGetContent(color_node);
|
char* color_content = xmlNodeGetContent(color_node);
|
||||||
if (color_content && !strcmp(color_content, color_value)) {
|
if (color_content && !strcmp(color_content, color_value)) {
|
||||||
|
@ -852,8 +855,8 @@ add_color_to_file(NautilusPropertyBrowser *property_browser, const char *color_s
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find the colors category */
|
/* find the colors category */
|
||||||
cur_node = document->root->childs;
|
for (cur_node = nautilus_xml_get_children (xmlDocGetRootElement (document));
|
||||||
for (cur_node = document->root->childs; cur_node != NULL; cur_node = cur_node->next) {
|
cur_node != NULL; cur_node = cur_node->next) {
|
||||||
if (strcmp(cur_node->name, "category") == 0) {
|
if (strcmp(cur_node->name, "category") == 0) {
|
||||||
char* category_name = xmlGetProp (cur_node, "name");
|
char* category_name = xmlGetProp (cur_node, "name");
|
||||||
if (strcmp(category_name, "colors") == 0) {
|
if (strcmp(category_name, "colors") == 0) {
|
||||||
|
@ -1267,15 +1270,16 @@ make_properties_from_directory(NautilusPropertyBrowser *property_browser, const
|
||||||
/* for now, we just handle color nodes */
|
/* for now, we just handle color nodes */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
make_properties_from_xml_node(NautilusPropertyBrowser *property_browser, xmlNodePtr node)
|
make_properties_from_xml_node (NautilusPropertyBrowser *property_browser, xmlNodePtr node)
|
||||||
{
|
{
|
||||||
xmlNode *current_node = node->childs;
|
xmlNode *current_node;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
gboolean local_only = property_browser->details->remove_mode;
|
gboolean local_only = property_browser->details->remove_mode;
|
||||||
|
|
||||||
property_browser->details->has_local = FALSE;
|
property_browser->details->has_local = FALSE;
|
||||||
|
|
||||||
while (current_node != NULL) {
|
for (current_node = nautilus_xml_get_children (node);
|
||||||
|
current_node != NULL; current_node = current_node->next) {
|
||||||
NautilusBackground *background;
|
NautilusBackground *background;
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
char* color_str = xmlNodeGetContent(current_node);
|
char* color_str = xmlNodeGetContent(current_node);
|
||||||
|
@ -1312,8 +1316,6 @@ make_properties_from_xml_node(NautilusPropertyBrowser *property_browser, xmlNode
|
||||||
|
|
||||||
add_to_content_table(property_browser, frame, index++, 12);
|
add_to_content_table(property_browser, frame, index++, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
current_node = current_node->next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1424,8 +1426,8 @@ nautilus_property_browser_update_contents (NautilusPropertyBrowser *property_bro
|
||||||
gtk_widget_show (GTK_WIDGET (property_browser->details->content_table));
|
gtk_widget_show (GTK_WIDGET (property_browser->details->content_table));
|
||||||
|
|
||||||
/* iterate through the xml file to generate the widgets */
|
/* iterate through the xml file to generate the widgets */
|
||||||
cur_node = document->root->childs;
|
for (cur_node = nautilus_xml_get_children (xmlDocGetRootElement (document));
|
||||||
while (cur_node != NULL) {
|
cur_node != NULL; cur_node = cur_node->next) {
|
||||||
if (strcmp(cur_node->name, "category") == 0) {
|
if (strcmp(cur_node->name, "category") == 0) {
|
||||||
char* category_name = xmlGetProp (cur_node, "name");
|
char* category_name = xmlGetProp (cur_node, "name");
|
||||||
char* category_image = xmlGetProp (cur_node, "image");
|
char* category_image = xmlGetProp (cur_node, "image");
|
||||||
|
@ -1442,13 +1444,10 @@ nautilus_property_browser_update_contents (NautilusPropertyBrowser *property_bro
|
||||||
make_category_link(property_browser, category_name, category_image, index++);
|
make_category_link(property_browser, category_name, category_image, index++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cur_node = cur_node->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* release the xml document and we're done */
|
/* release the xml document and we're done */
|
||||||
if (document) {
|
xmlFreeDoc (document);
|
||||||
xmlFreeDoc(document);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update the title and button */
|
/* update the title and button */
|
||||||
|
|
||||||
|
|
|
@ -3,3 +3,4 @@
|
||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
test-nautilus-mime-actions
|
test-nautilus-mime-actions
|
||||||
|
test-nautilus-mime-actions-set
|
||||||
|
|
Loading…
Reference in a new issue