[gtkmm-documentation] Replace Gtk::Stock items by labels and/or icons in many example programs.
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Replace Gtk::Stock items by labels and/or icons in many example programs.
- Date: Thu, 25 Jul 2013 08:34:36 +0000 (UTC)
commit 0b3d3ee9e6d5081ea8e48b84e2ba4183f0c2c16b
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Thu Jul 25 10:29:56 2013 +0200
Replace Gtk::Stock items by labels and/or icons in many example programs.
* examples/book/clipboard/ideal/examplewindow.cc:
* examples/book/clipboard/simple/examplewindow.cc:
* examples/book/dialogs/filechooserdialog/examplewindow.cc:
* examples/book/idle/idleexample.cc:
* examples/book/infobar/examplewindow.cc:
* examples/book/textview/examplewindow.cc:
* examples/book/timeout/timerexample.cc:
* examples/book/treeview/drag_and_drop/examplewindow.cc:
* examples/book/update_ui/examplewindow.cc: Replace stock items by labels.
* examples/book/entry/icon/examplewindow.cc:
* examples/book/statusicon/main.cc:
* examples/book/tooltips/examplewindow.cc: Replace stock items by named icons.
* examples/book/toolbar/examplewindow.cc: Replace stock item by label and
named icon.
* examples/book/combobox/complex/examplewindow.cc:
* examples/book/combobox/entry_complex/examplewindow.cc:
* examples/book/combobox/entry_text/examplewindow.cc:
* examples/book/combobox/text/examplewindow.cc:
Remove unnecessary #include <gtkmm/stock.h>.
examples/book/clipboard/ideal/examplewindow.cc | 2 +-
examples/book/clipboard/simple/examplewindow.cc | 2 +-
examples/book/combobox/complex/examplewindow.cc | 1 -
.../book/combobox/entry_complex/examplewindow.cc | 1 -
examples/book/combobox/entry_text/examplewindow.cc | 1 -
examples/book/combobox/text/examplewindow.cc | 1 -
.../dialogs/filechooserdialog/examplewindow.cc | 6 +++---
examples/book/entry/icon/examplewindow.cc | 2 +-
examples/book/idle/idleexample.cc | 2 +-
examples/book/infobar/examplewindow.cc | 6 +++---
examples/book/statusicon/main.cc | 2 +-
examples/book/textview/examplewindow.cc | 3 +--
examples/book/timeout/timerexample.cc | 6 +++---
examples/book/toolbar/examplewindow.cc | 17 ++++++++++-------
examples/book/tooltips/examplewindow.cc | 4 ++--
.../book/treeview/drag_and_drop/examplewindow.cc | 2 +-
examples/book/update_ui/examplewindow.cc | 2 +-
17 files changed, 29 insertions(+), 31 deletions(-)
---
diff --git a/examples/book/clipboard/ideal/examplewindow.cc b/examples/book/clipboard/ideal/examplewindow.cc
index d1d1535..90a99d1 100644
--- a/examples/book/clipboard/ideal/examplewindow.cc
+++ b/examples/book/clipboard/ideal/examplewindow.cc
@@ -35,7 +35,7 @@ ExampleWindow::ExampleWindow()
"of this example to try pasting the copied data.\nOr try pasting the "
"text representation into gedit."),
m_ButtonA1("A1"), m_ButtonA2("A2"), m_ButtonB1("B1"), m_ButtonB2("B2"),
- m_Button_Copy(Gtk::Stock::COPY), m_Button_Paste(Gtk::Stock::PASTE)
+ m_Button_Copy("_Copy", /* mnemonic= */ true), m_Button_Paste("_Paste", true)
{
set_title("Gtk::Clipboard example");
set_border_width(12);
diff --git a/examples/book/clipboard/simple/examplewindow.cc b/examples/book/clipboard/simple/examplewindow.cc
index ee12dfc..aced27f 100644
--- a/examples/book/clipboard/simple/examplewindow.cc
+++ b/examples/book/clipboard/simple/examplewindow.cc
@@ -23,7 +23,7 @@ ExampleWindow::ExampleWindow()
m_Label("Select cells in the grid, click Copy, then open a second "
"instance of this example to try pasting the copied data."),
m_ButtonA1("A1"), m_ButtonA2("A2"), m_ButtonB1("B1"), m_ButtonB2("B2"),
- m_Button_Copy(Gtk::Stock::COPY), m_Button_Paste(Gtk::Stock::PASTE)
+ m_Button_Copy("_Copy", /* mnemonic= */ true), m_Button_Paste("_Paste", true)
{
set_title("Gtk::Clipboard example");
set_border_width(12);
diff --git a/examples/book/combobox/complex/examplewindow.cc b/examples/book/combobox/complex/examplewindow.cc
index 185196d..6a9a8e8 100644
--- a/examples/book/combobox/complex/examplewindow.cc
+++ b/examples/book/combobox/complex/examplewindow.cc
@@ -17,7 +17,6 @@
*/
#include "examplewindow.h"
-#include <gtkmm/stock.h>
#include <iostream>
ExampleWindow::ExampleWindow()
diff --git a/examples/book/combobox/entry_complex/examplewindow.cc
b/examples/book/combobox/entry_complex/examplewindow.cc
index f2c65a3..55a7740 100644
--- a/examples/book/combobox/entry_complex/examplewindow.cc
+++ b/examples/book/combobox/entry_complex/examplewindow.cc
@@ -17,7 +17,6 @@
*/
#include "examplewindow.h"
-#include <gtkmm/stock.h>
#include <iostream>
ExampleWindow::ExampleWindow()
diff --git a/examples/book/combobox/entry_text/examplewindow.cc
b/examples/book/combobox/entry_text/examplewindow.cc
index 6b156fb..8076197 100644
--- a/examples/book/combobox/entry_text/examplewindow.cc
+++ b/examples/book/combobox/entry_text/examplewindow.cc
@@ -17,7 +17,6 @@
*/
#include "examplewindow.h"
-#include <gtkmm/stock.h>
#include <iostream>
ExampleWindow::ExampleWindow()
diff --git a/examples/book/combobox/text/examplewindow.cc b/examples/book/combobox/text/examplewindow.cc
index f8a1231..72a3751 100644
--- a/examples/book/combobox/text/examplewindow.cc
+++ b/examples/book/combobox/text/examplewindow.cc
@@ -17,7 +17,6 @@
*/
#include "examplewindow.h"
-#include <gtkmm/stock.h>
#include <iostream>
ExampleWindow::ExampleWindow()
diff --git a/examples/book/dialogs/filechooserdialog/examplewindow.cc
b/examples/book/dialogs/filechooserdialog/examplewindow.cc
index 90b7303..80e8a80 100644
--- a/examples/book/dialogs/filechooserdialog/examplewindow.cc
+++ b/examples/book/dialogs/filechooserdialog/examplewindow.cc
@@ -51,7 +51,7 @@ void ExampleWindow::on_button_folder_clicked()
dialog.set_transient_for(*this);
//Add response buttons the the dialog:
- dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+ dialog.add_button("_Cancel", Gtk::RESPONSE_CANCEL);
dialog.add_button("Select", Gtk::RESPONSE_OK);
int result = dialog.run();
@@ -86,8 +86,8 @@ void ExampleWindow::on_button_file_clicked()
dialog.set_transient_for(*this);
//Add response buttons the the dialog:
- dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
- dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
+ dialog.add_button("_Cancel", Gtk::RESPONSE_CANCEL);
+ dialog.add_button("_Open", Gtk::RESPONSE_OK);
//Add filters, so that only certain file types can be selected:
diff --git a/examples/book/entry/icon/examplewindow.cc b/examples/book/entry/icon/examplewindow.cc
index 69e20d9..56631a6 100644
--- a/examples/book/entry/icon/examplewindow.cc
+++ b/examples/book/entry/icon/examplewindow.cc
@@ -31,7 +31,7 @@ ExampleWindow::ExampleWindow()
m_Entry.set_text("Hello world");
m_VBox.pack_start(m_Entry, Gtk::PACK_SHRINK);
- m_Entry.set_icon_from_stock(Gtk::Stock::FIND);
+ m_Entry.set_icon_from_icon_name("edit-find");
m_Entry.signal_icon_press().connect( sigc::mem_fun(*this, &ExampleWindow::on_icon_pressed) );
diff --git a/examples/book/idle/idleexample.cc b/examples/book/idle/idleexample.cc
index b2ad691..bf81882 100644
--- a/examples/book/idle/idleexample.cc
+++ b/examples/book/idle/idleexample.cc
@@ -20,7 +20,7 @@
IdleExample::IdleExample() :
m_Box(Gtk::ORIENTATION_VERTICAL, 5),
- m_ButtonQuit(Gtk::Stock::QUIT)
+ m_ButtonQuit("_Quit", true)
{
set_border_width(5);
diff --git a/examples/book/infobar/examplewindow.cc b/examples/book/infobar/examplewindow.cc
index bcc6ba2..f57cce4 100644
--- a/examples/book/infobar/examplewindow.cc
+++ b/examples/book/infobar/examplewindow.cc
@@ -18,8 +18,8 @@
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::ORIENTATION_VERTICAL, 6),
- m_Button_Quit(Gtk::Stock::QUIT),
- m_Button_Clear("Clear")
+ m_Button_Quit("_Quit", true),
+ m_Button_Clear("_Clear", true)
{
set_title("Gtk::InfoBar example");
set_border_width(6);
@@ -34,7 +34,7 @@ ExampleWindow::ExampleWindow()
infoBarContainer->add(m_Message_Label);
// Add an ok button to the InfoBar:
- m_InfoBar.add_button(Gtk::Stock::OK, 0);
+ m_InfoBar.add_button("_OK", 0);
// Add the InfoBar to the vbox:
m_VBox.pack_start(m_InfoBar, Gtk::PACK_SHRINK);
diff --git a/examples/book/statusicon/main.cc b/examples/book/statusicon/main.cc
index 74dcf23..886f316 100644
--- a/examples/book/statusicon/main.cc
+++ b/examples/book/statusicon/main.cc
@@ -24,7 +24,7 @@ int main(int argc, char *argv[])
//Use your own icon in real life.
Glib::RefPtr<Gtk::StatusIcon> status_icon =
- Gtk::StatusIcon::create(Gtk::Stock::HELP);
+ Gtk::StatusIcon::create("help-browser");
status_icon->set_tooltip_text("gtkmm StatusIcon example tooltip.");
//Show a window:
diff --git a/examples/book/textview/examplewindow.cc b/examples/book/textview/examplewindow.cc
index 2945a9a..5296a0c 100644
--- a/examples/book/textview/examplewindow.cc
+++ b/examples/book/textview/examplewindow.cc
@@ -20,7 +20,7 @@
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::ORIENTATION_VERTICAL),
- m_Button_Quit(Gtk::Stock::QUIT),
+ m_Button_Quit("_Quit", true),
m_Button_Buffer1("Use buffer 1"),
m_Button_Buffer2("Use buffer 2")
{
@@ -28,7 +28,6 @@ ExampleWindow::ExampleWindow()
set_border_width(5);
set_default_size(400, 200);
-
add(m_VBox);
//Add the TreeView, inside a ScrolledWindow, with the button underneath:
diff --git a/examples/book/timeout/timerexample.cc b/examples/book/timeout/timerexample.cc
index cc18555..dae4bab 100644
--- a/examples/book/timeout/timerexample.cc
+++ b/examples/book/timeout/timerexample.cc
@@ -21,9 +21,9 @@
TimerExample::TimerExample() :
m_Box(Gtk::ORIENTATION_HORIZONTAL, 10),
// use Gtk::Stock wherever possible for buttons, etc.
- m_ButtonAddTimer(Gtk::Stock::ADD),
- m_ButtonDeleteTimer(Gtk::Stock::REMOVE),
- m_ButtonQuit(Gtk::Stock::QUIT),
+ m_ButtonAddTimer("_Add", true),
+ m_ButtonDeleteTimer("_Remove", true),
+ m_ButtonQuit("_Quit", true),
m_timer_number(0), // start numbering the timers at 0
count_value(5), // each timer will count down 5 times before disconnecting
timeout_value(1500) // 1500 ms = 1.5 seconds
diff --git a/examples/book/toolbar/examplewindow.cc b/examples/book/toolbar/examplewindow.cc
index 2a723ae..0a482e8 100644
--- a/examples/book/toolbar/examplewindow.cc
+++ b/examples/book/toolbar/examplewindow.cc
@@ -21,11 +21,11 @@
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::ORIENTATION_VERTICAL),
- m_Button_Close("Close")
+ m_Button_Close("_Close", true)
{
set_title("Gtk::Toolbar example");
//The toolbar will not demand any size, because it has an overflow menu.
- set_size_request(300, 300);
+ set_size_request(300, 200);
add(m_VBox);
@@ -42,10 +42,11 @@ ExampleWindow::ExampleWindow()
//Add the toolbar items:
{
- //You would normally use the UIManager, and Actions, to create the menus and
+ //You would normally use the Builder and Gio::Actions to create the menus and
//toolbars together, because toolbar items should just be a way to do what
- //is also in a menu. TODO: Use UIManager instead here. See the demo for an
- //example.:
+ //is also in a menu.
+
+ m_Toolbar.set_toolbar_style(Gtk::TOOLBAR_BOTH);
Gtk::ToolButton* item = Gtk::manage(new Gtk::ToolButton("Click me"));
//item.set_tooltips(*tooltips, "Toolbar item");
@@ -55,7 +56,10 @@ ExampleWindow::ExampleWindow()
m_Toolbar.append( *(Gtk::manage(new Gtk::SeparatorToolItem)) );
- item = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::SAVE));
+ item = Gtk::manage(new Gtk::ToolButton("_Save"));
+ item->set_use_underline();
+ item->set_icon_name("document-save");
+ item->set_homogeneous(false);
m_Toolbar.append(*item);
item->signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_toolbar_item) );
@@ -66,7 +70,6 @@ ExampleWindow::ExampleWindow()
item->signal_clicked().connect( sigc::mem_fun(*this,
&ExampleWindow::on_toolbar_item) );
- //TODO: These don't actually seem to work:
Gtk::RadioButtonGroup group;
m_Toolbar.append( *Gtk::manage(
new Gtk::RadioToolButton(group, "Radio 1")) );
diff --git a/examples/book/tooltips/examplewindow.cc b/examples/book/tooltips/examplewindow.cc
index 0d617b5..8daf3bf 100644
--- a/examples/book/tooltips/examplewindow.cc
+++ b/examples/book/tooltips/examplewindow.cc
@@ -99,7 +99,7 @@ void ExampleWindow::prepare_textview()
m_ref_text_buffer->insert_with_tags(iter, "in bold", tags);
iter = m_ref_text_buffer->end();
- m_ref_text_buffer->insert(iter, " to see its' tooltip");
+ m_ref_text_buffer->insert(iter, " to see its tooltip");
m_text_view.set_buffer(m_ref_text_buffer);
@@ -158,7 +158,7 @@ bool ExampleWindow::on_textview_query_tooltip(int x, int y, bool keyboard_toolti
if (iter.has_tag(m_ref_bold_tag))
{
tooltip->set_markup("<b>Information</b> attached to a text tag");
- tooltip->set_icon_from_stock (Gtk::Stock::INFO, Gtk::ICON_SIZE_MENU);
+ tooltip->set_icon_from_icon_name("dialog-information", Gtk::ICON_SIZE_MENU);
}
else
{
diff --git a/examples/book/treeview/drag_and_drop/examplewindow.cc
b/examples/book/treeview/drag_and_drop/examplewindow.cc
index 4a6a092..f8dd9f4 100644
--- a/examples/book/treeview/drag_and_drop/examplewindow.cc
+++ b/examples/book/treeview/drag_and_drop/examplewindow.cc
@@ -21,7 +21,7 @@
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::ORIENTATION_VERTICAL),
- m_Button_Quit(Gtk::Stock::QUIT)
+ m_Button_Quit("_Quit", true)
{
set_title("Gtk::TreeView (Drag and Drop) example");
set_border_width(5);
diff --git a/examples/book/update_ui/examplewindow.cc b/examples/book/update_ui/examplewindow.cc
index 8cc5077..bdffa33 100644
--- a/examples/book/update_ui/examplewindow.cc
+++ b/examples/book/update_ui/examplewindow.cc
@@ -22,7 +22,7 @@
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::ORIENTATION_VERTICAL),
m_Button_Start("Start"),
- m_Button_Quit(Gtk::Stock::QUIT)
+ m_Button_Quit("_Quit", true)
{
set_title("update-ui example");
set_border_width(6);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]