[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara caolanm at redhat.com
Thu Mar 1 20:30:11 UTC 2018


 vcl/unx/gtk3/gtk3gtkinst.cxx |   24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

New commits:
commit 836705dec8cd68684dfaf01df249e867d7dd5d86
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 1 15:14:07 2018 +0000

    hook up extended tips to find them in our help
    
    Change-Id: I1360403b3b21eec3fd37bb5ba74e0fab1945af94
    Reviewed-on: https://gerrit.libreoffice.org/50590
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 5165ef70fd6e..39d68f110c5a 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2487,6 +2487,7 @@ namespace
         const ImplSVData* pSVData = ImplGetSVData();
         if (pSVData->maHelpData.mbBalloonHelp)
         {
+            /*This is how I would prefer things to be, only a few like this though*/
             AtkObject* pAtkObject = gtk_widget_get_accessible(pWidget);
             const char* pDesc = pAtkObject ? atk_object_get_description(pAtkObject) : nullptr;
             if (pDesc)
@@ -2494,6 +2495,19 @@ namespace
                 gtk_tooltip_set_text(tooltip, pDesc);
                 return true;
             }
+
+            /*So fallback to existing mechanism which needs help installed*/
+            OString sHelpId = ::get_help_id(pWidget);
+            Help* pHelp = !sHelpId.isEmpty() ? Application::GetHelp() : nullptr;
+            if (pHelp)
+            {
+                OUString sHelpText = pHelp->GetHelpText(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), nullptr);
+                if (!sHelpText.isEmpty())
+                {
+                    gtk_tooltip_set_text(tooltip, OUStringToOString(sHelpText, RTL_TEXTENCODING_UTF8).getStr());
+                    return true;
+                }
+            }
         }
 
         const char* pDesc = gtk_widget_get_tooltip_text(pWidget);
@@ -2555,14 +2569,10 @@ namespace
         set_help_id(pWidget, sHelpId);
         //hook up for extended help
         const ImplSVData* pSVData = ImplGetSVData();
-        if (pSVData->maHelpData.mbBalloonHelp)
+        if (pSVData->maHelpData.mbBalloonHelp && !GTK_IS_DIALOG(pWidget))
         {
-            AtkObject* pAtkObject = gtk_widget_get_accessible(pWidget);
-            if (pAtkObject && atk_object_get_description(pAtkObject))
-            {
-                gtk_widget_set_has_tooltip(pWidget, true);
-                g_signal_connect(pObject, "query-tooltip", G_CALLBACK(signalTooltipQuery), nullptr);
-            }
+            gtk_widget_set_has_tooltip(pWidget, true);
+            g_signal_connect(pObject, "query-tooltip", G_CALLBACK(signalTooltipQuery), nullptr);
         }
     }
 }


More information about the Libreoffice-commits mailing list