[Xfce4-commits] <libxfce4ui:master> Restore vendor information handling.

Nick Schermer noreply at xfce.org
Sat Dec 31 14:28:01 CET 2011


Updating branch refs/heads/master
         to 4a14ef81cdc6f3e45b63eb42ca41c6af50c9c0c4 (commit)
       from 3e99b35fd140a1e915956c75cd221c981f197b58 (commit)

commit 4a14ef81cdc6f3e45b63eb42ca41c6af50c9c0c4
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Dec 31 14:24:59 2011 +0100

    Restore vendor information handling.
    
    Restore the configure flags and simplify the vendor file
    handing. The file is not name specific anymore, but just
    stored in $prefix/share/xfce4/vendorinfo.
    To hide the message the file is not found, packages
    can 'touch' the file, so it has a zero length.
    
    Note that --with-vendor-info "Your Name" is also supported.

 configure.ac.in    |   22 ++++++++++++++++++++++
 xfce4-about/main.c |   31 +++++++++++++++++++------------
 2 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index ec0fa6c..eb658a8 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -149,6 +149,20 @@ if test "x$enable_keyboard_library" = "xyes"; then
 fi
 AM_CONDITIONAL([ENABLE_KEYBOARD_LIBRARY], [test "x$enable_keyboard_library" = "xyes"])
 
+dnl *********************************************
+dnl *** Check for vendor specific information ***
+dnl *********************************************
+AC_MSG_CHECKING([for additional vendor name and/or info])
+AC_ARG_WITH([vendor-info],
+AC_HELP_STRING([--with-vendor-info=NAME], [Specify an additional vendor name, optionally with a file in $prefix/share/xfce4/venderinfo]),
+    [with_vendor_info="$withval"], [with_vendor_info=""])
+if test x"$with_vendor_info" != x""; then
+    AC_DEFINE_UNQUOTED([VENDOR_INFO], ["$with_vendor_info"], [Additional vendor name and/or info])
+    AC_MSG_RESULT([$vendorinfo])
+else
+    AC_MSG_RESULT([not set])
+fi
+
 dnl *********************************************************
 dnl *** Optional support for the Glade Interface Designer ***
 dnl *********************************************************
@@ -313,4 +327,12 @@ echo "* X11 session management:    yes"
 fi
 echo "* Debug support:             $enable_debug"
 echo "* GNU Visibility:            $have_gnuc_visibility"
+if test -n "$with_vendor_info"; then
+echo "* Vendor:                    $with_vendor_info"
+echo
+echo "Note you can put additional info about the vendor"
+echo "in this text file: \"${datarootdir}/xfce4/vendorinfo\""
+else
+echo "* Vendor:                    none"
+fi
 echo
diff --git a/xfce4-about/main.c b/xfce4-about/main.c
index 85aaa0d..540df64 100644
--- a/xfce4-about/main.c
+++ b/xfce4-about/main.c
@@ -314,27 +314,34 @@ xfce_about_vendor (GtkBuilder *builder)
 
   g_return_if_fail (GTK_IS_BUILDER (builder));
 
-  filename = g_build_filename (DATADIR, VENDOR_INFO, NULL);
+  filename = g_build_filename (DATADIR, "vendorinfo", NULL);
   if (g_file_get_contents (filename, &contents, &length, NULL))
     {
-      if (g_utf8_validate(contents, length, NULL))
+      if (length > 0)
         {
-          object = gtk_builder_get_object (builder, "vendor-buffer");
-          gtk_text_buffer_set_text (GTK_TEXT_BUFFER (object), contents, length);
+          if (g_utf8_validate(contents, length, NULL))
+            {
+              object = gtk_builder_get_object (builder, "vendor-buffer");
+              gtk_text_buffer_set_text (GTK_TEXT_BUFFER (object), contents, length);
 
-          object = gtk_builder_get_object (builder, "vendor-label");
-          gtk_label_set_text (GTK_LABEL (object), VENDOR_INFO);
+              object = gtk_builder_get_object (builder, "vendor-label");
+              gtk_label_set_text (GTK_LABEL (object), VENDOR_INFO);
 
-          object = gtk_builder_get_object (builder, "vendor-tab");
-          gtk_widget_show (GTK_WIDGET (object));
-        }
-      else
-        {
-          g_critical ("\"%s\" is not UTF-8 valid", filename);
+              object = gtk_builder_get_object (builder, "vendor-tab");
+              gtk_widget_show (GTK_WIDGET (object));
+            }
+          else
+            {
+              g_critical ("\"%s\" is not UTF-8 valid", filename);
+            }
         }
 
       g_free (contents);
     }
+  else
+    {
+      g_message ("No vendor information found in \"%s\".", filename);
+    }
 
   g_free (filename);
 }


More information about the Xfce4-commits mailing list