consolidate ActionMap and ActionManager APIs into a single namespace
[ardour.git] / libs / gtkmm2ext / gtk_ui.cc
index c2210bba934714a12f58255befdd0954140e28d4..f03c5c5dec98d6f9839771a3d2c2bc28aaf250f8 100644 (file)
@@ -38,7 +38,6 @@
 #include "gtkmm2ext/bindings.h"
 #include "gtkmm2ext/gtk_ui.h"
 #include "gtkmm2ext/textviewer.h"
-#include "gtkmm2ext/popup.h"
 #include "gtkmm2ext/utils.h"
 #include "gtkmm2ext/window_title.h"
 #include "gtkmm2ext/actions.h"
@@ -484,7 +483,14 @@ UI::do_request (UIRequest* req)
 
        } else if (req->type == SetTip) {
 
-               gtk_widget_set_tooltip_markup (req->widget->gobj(), req->msg);
+               gchar* old = gtk_widget_get_tooltip_markup (req->widget->gobj());
+               if (
+                               (old && req->msg && strcmp (old, req->msg))
+                               ||
+                               ((old == NULL) != (req->msg == NULL || req->msg[0] == '\0'))
+                        ) {
+                       gtk_widget_set_tooltip_markup (req->widget->gobj(), req->msg);
+               }
 
        } else {
 
@@ -549,8 +555,6 @@ UI::receive (Transmitter::Channel chn, const char *str)
        }
 }
 
-#define OLD_STYLE_ERRORS 1
-
 void
 UI::process_error_message (Transmitter::Channel chn, const char *str)
 {
@@ -560,9 +564,6 @@ UI::process_error_message (Transmitter::Channel chn, const char *str)
        const char *prefix;
        size_t prefix_len;
        bool fatal_received = false;
-#ifndef OLD_STYLE_ERRORS
-       PopUp* popup = new PopUp (WIN_POS_CENTER, 0, true);
-#endif
 
        switch (chn) {
        case Transmitter::Fatal:
@@ -573,44 +574,22 @@ UI::process_error_message (Transmitter::Channel chn, const char *str)
                fatal_received = true;
                break;
        case Transmitter::Error:
-#if OLD_STYLE_ERRORS
                prefix = "[ERROR]: ";
                ptag = error_ptag;
                mtag = error_mtag;
                prefix_len = 9;
-#else
-               popup->set_name ("ErrorMessage");
-               popup->set_text (str);
-               popup->touch ();
-               return;
-#endif
                break;
        case Transmitter::Info:
-#if OLD_STYLE_ERRORS
                prefix = "[INFO]: ";
                ptag = info_ptag;
                mtag = info_mtag;
                prefix_len = 8;
-#else
-               popup->set_name ("InfoMessage");
-               popup->set_text (str);
-               popup->touch ();
-               return;
-#endif
-
                break;
        case Transmitter::Warning:
-#if OLD_STYLE_ERRORS
                prefix = "[WARNING]: ";
                ptag = warning_ptag;
                mtag = warning_mtag;
                prefix_len = 11;
-#else
-               popup->set_name ("WarningMessage");
-               popup->set_text (str);
-               popup->touch ();
-               return;
-#endif
                break;
        default:
                /* no choice but to use text/console output here */
@@ -638,7 +617,7 @@ UI::process_error_message (Transmitter::Channel chn, const char *str)
 void
 UI::show_errors ()
 {
-       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-log-window"));
+       Glib::RefPtr<Action> act = ActionManager::find_action (X_("Editor"), X_("toggle-log-window"));
        if (!act) {
                return;
        }
@@ -652,7 +631,7 @@ UI::show_errors ()
 void
 UI::toggle_errors ()
 {
-       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-log-window"));
+       Glib::RefPtr<Action> act = ActionManager::find_action (X_("Editor"), X_("toggle-log-window"));
        if (!act) {
                return;
        }