Commit ae6d3a22 authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist
Browse files

gtk/gtkfilechooserdefault.c (shortcuts_append_home,

2004-08-14  Tor Lillqvist  <tml@iki.fi>

	* gtk/gtkfilechooserdefault.c (shortcuts_append_home,
	shortcuts_append_desktop, set_local_only)
	* gtk/gtkfilesystemwin32.c (gtk_file_system_win32_render_icon)
	* gtk/gtkpathbar.c (find_button_type, _gtk_path_bar_set_file_system):
	Guard against g_get_home_dir() returning NULL. (#150007)
parent 15ed3634
2004-08-14 Tor Lillqvist <tml@iki.fi>
* gtk/gtkfilechooserdefault.c (shortcuts_append_home,
shortcuts_append_desktop, set_local_only)
* gtk/gtkfilesystemwin32.c (gtk_file_system_win32_render_icon)
* gtk/gtkpathbar.c (find_button_type, _gtk_path_bar_set_file_system):
Guard against g_get_home_dir() returning NULL. (#150007)
Sat Aug 14 17:56:33 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkentry.c (gtk_entry_get_pixel_ranges): New function.
......
2004-08-14 Tor Lillqvist <tml@iki.fi>
* gtk/gtkfilechooserdefault.c (shortcuts_append_home,
shortcuts_append_desktop, set_local_only)
* gtk/gtkfilesystemwin32.c (gtk_file_system_win32_render_icon)
* gtk/gtkpathbar.c (find_button_type, _gtk_path_bar_set_file_system):
Guard against g_get_home_dir() returning NULL. (#150007)
Sat Aug 14 17:56:33 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkentry.c (gtk_entry_get_pixel_ranges): New function.
......
2004-08-14 Tor Lillqvist <tml@iki.fi>
* gtk/gtkfilechooserdefault.c (shortcuts_append_home,
shortcuts_append_desktop, set_local_only)
* gtk/gtkfilesystemwin32.c (gtk_file_system_win32_render_icon)
* gtk/gtkpathbar.c (find_button_type, _gtk_path_bar_set_file_system):
Guard against g_get_home_dir() returning NULL. (#150007)
Sat Aug 14 17:56:33 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkentry.c (gtk_entry_get_pixel_ranges): New function.
......
2004-08-14 Tor Lillqvist <tml@iki.fi>
* gtk/gtkfilechooserdefault.c (shortcuts_append_home,
shortcuts_append_desktop, set_local_only)
* gtk/gtkfilesystemwin32.c (gtk_file_system_win32_render_icon)
* gtk/gtkpathbar.c (find_button_type, _gtk_path_bar_set_file_system):
Guard against g_get_home_dir() returning NULL. (#150007)
Sat Aug 14 17:56:33 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkentry.c (gtk_entry_get_pixel_ranges): New function.
......
......@@ -1079,6 +1079,9 @@ shortcuts_append_home (GtkFileChooserDefault *impl)
GError *error;
home = g_get_home_dir ();
if (home == NULL)
return;
home_path = gtk_file_system_filename_to_path (impl->file_system, home);
error = NULL;
......@@ -1093,10 +1096,15 @@ shortcuts_append_home (GtkFileChooserDefault *impl)
static void
shortcuts_append_desktop (GtkFileChooserDefault *impl)
{
const char *home;
char *name;
GtkFilePath *path;
name = g_build_filename (g_get_home_dir (), "Desktop", NULL);
home = g_get_home_dir ();
if (home == NULL)
return;
name = g_build_filename (home, "Desktop", NULL);
path = gtk_file_system_filename_to_path (impl->file_system, name);
g_free (name);
......@@ -3318,7 +3326,12 @@ set_local_only (GtkFileChooserDefault *impl,
* such a situation, so we ignore errors.
*/
const gchar *home = g_get_home_dir ();
GtkFilePath *home_path = gtk_file_system_filename_to_path (impl->file_system, home);
GtkFilePath *home_path;
if (home == NULL)
return;
home_path = gtk_file_system_filename_to_path (impl->file_system, home);
_gtk_file_chooser_set_current_folder_path (GTK_FILE_CHOOSER (impl), home_path, NULL);
......
......@@ -1101,7 +1101,8 @@ gtk_file_system_win32_render_icon (GtkFileSystem *file_system,
}
else if (g_file_test (filename, G_FILE_TEST_IS_DIR))
{
if (0 == strcmp (g_get_home_dir(), filename))
const gchar *home = g_get_home_dir ();
if (home != NULL && 0 == strcmp (home, filename))
icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_HOME);
else
icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_DIRECTORY);
......
......@@ -916,11 +916,14 @@ static ButtonType
find_button_type (GtkPathBar *path_bar,
GtkFilePath *path)
{
if (! gtk_file_path_compare (path, path_bar->root_path))
if (path_bar->root_path != NULL &&
! gtk_file_path_compare (path, path_bar->root_path))
return ROOT_BUTTON;
if (! gtk_file_path_compare (path, path_bar->home_path))
if (path_bar->home_path != NULL &&
! gtk_file_path_compare (path, path_bar->home_path))
return HOME_BUTTON;
if (! gtk_file_path_compare (path, path_bar->desktop_path))
if (path_bar->desktop_path != NULL &&
! gtk_file_path_compare (path, path_bar->desktop_path))
return DESKTOP_BUTTON;
return NORMAL_BUTTON;
......@@ -1170,11 +1173,22 @@ _gtk_path_bar_set_file_system (GtkPathBar *path_bar,
path_bar->file_system = g_object_ref (file_system);
home = g_get_home_dir ();
desktop = g_build_filename (home, "Desktop", NULL);
path_bar->home_path = gtk_file_system_filename_to_path (path_bar->file_system, home);
path_bar->desktop_path = gtk_file_system_filename_to_path (path_bar->file_system, desktop);
if (home != NULL)
{
path_bar->home_path = gtk_file_system_filename_to_path (path_bar->file_system, home);
/* FIXME: Need file system backend specific way of getting the
* Desktop path.
*/
desktop = g_build_filename (home, "Desktop", NULL);
path_bar->desktop_path = gtk_file_system_filename_to_path (path_bar->file_system, desktop);
g_free (desktop);
}
else
{
path_bar->home_path = NULL;
path_bar->desktop_path = NULL;
}
path_bar->root_path = gtk_file_system_filename_to_path (path_bar->file_system, "/");
g_free (desktop);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment