# HG changeset patch
# User Darren Salt <[EMAIL PROTECTED]>
# Date 1172085144 0
# Node ID 780fb31aa2bebb31ede7f80c76652e974e1087aa
# Parent  7a86795211c187052673713ffc7d7353cfd7877b
# Parent  8ef0ab0b32e2bf875d1e13abe431024ac3112b7e
Merge.

diff -r 780fb31aa2bebb31ede7f80c76652e974e1087aa -r 
7a86795211c187052673713ffc7d7353cfd7877b configure.ac
--- a/configure.ac      Wed Feb 21 19:12:24 2007 +0000
+++ b/configure.ac      Tue Feb 20 22:19:32 2007 -0500
@@ -164,6 +164,7 @@ fi
 fi
 if test "$with_hal" = yes; then
   AC_DEFINE(WITH_HAL, 1, [Define if HAL is present and you want to use it.])
+  GXINE_HAL_DEVICE_INFO
 fi
 
 dnl ---------------------------------------------
diff -r 780fb31aa2bebb31ede7f80c76652e974e1087aa -r 
7a86795211c187052673713ffc7d7353cfd7877b m4/_gxine.m4
--- a/m4/_gxine.m4      Wed Feb 21 19:12:24 2007 +0000
+++ b/m4/_gxine.m4      Tue Feb 20 22:19:32 2007 -0500
@@ -40,3 +40,33 @@ AC_DEFUN([AC_LD_ASNEEDED],
     AC_MSG_RESULT([$ac_cv_ld_asneeded])
     test x"$ac_cv_ld_asneeded" = xyes || LDFLAGS="$SAVE_LDFLAGS"
     ])
+
+dnl OS-specific HAL device info lookup
+dnl HAL_DEVICE_FILE_PROPERTY = HAL property giving the device pathname
+dnl HAL_DEVICE_FILE_PREFIX   = Prefix for the device file property,
+dnl                            e.g. "/dev/", were "/dev" omitted on Linux
+dnl                            (note the trailing "/"!)
+AC_DEFUN([GXINE_HAL_DEVICE_INFO],
+    [AC_MSG_CHECKING([how to acquire device info via HAL])
+    HAL_DEVICE_FILE_PROPERTY=''
+    HAL_DEVICE_FILE_PREFIX=''
+    case "$build_os" in
+      linux-*)
+       HAL_DEVICE_FILE_PROPERTY=linux.device_file
+       ;;
+      solaris-*)
+       HAL_DEVICE_FILE_PROPERTY=solaris.devfs_path
+       HAL_DEVICE_FILE_PREFIX=/devices/
+       ;;
+    esac
+    AC_MSG_RESULT(["$HAL_DEVICE_FILE_PROPERTY", prefix 
"$HAL_DEVICE_FILE_PREFIX"])
+    if test "$HAL_DEVICE_FILE_PROPERTY" = ''; then
+      AC_MSG_WARN([I don't know how to get HAL path info for $build_os.])
+      AC_MSG_WARN([You won't see some info when viewing/selecting default 
devices.])
+    else
+      AC_DEFINE_UNQUOTED(HAL_DEVICE_FILE_PROPERTY, 
["$HAL_DEVICE_FILE_PROPERTY"], [HAL device pathname property])
+      if test "$HAL_DEVICE_FILE_PREFIX" != ''; then
+        AC_DEFINE_UNQUOTED(HAL_DEVICE_FILE_PREFIX, 
["$HAL_DEVICE_FILE_PREFIX"], [Common prefix for the HAL device pathname 
property])
+      fi
+    fi
+    ])
diff -r 780fb31aa2bebb31ede7f80c76652e974e1087aa -r 
7a86795211c187052673713ffc7d7353cfd7877b src/preferences.c
--- a/src/preferences.c Wed Feb 21 19:12:24 2007 +0000
+++ b/src/preferences.c Tue Feb 20 22:19:32 2007 -0500
@@ -325,7 +325,7 @@ get_hal_property (const char *dev, const
   }
 
   char *prop = libhal_device_get_property_string (hal, devs[0], prop_tag, 
NULL);
-  char *ret = strdup (prop ? : "");
+  char *ret = (prop && prop[0]) ? strdup (prop) : NULL;
   libhal_free_string (prop);
   libhal_free_string_array (devs);
   return ret;
@@ -369,8 +369,17 @@ get_hal_device_info (const char *dev)
     }
   }
 
+#ifdef HAL_DEVICE_FILE_PREFIX
+  char *const buf_unprefixed =
+    strncmp (buf, HAL_DEVICE_FILE_PREFIX, sizeof (HAL_DEVICE_FILE_PREFIX) - 1)
+    ? "" : buf + sizeof (HAL_DEVICE_FILE_PREFIX) - 2;
+#else
+  char *const buf_unprefixed = buf;
+#endif
+
   return get_hal_property (buf, "block.device", "storage.model")
-        ? : get_hal_property (buf, "linux.device_file", "info.product")
+        ? : get_hal_property (buf, "block.device", "info.product")
+        ? : get_hal_property (buf_unprefixed, HAL_DEVICE_FILE_PROPERTY, 
"info.product")
         /* FIXME - BSD etc. */
         ;
 }
@@ -381,10 +390,11 @@ display_hal_device_info (GtkWidget *widg
   GtkLabel *info = g_object_get_data (G_OBJECT (widget), "extra");
   if (info)
   {
-    char *content = g_markup_printf_escaped ("<small>%s</small>",
-                                            get_hal_device_info (dev) ? : "");
+    char *hal = get_hal_device_info (dev);
+    char *content = g_markup_printf_escaped ("<small>%s</small>", hal ? : "");
     gtk_label_set_markup (info, content);
     free (content);
+    free (hal);
   }
 }
 #endif /* WITH_HAL */
@@ -429,7 +439,7 @@ static void file_preview_cb (GtkFileChoo
   if (!file)
     file = gtk_file_chooser_get_filename (fc);
   char *content = get_hal_device_info (file);
-  gtk_label_set_text (info, content);
+  gtk_label_set_text (info, content ? : "");
   free (content);
   g_free (file);
 }
@@ -1076,7 +1086,12 @@ void preferences_update_entry (const xin
 
     case XINE_CONFIG_TYPE_STRING:
       if (xine_check_version (1, 1, 4) && entry->num_value)
+      {
        gtk_file_chooser_set_filename (widget, entry->str_value);
+#ifdef WITH_HAL
+       display_hal_device_info (widget, entry->str_value);
+#endif
+      }
       else
        gtk_entry_set_text (widget, entry->str_value);
       break;

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Xine-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-cvslog

Reply via email to