Commit adcc91c8 authored by Daniel Elstner's avatar Daniel Elstner
Browse files

Make glade-2 replace its old-style magic "class names" with proper

* ui/mainwindow.glade (toolbar): Make glade-2 replace its old-style
magic "class names" with proper GtkToolItem and derivated elements.
Note that you'll need to apply the patch for #142761 in order to
make changing the toolbar style at runtime work.
(combo_pattern): Replace deprecated GtkCombo with GtkComboBoxEntry.

* src/controller.cc (ControlItem::add_widgets): Allow for both
Gtk::ToolButton and Gtk::Button widgets, and detect at runtime
which type to use.

* src/mainwindow.cc (MainWindow::load_xml): Due to #142755, we
currently have to use get_child() on combo_pattern to gain access
to the entry widget.  Also, a hack was necessary to attach the
tooltip to the entry without instantiating another Gtk::Tooltips
object.

* src/mainwindow.h: Remove a couple of unused forward declarations.
parent 7f43beee
2004-05-19 Daniel Elstner <daniel.elstner@gmx.net>
* ui/mainwindow.glade (toolbar): Make glade-2 replace its old-style
magic "class names" with proper GtkToolItem and derivated elements.
Note that you'll need to apply the patch for #142761 in order to
make changing the toolbar style at runtime work.
(combo_pattern): Replace deprecated GtkCombo with GtkComboBoxEntry.
* src/controller.cc (ControlItem::add_widgets): Allow for both
Gtk::ToolButton and Gtk::Button widgets, and detect at runtime
which type to use.
* src/mainwindow.cc (MainWindow::load_xml): Due to #142755, we
currently have to use get_child() on combo_pattern to gain access
to the entry widget. Also, a hack was necessary to attach the
tooltip to the entry without instantiating another Gtk::Tooltips
object.
* src/mainwindow.h: Remove a couple of unused forward declarations.
2004-05-18 Daniel Elstner <daniel.elstner@gmx.net>
* src/prefdialog.cc (PrefDialog::on_response): Invoke
......
......@@ -20,9 +20,10 @@
#include "controller.h"
#include <libglademm.h>
#include <gtkmm/button.h>
#include <gtkmm/menu.h>
#include <gtkmm/toolbutton.h>
#include <libglademm.h>
#include <config.h>
......@@ -69,7 +70,7 @@ void ControlItem::add_widgets(const Glib::RefPtr<Gnome::Glade::Xml>& xml,
const sigc::slot<void> slot_activate = slot();
Gtk::MenuItem* menuitem = 0;
Gtk::Button* button = 0;
Gtk::Widget* widget = 0;
if (menuitem_name && xml->get_widget(menuitem_name, menuitem))
{
......@@ -77,10 +78,16 @@ void ControlItem::add_widgets(const Glib::RefPtr<Gnome::Glade::Xml>& xml,
add_widget(*menuitem);
}
if (button_name && xml->get_widget(button_name, button))
if (button_name && xml->get_widget(button_name, widget))
{
button->signal_clicked().connect(slot_activate);
add_widget(*button);
if (Gtk::ToolButton *const button = dynamic_cast<Gtk::ToolButton*>(widget))
button->signal_clicked().connect(slot_activate);
else if (Gtk::Button *const button = dynamic_cast<Gtk::Button*>(widget))
button->signal_clicked().connect(slot_activate);
else
g_return_if_reached();
add_widget(*widget);
}
}
......
......@@ -29,8 +29,10 @@
#include "translation.h"
#include <glib.h>
#include <gtk/gtktooltips.h> /* XXX: see load_xml() */
#include <gconfmm.h>
#include <gtkmm.h>
#include <gtkmm/comboboxentry.h>
#include <libglademm.h>
#include <algorithm>
#include <functional>
......@@ -169,7 +171,6 @@ void MainWindow::load_xml()
xml->get_widget("toolbar", toolbar_);
xml->get_widget("entry_folder", entry_folder_);
xml->get_widget("combo_pattern-entry", entry_pattern_);
xml->get_widget("button_recursive", button_recursive_);
xml->get_widget("button_hidden", button_hidden_);
xml->get_widget("entry_regex", entry_regex_);
......@@ -181,10 +182,26 @@ void MainWindow::load_xml()
xml->get_widget("entry_preview", entry_preview_);
xml->get_widget("statusline", statusline_);
Gtk::ComboBoxEntry* combo_pattern = 0;
xml->get_widget("combo_pattern", combo_pattern);
entry_pattern_ = dynamic_cast<Gtk::Entry*>(combo_pattern->get_child());
// Current libglade does not yet provide access to the internal child of
// GtkComboBoxEntry. However, I want a tooltip to be assigned to the entry
// and not to the combo box as a whole (by means of GtkEventBox). I hope
// libglade will be fixed soon -- until then, this hack assigns the tooltip
// manually using the group created by libglade.
if (GtkTooltipsData *const tipdata = gtk_tooltips_data_get(entry_folder_->Gtk::Widget::gobj()))
{
gtk_tooltips_set_tip(tipdata->tooltips, entry_pattern_->Gtk::Widget::gobj(),
_("A filename pattern as used by the shell. Character classes "
"[ab] and csh style brace expressions {a,b} are supported."), 0);
}
Gtk::Button* button_folder = 0;
xml->get_widget("button_folder", button_folder);
button_folder->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::on_select_folder));
button_folder->grab_focus();
controller_.load_xml(xml);
}
......
......@@ -37,9 +37,8 @@ class Button;
class CheckButton;
class Dialog;
class Entry;
class HandleBox;
class TextBuffer;
class TextView;
class Toolbar;
class Window;
}
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment