diff src/gtk/misc-gtk.c @ 201:0098dae654a5

2003-6-25 Brian Masney <masneyb@gftp.org> * configure.in - added mk to ALL_LINGUAS * lib/gftp.h - added several macros for dmalloc * lib/misc.c src/text/gftp-text.c src/gtk/gftp-gtk.c - added gftp_shutdown() to misc.c. This will write out the configuration file, clear the cache, and if dmalloc is enabled, free the memory that was allocated on startup * lib/config_file.c lib/gftp.h lib/misc.c lib/options.h - added gftp_configuration_changed parameter * lib/config_file.c lib/misc.c lib/protocols.c - added gftp_config_free_options() * lib/config_file.c src/gtk/bookmarks.c - added gftp_bookmarks() which is derived mostly from bm_close_dialog() * lib/rfc959.c - added rfc959_request_destroy(). Free the getline buffers in this function * src/gtk/misc-gtk.c (gftp_item_factory_translate) - remove double g_strdup() call * lib/config_file.c lib/gftp.h src/gtk/misc-gtk.c - moved get_xpm_path() to GTK+ port. No longer call it startup when reading the config file
author masneyb
date Thu, 26 Jun 2003 01:04:12 +0000
parents 8fea1b1a2ec6
children cf4098008615
line wrap: on
line diff
--- a/src/gtk/misc-gtk.c	Wed Jun 25 10:57:06 2003 +0000
+++ b/src/gtk/misc-gtk.c	Thu Jun 26 01:04:12 2003 +0000
@@ -525,7 +525,6 @@
 }
 
 
-/* FIXME - check this */
 static gchar *
 gftp_item_factory_translate (const char *path, gpointer func_data)
 {
@@ -552,7 +551,7 @@
 		  GtkAccelGroup *accel_group, const char *strip_prefix)
 {
   GtkItemFactory *result = gtk_item_factory_new (container_type, path, accel_group);
-  gchar *strip_prefix_dup = g_strdup (g_strdup (strip_prefix));
+  gchar *strip_prefix_dup = g_strdup (strip_prefix);
   
   gtk_item_factory_set_translate_func (result, gftp_item_factory_translate,
 				       strip_prefix_dup, NULL);
@@ -1288,3 +1287,37 @@
     exit (1);
 }
 
+
+char *
+get_xpm_path (char *filename, int quit_on_err)
+{
+  char *tempstr, *exfile;
+
+  tempstr = g_strconcat (BASE_CONF_DIR, "/", filename, NULL);
+  exfile = expand_path (tempstr);
+  g_free (tempstr);
+  if (access (exfile, F_OK) != 0)
+    {
+      g_free (exfile);
+      tempstr = g_strconcat (SHARE_DIR, "/", filename, NULL);
+      exfile = expand_path (tempstr);
+      g_free (tempstr);
+      if (access (exfile, F_OK) != 0)
+	{
+	  g_free (exfile);
+	  exfile = g_strconcat ("/usr/share/icons/", filename, NULL);
+	  if (access (exfile, F_OK) != 0)
+	    {
+	      g_free (exfile);
+	      if (!quit_on_err)
+		return (NULL);
+
+	      printf (_("gFTP Error: Cannot find file %s in %s or %s\n"),
+		      filename, SHARE_DIR, BASE_CONF_DIR);
+	      exit (1);
+	    }
+	}
+    }
+  return (exfile);
+}
+