[PATCH] Add zenity systray support to the build.

Luke Dixon 6b8b4567 at gmail.com
Mon Oct 25 15:14:05 PDT 2010


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


--=-Hexaxj2URGZxlJ/so6Mf--



More information about the LibreOffice mailing list