1999-09-20 Federico Mena Quintero <federico@redhat.com>

* gdesktop.c (handle_recreate_default_icons): New option to
	re-create the default set of icons.

	* gdesktop-init.c (gdesktop_links_init): Create the link to the
	user's home directory here.
This commit is contained in:
Miguel de Icaza 1999-09-21 00:40:21 +00:00
parent 34dee4b9bd
commit 5309648718
5 changed files with 42 additions and 24 deletions

View File

@ -1,5 +1,11 @@
1999-09-20 Federico Mena Quintero <federico@redhat.com>
* gdesktop.c (handle_recreate_default_icons): New option to
re-create the default set of icons.
* gdesktop-init.c (gdesktop_links_init): Create the link to the
user's home directory here.
* gcorba.c (WindowFactory_get_windows_by_directory): Fill in the
sequence correctly.

View File

@ -14,6 +14,7 @@
#include "gdesktop-init.h"
#include "gprint.h"
#include "gmount.h"
#include "../vfs/vfs.h"
static void
desktop_load_init_from (const char *file)
@ -133,8 +134,16 @@ desktop_init_at (const char *dir)
void
gdesktop_links_init (void)
{
char *home_link_name;
char *dir;
/* Create the link to the user's home directory so that he will have an icon */
home_link_name = g_concat_dir_and_file (desktop_directory, _("Home directory"));
mc_symlink (gnome_user_home_dir, home_link_name);
g_free (home_link_name);
/* Create custom links */
desktop_init_at (DESKTOP_INIT_DIR);
dir = gnome_libdir_file ("desktop-links");

View File

@ -2188,8 +2188,6 @@ create_layout_info (void)
static void
create_desktop_dir (void)
{
char *home_link_name;
if (getenv ("GNOME_DESKTOP_DIR") != NULL)
desktop_directory = g_strdup (getenv ("GNOME_DESKTOP_DIR"));
else
@ -2197,21 +2195,8 @@ create_desktop_dir (void)
if (!g_file_exists (desktop_directory)) {
/* Create the directory */
mkdir (desktop_directory, 0777);
/* Create the link to the user's home directory so that he will have an icon */
home_link_name = g_concat_dir_and_file (desktop_directory, _("Home directory"));
if (mc_symlink (gnome_user_home_dir, home_link_name) != 0) {
message (FALSE,
_("Warning"),
_("Could not symlink %s to %s; "
"will not have initial home desktop icon."),
gnome_user_home_dir, home_link_name);
}
g_free (home_link_name);
/* Create the default set of icons */
gdesktop_links_init ();
@ -2551,6 +2536,13 @@ handle_new_window (GtkWidget *widget, gpointer data)
new_panel_at (gnome_user_home_dir);
}
/* Callback for rescanning the desktop directory */
static void
handle_rescan_desktop (GtkWidget *widget, gpointer data)
{
desktop_reload_icons (FALSE, 0, 0);
}
/* Rescans the mountable devices in the desktop and re-creates their icons */
void
desktop_rescan_devices (void)
@ -2567,11 +2559,18 @@ handle_rescan_devices (GtkWidget *widget, gpointer data)
desktop_rescan_devices ();
}
/* Callback for rescanning the desktop directory */
static void
handle_rescan_desktop (GtkWidget *widget, gpointer data)
void
desktop_recreate_default_icons (void)
{
desktop_reload_icons (FALSE, 0, 0);
gdesktop_links_init ();
gprint_setup_devices ();
}
/* Callback for re-creating the default icons */
static void
handle_recreate_default_icons (GtkWidget *widget, gpointer data)
{
desktop_recreate_default_icons ();
}
static void
@ -2638,8 +2637,10 @@ GnomeUIInfo desktop_popup_items[] = {
GNOMEUIINFO_SUBTREE (N_("_Arrange Icons"), desktop_arrange_icons_items),
GNOMEUIINFO_ITEM_NONE (N_("Create _New Window"), NULL, handle_new_window),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_NONE (N_("Rescan Desktop De_vices"), NULL, handle_rescan_devices),
GNOMEUIINFO_ITEM_NONE (N_("Rescan _Desktop"), NULL, handle_rescan_desktop),
GNOMEUIINFO_ITEM_NONE (N_("Rescan _Desktop Directory"), NULL, handle_rescan_desktop),
GNOMEUIINFO_ITEM_NONE (N_("Rescan De_vices"), NULL, handle_rescan_devices),
GNOMEUIINFO_ITEM_NONE (N_("Re-create Default _Icons"), NULL, handle_recreate_default_icons),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_NONE (N_("Configure _Background Image"), NULL, set_background_image),
GNOMEUIINFO_END
};

View File

@ -71,6 +71,7 @@ gboolean do_mount_umount (char *filename, gboolean is_mount);
gboolean do_eject (char *filename);
void desktop_rescan_devices (void);
void desktop_recreate_default_icons (void);
void desktop_reload_icons (int user_pos, int xpos, int ypos);
void desktop_create_url (const char *filename, const char *title, const char *url, const char *icon);

View File

@ -343,7 +343,7 @@ gnome_exit (void)
}
static void
do_desktop_rescan_devices (void)
do_rescan_desktop (void)
{
desktop_reload_icons (FALSE, 0, 0);
}
@ -461,8 +461,9 @@ GnomeUIInfo gnome_panel_about_menu [] = {
GnomeUIInfo gnome_panel_desktop_menu [] = {
GNOMEUIINFO_SUBTREE(N_("_Arrange Icons"), desktop_arrange_icons_items),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_NONE (N_("Recreate Desktop _Shortcuts"), NULL, desktop_rescan_devices),
GNOMEUIINFO_ITEM_NONE (N_("Rescan _Desktop"), NULL, do_desktop_rescan_devices),
GNOMEUIINFO_ITEM_NONE (N_("Rescan _Desktop Directory"), NULL, do_rescan_desktop),
GNOMEUIINFO_ITEM_NONE (N_("Rescan De_vices"), NULL, desktop_rescan_devices),
GNOMEUIINFO_ITEM_NONE (N_("Re-create Default _Icons"), NULL, desktop_recreate_default_icons),
GNOMEUIINFO_END
};