Committed underlay support (from Audun).
[ardour.git] / libs / gtkmm2ext / gtk_ui.cc
index 177e4f3dbbbf9e01c506eb44a571c092cbd986a6..660ea32ad1aa2a4b0142a702350b92eb851cf7d3 100644 (file)
@@ -37,6 +37,7 @@
 #include <gtkmm2ext/textviewer.h>
 #include <gtkmm2ext/popup.h>
 #include <gtkmm2ext/utils.h>
+#include <gtkmm2ext/window_title.h>
 
 #include "i18n.h"
 
@@ -60,7 +61,7 @@ BaseUI::RequestType Gtkmm2ext::AddTimeout = BaseUI::new_request_type();
 #include <pbd/abstract_ui.cc>  /* instantiate the template */
 
 
-UI::UI (string namestr, int *argc, char ***argv, string rcfile
+UI::UI (string namestr, int *argc, char ***argv) 
        : AbstractUI<UIRequest> (namestr, true)
 {
        theMain = new Main (argc, argv);
@@ -87,17 +88,18 @@ UI::UI (string namestr, int *argc, char ***argv, string rcfile)
        errors->text().set_editable (false); 
        errors->text().set_name ("ErrorText");
 
-       string title;
-       title = namestr;
-       title += ": Log";
-       errors->set_title (title);
+       Glib::set_application_name(namestr);
+
+       WindowTitle title(Glib::get_application_name());
+       title += _("Log");
+       errors->set_title (title.get_string());
 
        errors->dismiss_button().set_name ("ErrorLogCloseButton");
        errors->signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), (Window *) errors));
 
        register_thread (pthread_self(), X_("GUI"));
 
-       load_rcfile (rcfile);
+       //load_rcfile (rcfile);
 }
 
 UI::~UI ()
@@ -112,7 +114,7 @@ UI::caller_is_ui_thread ()
 }
 
 int
-UI::load_rcfile (string path)
+UI::load_rcfile (string path, bool themechange)
 {
        if (path.length() == 0) {
                return -1;
@@ -127,6 +129,13 @@ UI::load_rcfile (string path)
        }
        
        RC rc (path.c_str());
+       // RC::reset_styles (Gtk::Settings::get_default());
+       gtk_rc_reset_styles (gtk_settings_get_default());
+       theme_changed.emit();
+
+       if (themechange) {
+               return 0; //Don't continue on every time there is a theme change
+       }
 
        /* have to pack widgets into a toplevel window so that styles will stick */
 
@@ -405,7 +414,7 @@ UI::process_error_message (Transmitter::Channel chn, const char *str)
        RefPtr<Style> style;
        RefPtr<TextBuffer::Tag> ptag;
        RefPtr<TextBuffer::Tag> mtag;
-       char *prefix;
+       const char *prefix;
        size_t prefix_len;
        bool fatal_received = false;
 #ifndef OLD_STYLE_ERRORS
@@ -571,7 +580,7 @@ UI::flush_pending ()
 bool
 UI::just_hide_it (GdkEventAny *ev, Window *win)
 {
-       win->hide_all ();
+       win->hide ();
        return true;
 }