[gtkmm-documentation] PlacesSidebar example: use new show-enter-location
- From: Juan R. Garcia Blanco <juanrgar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] PlacesSidebar example: use new show-enter-location
- Date: Thu, 15 May 2014 19:37:10 +0000 (UTC)
commit 640634e373be5a6f75654c1a793c21aff36cd545
Author: Juan R. GarcĂa Blanco <juanrgar gmail com>
Date: Thu May 15 21:33:02 2014 +0200
PlacesSidebar example: use new show-enter-location
* Use new property "show-enter-location" that toggles
display of an extra entry in the bar.
examples/book/placessidebar/examplewindow.cc | 18 +++++++++++++++---
examples/book/placessidebar/examplewindow.h | 2 ++
2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/examples/book/placessidebar/examplewindow.cc b/examples/book/placessidebar/examplewindow.cc
index a540243..d77d743 100644
--- a/examples/book/placessidebar/examplewindow.cc
+++ b/examples/book/placessidebar/examplewindow.cc
@@ -18,13 +18,14 @@
ExampleWindow::ExampleWindow()
: m_hbox(Gtk::ORIENTATION_HORIZONTAL, 6),
- m_show_desktop_check("Show desktop"),
- m_show_connect_to_server_check("Show connect to server")
+ m_show_desktop_check("Show \"Desktop\""),
+ m_show_connect_to_server_check("Show \"Connect to Server\""),
+ m_show_enter_location("Show \"Enter Location\"")
{
// Window properties
set_title("PlacesSidebar Example");
set_border_width(12);
- set_size_request(300, 600);
+ set_size_request(500, 600);
// Options
m_controls_frame.set_shadow_type(Gtk::SHADOW_NONE);
@@ -38,12 +39,16 @@ ExampleWindow::ExampleWindow()
m_show_connect_to_server_check.signal_toggled().connect(sigc::mem_fun(*this,
&ExampleWindow::on_show_connect_to_server_toggled));
m_show_connect_to_server_check.set_active();
+ m_show_enter_location.signal_toggled().connect(sigc::mem_fun(*this,
&ExampleWindow::on_show_enter_location_toggled));
+ m_show_enter_location.set_active(false);
+
m_places_sidebar.signal_open_location().connect(sigc::mem_fun(*this,
&ExampleWindow::on_placessidebar_open_location));
m_places_sidebar.signal_populate_popup().connect(sigc::mem_fun(*this,
&ExampleWindow::on_placessidebar_populate_popup));
//m_places_sidebar.signal_drag_action_requested().connect(sigc::mem_fun(*this,
&ExampleWindow::on_placessidebar_drag_action_requested));
m_controls.attach(m_show_desktop_check, 0, 0, 1, 1);
m_controls.attach(m_show_connect_to_server_check, 0, 1, 1, 1);
+ m_controls.attach(m_show_enter_location, 0, 2, 1, 1);
std::cout << "Shortcuts:" << std::endl;
std::vector<Glib::RefPtr<Gio::File > > shortcuts = m_places_sidebar.list_shortcuts();
@@ -81,6 +86,13 @@ void ExampleWindow::on_show_connect_to_server_toggled()
m_places_sidebar.set_show_connect_to_server(show_connect_to_server);
}
+void ExampleWindow::on_show_enter_location_toggled()
+{
+ const bool show_enter_location = m_show_enter_location.get_active();
+
+ m_places_sidebar.set_show_enter_location(show_enter_location);
+}
+
void ExampleWindow::on_placessidebar_open_location(const Glib::RefPtr<Gio::File>& location,
Gtk::PlacesOpenFlags /* open_flags */)
{
Gtk::MessageDialog dialog(*this, "<b>open-location</b> event triggered", true);
diff --git a/examples/book/placessidebar/examplewindow.h b/examples/book/placessidebar/examplewindow.h
index 97ef35b..8173d2d 100644
--- a/examples/book/placessidebar/examplewindow.h
+++ b/examples/book/placessidebar/examplewindow.h
@@ -31,6 +31,7 @@ protected:
// Slots
void on_show_desktop_toggled();
void on_show_connect_to_server_toggled();
+ void on_show_enter_location_toggled();
void on_placessidebar_open_location(const Glib::RefPtr<Gio::File>& location, Gtk::PlacesOpenFlags
open_flags);
void on_placessidebar_populate_popup(Gtk::Menu* menu, const Glib::RefPtr<Gio::File>& selected_item, const
Glib::RefPtr<Gio::Volume>& selected_volume);
int on_placessidebar_drag_action_requested(const Glib::RefPtr<Gdk::DragContext>& context, const
Glib::RefPtr<Gio::File>& dest_file, const std::vector< Glib::RefPtr<Gio::File> >& source_file_list);
@@ -47,6 +48,7 @@ protected:
Gtk::PlacesSidebar m_places_sidebar;
Gtk::CheckButton m_show_desktop_check;
Gtk::CheckButton m_show_connect_to_server_check;
+ Gtk::CheckButton m_show_enter_location;
private:
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]