Updating branch refs/heads/master
         to 8966a399aa311d181c976132bc16bac582da03c1 (commit)
       from 45b72f2ccf5272c6475ba84e4adb9bf62c01eaa0 (commit)

commit 8966a399aa311d181c976132bc16bac582da03c1
Author: Nick Schermer <[email protected]>
Date:   Sun Nov 7 16:31:26 2010 +0100

    Return support for vendor information.
    
    And slightly extend it. A vendor can now also set it
    without a text file, in that case only another version
    string is shown in the dialog:
    "Xfce <version>, distributed by <name>", with file an
    additional tab appears wich contains the contents of the
    file.

 configure.in.in                      |   20 +++++++++----
 xfce4-about/Makefile.am              |    1 +
 xfce4-about/main.c                   |   51 ++++++++++++++++++++++++++++++++++
 xfce4-about/xfce4-about-dialog.glade |   41 +++++++++++++++++++++++++--
 4 files changed, 104 insertions(+), 9 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index 0294c8a..020c967 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -156,15 +156,15 @@ dnl Check for linker optimizations
 XDT_FEATURE_LINKER_OPTS()
 
 dnl Check for vendor specific information
-AC_MSG_CHECKING([for additional vendor info])
+AC_MSG_CHECKING([for additional vendor name and/or info])
 AC_ARG_WITH([vendor-info],
-AC_HELP_STRING([--with-vendor-info=FILE], [Specify an additional file that 
should be displayed in the about dialog]),
-  [], [with_vendor_info=])
+AC_HELP_STRING([--with-vendor-info=NAME], [Specify an additional vendor name, 
optionally with a file in prefix/share/xfce4/NAME]),
+    [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 
info])
-  AC_MSG_RESULT([$with_vendor_info])
+    AC_DEFINE_UNQUOTED([VENDOR_INFO], ["$with_vendor_info"], [Additional 
vendor name and/or info])
+    AC_MSG_RESULT([$vendorinfo])
 else
-  AC_MSG_RESULT([none])
+    AC_MSG_RESULT([not set])
 fi
 
 AC_OUTPUT([
@@ -192,4 +192,12 @@ echo "* Documentation: yes (in tarball)"
 else
 echo "* Documentation: no"
 fi
+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/$with_vendor_info\""
+else
+echo "* Vendor:        none"
+fi
 echo
diff --git a/xfce4-about/Makefile.am b/xfce4-about/Makefile.am
index b83a366..f76bb09 100644
--- a/xfce4-about/Makefile.am
+++ b/xfce4-about/Makefile.am
@@ -2,6 +2,7 @@
 INCLUDES = \
        -I$(top_srcdir) \
        -DG_LOG_DOMAIN=\"xfce4-about\" \
+       -DDATADIR=\"$(datadir)/xfce4\" \
        -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
        $(PLATFORM_CPPFLAGS)
 
diff --git a/xfce4-about/main.c b/xfce4-about/main.c
index 441236e..3018d29 100644
--- a/xfce4-about/main.c
+++ b/xfce4-about/main.c
@@ -307,6 +307,45 @@ xfce_about_copyright (GtkTextBuffer *buffer)
 
 
 
+#ifdef VENDOR_INFO
+static void
+xfce_about_vendor (GtkBuilder *builder)
+{
+  gchar   *contents;
+  gchar   *filename;
+  GObject *object;
+  gsize    length;
+
+  g_return_if_fail (GTK_IS_BUILDER (builder));
+
+  filename = g_build_filename (DATADIR, VENDOR_INFO, NULL);
+  if (g_file_get_contents (filename, &contents, &length, NULL))
+    {
+      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-tab");
+          gtk_widget_show (GTK_WIDGET (object));
+        }
+      else
+        {
+          g_critical ("\"%s\" is not UTF-8 valid", filename);
+        }
+
+      g_free (contents);
+    }
+
+  g_free (filename);
+}
+#endif
+
+
+
 static void
 xfce_about_license (GtkBuilder *builder,
                     GObject    *buffer)
@@ -444,7 +483,15 @@ main (gint    argc,
   g_signal_connect_swapped (G_OBJECT (dialog), "delete-event",
       G_CALLBACK (gtk_main_quit), NULL);
 
+#ifdef VENDOR_INFO
+  /* I18N: first %s will be replaced by the version, second by
+   * the name of the distribution (--with-vendor-info=NAME) */
+  version = g_strdup_printf (_("Version %s, distributed by %s"),
+                             xfce_version_string (), VENDOR_INFO);
+#else
+  /* I18N: %s will be replaced by the Xfce version number */
   version = g_strdup_printf (_("Version %s"), xfce_version_string ());
+#endif
   xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog), version);
   g_free (version);
 
@@ -457,6 +504,10 @@ main (gint    argc,
   object = gtk_builder_get_object (builder, "copyright-buffer");
   xfce_about_copyright (GTK_TEXT_BUFFER (object));
 
+#ifdef VENDOR_INFO
+  xfce_about_vendor (builder);
+#endif
+
   object = gtk_builder_get_object (builder, "gpl-button");
   g_signal_connect_swapped (G_OBJECT (object), "clicked",
       G_CALLBACK (xfce_about_license_gpl), builder);
diff --git a/xfce4-about/xfce4-about-dialog.glade 
b/xfce4-about/xfce4-about-dialog.glade
index 719c065..150b705 100644
--- a/xfce4-about/xfce4-about-dialog.glade
+++ b/xfce4-about/xfce4-about-dialog.glade
@@ -15,7 +15,7 @@
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child>
-          <object class="GtkNotebook" id="notebook1">
+          <object class="GtkNotebook" id="notebook">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="border_width">6</property>
@@ -86,6 +86,40 @@
               </packing>
             </child>
             <child>
+              <object class="GtkScrolledWindow" id="vendor-tab">
+                <property name="can_focus">True</property>
+                <property name="border_width">6</property>
+                <property name="hscrollbar_policy">automatic</property>
+                <property name="vscrollbar_policy">automatic</property>
+                <property name="shadow_type">etched-in</property>
+                <child>
+                  <object class="GtkTextView" id="vendor-textview">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="editable">False</property>
+                    <property name="wrap_mode">word</property>
+                    <property name="left_margin">3</property>
+                    <property name="right_margin">3</property>
+                    <property name="cursor_visible">False</property>
+                    <property name="buffer">vendor-buffer</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="vendor-label">
+                <property name="visible">True</property>
+                <property name="label">Vendor</property>
+              </object>
+              <packing>
+                <property name="position">2</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkVBox" id="vbox1">
                 <property name="visible">True</property>
                 <property name="border_width">6</property>
@@ -167,7 +201,7 @@
                 </child>
               </object>
               <packing>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child type="tab">
@@ -176,7 +210,7 @@
                 <property name="label" translatable="yes">Copyright</property>
               </object>
               <packing>
-                <property name="position">2</property>
+                <property name="position">3</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>
@@ -539,4 +573,5 @@ NO WARRANTY
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</property>
   </object>
+  <object class="GtkTextBuffer" id="vendor-buffer"/>
 </interface>
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to