Commit cacfdbc2 authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist

Use g_get_host_name().

2005-07-08  Tor Lillqvist  <tml@novell.com>

	* gtk/gtkfilesel.c: Use g_get_host_name().
parent 2f4440ef
2005-07-08 Tor Lillqvist <tml@novell.com>
* gtk/gtkfilesel.c: Use g_get_host_name().
2005-07-07 Matthias Clasen <mclasen@redhat.com> 2005-07-07 Matthias Clasen <mclasen@redhat.com>
* configure.in: Add -DHPPEX -DSHMLINK to CFLAGS for HP-UX. * configure.in: Add -DHPPEX -DSHMLINK to CFLAGS for HP-UX.
......
2005-07-08 Tor Lillqvist <tml@novell.com>
* gtk/gtkfilesel.c: Use g_get_host_name().
2005-07-07 Matthias Clasen <mclasen@redhat.com> 2005-07-07 Matthias Clasen <mclasen@redhat.com>
* configure.in: Add -DHPPEX -DSHMLINK to CFLAGS for HP-UX. * configure.in: Add -DHPPEX -DSHMLINK to CFLAGS for HP-UX.
......
2005-07-08 Tor Lillqvist <tml@novell.com>
* gtk/gtkfilesel.c: Use g_get_host_name().
2005-07-07 Matthias Clasen <mclasen@redhat.com> 2005-07-07 Matthias Clasen <mclasen@redhat.com>
* configure.in: Add -DHPPEX -DSHMLINK to CFLAGS for HP-UX. * configure.in: Add -DHPPEX -DSHMLINK to CFLAGS for HP-UX.
......
...@@ -51,9 +51,6 @@ ...@@ -51,9 +51,6 @@
#include <windows.h> #include <windows.h>
#undef STRICT #undef STRICT
#endif /* G_PLATFORM_WIN32 */ #endif /* G_PLATFORM_WIN32 */
#ifdef G_OS_WIN32
#include <winsock.h> /* For gethostname */
#endif
#include "gdk/gdkkeysyms.h" #include "gdk/gdkkeysyms.h"
#include "gtkbutton.h" #include "gtkbutton.h"
...@@ -940,8 +937,7 @@ filenames_dropped (GtkWidget *widget, ...@@ -940,8 +937,7 @@ filenames_dropped (GtkWidget *widget,
char *uri = NULL; char *uri = NULL;
char *filename = NULL; char *filename = NULL;
char *hostname; char *hostname;
char this_hostname[257]; const char *this_hostname;
int res;
GError *error = NULL; GError *error = NULL;
if (!selection_data->data) if (!selection_data->data)
...@@ -963,11 +959,10 @@ filenames_dropped (GtkWidget *widget, ...@@ -963,11 +959,10 @@ filenames_dropped (GtkWidget *widget,
return; return;
} }
res = gethostname (this_hostname, 256); this_hostname = g_get_host_name ();
this_hostname[256] = 0;
if ((hostname == NULL) || if ((hostname == NULL) ||
(res == 0 && strcmp (hostname, this_hostname) == 0) || (strcmp (hostname, this_hostname) == 0) ||
(strcmp (hostname, "localhost") == 0)) (strcmp (hostname, "localhost") == 0))
gtk_file_selection_set_filename (GTK_FILE_SELECTION (widget), gtk_file_selection_set_filename (GTK_FILE_SELECTION (widget),
filename); filename);
...@@ -1023,8 +1018,7 @@ filenames_drag_get (GtkWidget *widget, ...@@ -1023,8 +1018,7 @@ filenames_drag_get (GtkWidget *widget,
{ {
const gchar *file; const gchar *file;
gchar *uri_list; gchar *uri_list;
char hostname[256]; const char *hostname;
int res;
GError *error; GError *error;
file = gtk_file_selection_get_filename (filesel); file = gtk_file_selection_get_filename (filesel);
...@@ -1033,10 +1027,10 @@ filenames_drag_get (GtkWidget *widget, ...@@ -1033,10 +1027,10 @@ filenames_drag_get (GtkWidget *widget,
{ {
if (info == TARGET_URILIST) if (info == TARGET_URILIST)
{ {
res = gethostname (hostname, 256); hostname = g_get_host_name ();
error = NULL; error = NULL;
uri_list = g_filename_to_uri (file, (!res)?hostname:NULL, &error); uri_list = g_filename_to_uri (file, hostname, &error);
if (!uri_list) if (!uri_list)
{ {
g_warning ("Error getting filename: %s\n", g_warning ("Error getting filename: %s\n",
......
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