Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index


Hello,

I thought I would try one of the easy tasks and the zenity systray one
seemed the most fun for me to look at. After getting it working I
figured I needed to also add it to the configure system, I hope I've got
that bit right. I wasn't sure about where in the file to add these, so
sorry if I've added these bits in the wrong place.

I looked at some of the already existing icons in the project, but I
couldn't find one that would be suitable (the best one I could find had
seagulls in it).

Patch contributed under LGPLv3+ / MPL.

Thanks for providing the easy tasks, it makes very easy to jump in and
try to help.

Luke Dixon
From f82a3310c62331440c57930138ee33b9bad707b3 Mon Sep 17 00:00:00 2001
From: Luke Dixon <6b8b4567@gmail.com>
Date: Mon, 25 Oct 2010 23:14:05 +0100
Subject: [PATCH] Add zenity systray support to the build.

Adds also a configure option '--enable-zenity' used to enable this feature.
---
 configure.in        |   54 +++++++++++++++++++++++++++++++++++++++++++++++++++
 set_soenv.in        |    1 +
 solenv/bin/build.pl |   54 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 109 insertions(+), 0 deletions(-)

diff --git a/configure.in b/configure.in
index e63c299..ff41b6f 100644
--- a/configure.in
+++ b/configure.in
@@ -945,6 +945,18 @@ AC_ARG_WITH(max-jobs,
                           can get up to CPUS*max_jobs. Defaults to 1, unless
                           you configure --enable-icecream - then to 10.
 ],,)
+AC_ARG_ENABLE(zenity,
+[  --enable-zenity         Display a icon in the notification area during
+                          build.
+],,)
+AC_ARG_ENABLE(zenity,
+[  --enable-zenity         Display a icon in the notification area during
+                          build.
+],,)
+AC_ARG_ENABLE(zenity,
+[  --enable-zenity         Display a icon in the notification area during
+                          build.
+],,)
 
 BUILD_TYPE="OOo"
 
@@ -7465,6 +7477,48 @@ fi
 AC_SUBST(VERBOSE)
 
 dnl ===================================================================
+dnl Use zenity during build
+dnl ===================================================================
+AC_MSG_CHECKING([whether to use zenity during build])
+if test "$enable_zenity" = "yes"; then
+    ENABLE_ZENITY=TRUE
+    AC_MSG_RESULT([yes])
+else
+    ENABLE_ZENITY=FALSE
+    AC_MSG_RESULT([no])
+fi
+AC_SUBST(ENABLE_ZENITY)
+
+
+dnl ===================================================================
+dnl Use zenity during build
+dnl ===================================================================
+AC_MSG_CHECKING([whether to use zenity during build])
+if test "$enable_zenity" = "yes"; then
+    ENABLE_ZENITY=TRUE
+    AC_MSG_RESULT([yes])
+else
+    ENABLE_ZENITY=FALSE
+    AC_MSG_RESULT([no])
+fi
+AC_SUBST(ENABLE_ZENITY)
+
+
+dnl ===================================================================
+dnl Use zenity during build
+dnl ===================================================================
+AC_MSG_CHECKING([whether to use zenity during build])
+if test "$enable_zenity" = "yes"; then
+    ENABLE_ZENITY=TRUE
+    AC_MSG_RESULT([yes])
+else
+    ENABLE_ZENITY=FALSE
+    AC_MSG_RESULT([no])
+fi
+AC_SUBST(ENABLE_ZENITY)
+
+
+dnl ===================================================================
 dnl Hook up OOos nodep environmental variable to automake's equivalent
 dnl --enable-dependency-tracking configure option
 dnl ===================================================================
diff --git a/set_soenv.in b/set_soenv.in
index 430003f..3426573 100644
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1838,6 +1838,7 @@ ToFile( "WITHOUT_PPDS",      "@WITHOUT_PPDS@",     "e" );
 ToFile( "WITH_BINFILTER",    "@WITH_BINFILTER@",   "e" );
 ToFile( "BUILD_TYPE",        "@BUILD_TYPE@",       "e" );
 ToFile( "VERBOSE",           "@VERBOSE@",          "e" );
+ToFile( "ENABLE_ZENITY",           "@ENABLE_ZENITY@",          "e" );
 ToFile( "ENABLE_EVOAB2",     "@ENABLE_EVOAB2@",    "e" );
 ToFile( "GOBJECT_CFLAGS",    "@GOBJECT_CFLAGS@",   "e" );
 ToFile( "GOBJECT_LIBS",      "@GOBJECT_LIBS@",     "e" );
diff --git a/solenv/bin/build.pl b/solenv/bin/build.pl
index 6148c33..88f755a 100755
--- a/solenv/bin/build.pl
+++ b/solenv/bin/build.pl
@@ -42,6 +42,7 @@
     use Fcntl;
     use POSIX qw(:errno_h);
     use Sys::Hostname;
+    use IPC::Open3;
 
     use lib ("$ENV{SOLARENV}/bin/modules");
     use SourceConfig;
@@ -208,10 +209,17 @@
     %module_deps_hash_pids = ();
     my @argv = @ARGV;
     my $source_config_file;
+    my $zenity_pid = 0;
+    my $zenity_in = '';
+    my $zenity_out = '';
+    my $zenity_err = '';
 ### main ###
 
     get_options();
 
+    zenity_open();
+    zenity_tooltip("Starting build.");
+
 #    my $temp_html_file = CorrectPath($tmp_dir. '/' . $ENV{INPATH}. '.build.html');
     get_build_modes();
     %deliver_env = ();
@@ -1704,6 +1712,8 @@ sub cancel_build {
     print "            http://wiki.documentfoundation.org/Development\n";;
     print "\n";
 
+    zenity_set_message("LibreOffice Build Failed!");
+
     if (!$broken_modules_number || !$build_all_parents) {
         while (children_number()) {
             handle_dead_children(1);
@@ -2132,9 +2142,46 @@ sub print_announce {
     $announce_string .= $echo . $text;
     $announce_string .= $echo . "=============\n";
     print $announce_string;
+    my $total_modules = scalar(keys %build_lists_hash);
+    my $modules_started = scalar(keys %module_announced) + 1;
+    zenity_tooltip("($modules_started/$total_modules) $text");
     $module_announced{$Prj}++;
 };
 
+sub zenity_open {
+    if (defined $ENV{ENABLE_ZENITY}) {
+        my $zenity_pid = open3($zenity_in, $zenity_out, $zenity_err,
+                               "/bin/env zenity --notification --listen");
+    };
+};
+
+sub zenity_close {
+    if (defined $ENV{ENABLE_ZENITY}) {
+        kill 1, $zenity_pid;
+    };
+};
+
+sub zenity_icon {
+    if (defined $ENV{ENABLE_ZENITY}) {
+        my $filename = shift;
+        print $zenity_in "icon: $filename\n";
+    };
+};
+
+sub zenity_tooltip {
+    if (defined $ENV{ENABLE_ZENITY}) {
+        my $text = shift;
+        print $zenity_in "tooltip: LibreOffice Build: $text\n";
+    };
+};
+
+sub zenity_message {
+    if (defined $ENV{ENABLE_ZENITY}) {
+        my $text = shift;
+        print $zenity_in "message: $text\n";
+    };
+};
+
 sub are_all_dependent {
     my $build_queue = shift;
     my $folder = '';
@@ -2732,6 +2779,13 @@ sub do_exit {
 #    close_server_socket();
     my $exit_code = shift;
     $build_finished++;
+    if ($exit_code) {
+        zenity_message("LibreOffice Build Failed!")
+    } else {
+        zenity_message("LibreOffice Build Success!")
+    };
+    sleep(1); # Give Zenity a chance to show the message.
+    zenity_close();
     generate_html_file(1);
     if ( $^O eq 'os2' )
     {
-- 
1.7.3.1


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.