[gtkmm-documentation] entry/completion example: Remove actions
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] entry/completion example: Remove actions
- Date: Wed, 5 Aug 2020 08:21:38 +0000 (UTC)
commit 11ca99da89ccd14f4ec3ebac3d199ebb3bf08c6f
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Wed Aug 5 10:19:25 2020 +0200
entry/completion example: Remove actions
and other changes due to changes in gtk and gtkmm.
* configure.ac:
* meson.build: Don't disable deprecated atkmm API. Gtkmm does not
depend on atkmm any more.
* examples/book/buildapp/step[5-9]/prefs.ui: Rename some
Gtk::GridLayout properties.
* examples/book/entry/completion/examplewindow.[cc|h]: Remove actions.
Gtk::EntryCompletion does not handle actions.
* examples/others/cellrenderercustom/cellrendererpopup.cc:
Don't use the removed Gdk::Display::get_default_group().
configure.ac | 2 +-
examples/book/buildapp/step5/prefs.ui | 16 +++++------
examples/book/buildapp/step6/prefs.ui | 16 +++++------
examples/book/buildapp/step7/prefs.ui | 16 +++++------
examples/book/buildapp/step8/prefs.ui | 16 +++++------
examples/book/buildapp/step9/prefs.ui | 16 +++++------
examples/book/entry/completion/examplewindow.cc | 31 +---------------------
examples/book/entry/completion/examplewindow.h | 9 -------
.../others/cellrenderercustom/cellrendererpopup.cc | 10 +++----
meson.build | 2 +-
10 files changed, 48 insertions(+), 86 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 544bb8f1..dced41c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,7 +43,7 @@ AC_CHECK_FUNCS([mkfifo])
MM_ARG_ENABLE_WARNINGS([EXAMPLES_WXXFLAGS],
[-Wall],
[-pedantic -Wall -Wextra -Wformat-security -Wsuggest-override -Wshadow
-Wno-long-long],
- [G PANGO ATK GDK GDK_PIXBUF GTK GLIBMM GIOMM GDKMM ATKMM PANGOMM GTKMM SIGCXX])
+ [G PANGO GDK GDK_PIXBUF GTK GLIBMM GIOMM GDKMM PANGOMM GTKMM SIGCXX])
YELP_HELP_INIT
diff --git a/examples/book/buildapp/step5/prefs.ui b/examples/book/buildapp/step5/prefs.ui
index 090551c5..b9fea2c7 100644
--- a/examples/book/buildapp/step5/prefs.ui
+++ b/examples/book/buildapp/step5/prefs.ui
@@ -21,16 +21,16 @@
<property name="mnemonic-widget">font</property>
<property name="xalign">1</property>
<layout>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
+ <property name="column">0</property>
+ <property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkFontButton" id="font">
<layout>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
+ <property name="column">1</property>
+ <property name="row">0</property>
</layout>
</object>
</child>
@@ -41,8 +41,8 @@
<property name="mnemonic-widget">transition</property>
<property name="xalign">1</property>
<layout>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
+ <property name="column">0</property>
+ <property name="row">1</property>
</layout>
</object>
</child>
@@ -54,8 +54,8 @@
<item translatable="yes" id="slide-left-right">Slide</item>
</items>
<layout>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
+ <property name="column">1</property>
+ <property name="row">1</property>
</layout>
</object>
</child>
diff --git a/examples/book/buildapp/step6/prefs.ui b/examples/book/buildapp/step6/prefs.ui
index 090551c5..b9fea2c7 100644
--- a/examples/book/buildapp/step6/prefs.ui
+++ b/examples/book/buildapp/step6/prefs.ui
@@ -21,16 +21,16 @@
<property name="mnemonic-widget">font</property>
<property name="xalign">1</property>
<layout>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
+ <property name="column">0</property>
+ <property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkFontButton" id="font">
<layout>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
+ <property name="column">1</property>
+ <property name="row">0</property>
</layout>
</object>
</child>
@@ -41,8 +41,8 @@
<property name="mnemonic-widget">transition</property>
<property name="xalign">1</property>
<layout>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
+ <property name="column">0</property>
+ <property name="row">1</property>
</layout>
</object>
</child>
@@ -54,8 +54,8 @@
<item translatable="yes" id="slide-left-right">Slide</item>
</items>
<layout>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
+ <property name="column">1</property>
+ <property name="row">1</property>
</layout>
</object>
</child>
diff --git a/examples/book/buildapp/step7/prefs.ui b/examples/book/buildapp/step7/prefs.ui
index 090551c5..b9fea2c7 100644
--- a/examples/book/buildapp/step7/prefs.ui
+++ b/examples/book/buildapp/step7/prefs.ui
@@ -21,16 +21,16 @@
<property name="mnemonic-widget">font</property>
<property name="xalign">1</property>
<layout>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
+ <property name="column">0</property>
+ <property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkFontButton" id="font">
<layout>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
+ <property name="column">1</property>
+ <property name="row">0</property>
</layout>
</object>
</child>
@@ -41,8 +41,8 @@
<property name="mnemonic-widget">transition</property>
<property name="xalign">1</property>
<layout>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
+ <property name="column">0</property>
+ <property name="row">1</property>
</layout>
</object>
</child>
@@ -54,8 +54,8 @@
<item translatable="yes" id="slide-left-right">Slide</item>
</items>
<layout>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
+ <property name="column">1</property>
+ <property name="row">1</property>
</layout>
</object>
</child>
diff --git a/examples/book/buildapp/step8/prefs.ui b/examples/book/buildapp/step8/prefs.ui
index 090551c5..b9fea2c7 100644
--- a/examples/book/buildapp/step8/prefs.ui
+++ b/examples/book/buildapp/step8/prefs.ui
@@ -21,16 +21,16 @@
<property name="mnemonic-widget">font</property>
<property name="xalign">1</property>
<layout>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
+ <property name="column">0</property>
+ <property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkFontButton" id="font">
<layout>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
+ <property name="column">1</property>
+ <property name="row">0</property>
</layout>
</object>
</child>
@@ -41,8 +41,8 @@
<property name="mnemonic-widget">transition</property>
<property name="xalign">1</property>
<layout>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
+ <property name="column">0</property>
+ <property name="row">1</property>
</layout>
</object>
</child>
@@ -54,8 +54,8 @@
<item translatable="yes" id="slide-left-right">Slide</item>
</items>
<layout>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
+ <property name="column">1</property>
+ <property name="row">1</property>
</layout>
</object>
</child>
diff --git a/examples/book/buildapp/step9/prefs.ui b/examples/book/buildapp/step9/prefs.ui
index 090551c5..b9fea2c7 100644
--- a/examples/book/buildapp/step9/prefs.ui
+++ b/examples/book/buildapp/step9/prefs.ui
@@ -21,16 +21,16 @@
<property name="mnemonic-widget">font</property>
<property name="xalign">1</property>
<layout>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
+ <property name="column">0</property>
+ <property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkFontButton" id="font">
<layout>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
+ <property name="column">1</property>
+ <property name="row">0</property>
</layout>
</object>
</child>
@@ -41,8 +41,8 @@
<property name="mnemonic-widget">transition</property>
<property name="xalign">1</property>
<layout>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
+ <property name="column">0</property>
+ <property name="row">1</property>
</layout>
</object>
</child>
@@ -54,8 +54,8 @@
<item translatable="yes" id="slide-left-right">Slide</item>
</items>
<layout>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
+ <property name="column">1</property>
+ <property name="row">1</property>
</layout>
</object>
</child>
diff --git a/examples/book/entry/completion/examplewindow.cc b/examples/book/entry/completion/examplewindow.cc
index 46f1ec88..0ed35f5e 100644
--- a/examples/book/entry/completion/examplewindow.cc
+++ b/examples/book/entry/completion/examplewindow.cc
@@ -19,7 +19,7 @@
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::Orientation::VERTICAL),
- m_Label("Press a or b to see a list of possible completions and actions."),
+ m_Label("Press a or b to see a list of possible completions."),
m_Button_Close("Close")
{
//set_size_request(200, 100);
@@ -73,24 +73,6 @@ ExampleWindow::ExampleWindow()
// set_match_func().
//- display text in the entry when a match is found.
completion->set_text_column(m_Columns.m_col_name);
-
- //Add actions to the completion:
- //These are just extra items shown at the bottom of the list of possible
- //completions.
-
- //Remember them for later.
- m_CompletionActions[0] = "Use Wizard";
- m_CompletionActions[1] = "Browse for Filename";
-
- for(const auto& the_pair : m_CompletionActions)
- {
- auto position = the_pair.first;
- auto title = the_pair.second;
- completion->insert_action_text(title, position);
- }
-
- completion->signal_action_activated().connect( sigc::mem_fun(*this,
- &ExampleWindow::on_completion_action_activated) );
}
ExampleWindow::~ExampleWindow()
@@ -128,14 +110,3 @@ bool ExampleWindow::on_completion_match(const Glib::ustring& key, const
return false; //No match.
}
*/
-
-void ExampleWindow::on_completion_action_activated(int index)
-{
- auto iter = m_CompletionActions.find(index);
- if(iter != m_CompletionActions.end()) //If it's in the map
- {
- auto title = iter->second;
- std::cout << "Action selected: " << title << std::endl;
- }
-}
-
diff --git a/examples/book/entry/completion/examplewindow.h b/examples/book/entry/completion/examplewindow.h
index 2c94cf29..1ed70b8a 100644
--- a/examples/book/entry/completion/examplewindow.h
+++ b/examples/book/entry/completion/examplewindow.h
@@ -1,5 +1,3 @@
-//$Id: examplewindow.h 705 2006-07-19 02:55:32Z jjongsma $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -31,17 +29,13 @@ protected:
//Signal handlers:
void on_button_close();
- void on_completion_action_activated(int index);
-
//See the comment in the implementation:
//bool on_completion_match(const Glib::ustring& key, const Gtk::TreeModel::const_iterator& iter);
-
//Tree model columns, for the EntryCompletion's filter model:
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
-
ModelColumns()
{ add(m_col_id); add(m_col_name); }
@@ -51,9 +45,6 @@ protected:
ModelColumns m_Columns;
- typedef std::map<int, Glib::ustring> type_actions_map;
- type_actions_map m_CompletionActions;
-
//Child widgets:
Gtk::Box m_HBox;
Gtk::Box m_VBox;
diff --git a/examples/others/cellrenderercustom/cellrendererpopup.cc
b/examples/others/cellrenderercustom/cellrendererpopup.cc
index 82870388..be78b638 100644
--- a/examples/others/cellrenderercustom/cellrendererpopup.cc
+++ b/examples/others/cellrenderercustom/cellrendererpopup.cc
@@ -182,11 +182,11 @@ void CellRendererPopup::on_show_popup(const Glib::ustring&, int, int y1, int x2,
const int button_height = y2 - y1;
auto display = Gdk::Display::get_default();
- auto monitor = display->get_monitor_at_surface(display->get_default_group());
- Gdk::Rectangle workarea;
- monitor->get_workarea(workarea);
- int monitor_height = workarea.get_height() - y;
- const int monitor_width = workarea.get_width();
+ auto monitor = display->get_monitor_at_surface(popup_window_.get_surface());
+ Gdk::Rectangle geometry;
+ monitor->get_geometry(geometry);
+ int monitor_height = geometry.get_height() - y;
+ const int monitor_width = geometry.get_width();
// Check if it fits in the available height.
if(alloc.get_height() > monitor_height)
diff --git a/meson.build b/meson.build
index 5d28b053..123805f1 100644
--- a/meson.build
+++ b/meson.build
@@ -58,7 +58,7 @@ elif warning_level == 'max' or warning_level == 'fatal'
warning_flags = '-pedantic -Wall -Wextra -Wformat-security -Wsuggest-override -Wshadow
-Wno-long-long'.split()
if warning_level == 'fatal'
warning_flags += ['-Werror']
- deprecations = 'G PANGO ATK GDK GDK_PIXBUF GTK GLIBMM GIOMM GDKMM ATKMM PANGOMM GTKMM SIGCXX'.split()
+ deprecations = 'G PANGO GDK GDK_PIXBUF GTK GLIBMM GIOMM GDKMM PANGOMM GTKMM SIGCXX'.split()
foreach d : deprecations
warning_flags += '-D@0@_DISABLE_DEPRECATED'.format(d)
endforeach
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]