[fractal/bilelmoussaoui/bump-gtk-rs: 7/16] use new gdk::Keys API
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/bilelmoussaoui/bump-gtk-rs: 7/16] use new gdk::Keys API
- Date: Fri, 28 Aug 2020 17:54:02 +0000 (UTC)
commit 5ee20335d91e6cf9348f6ce4be6eb754598c0231
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Wed Jul 15 19:27:27 2020 +0200
use new gdk::Keys API
fractal-gtk/src/app/connect/send.rs | 4 ++--
fractal-gtk/src/widgets/autocomplete.rs | 22 +++++++++++-----------
fractal-gtk/src/widgets/avatar.rs | 1 -
fractal-gtk/src/widgets/kicked_dialog.rs | 2 +-
fractal-gtk/src/widgets/media_viewer.rs | 8 ++++----
fractal-gtk/src/widgets/source_dialog.rs | 2 +-
6 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/fractal-gtk/src/app/connect/send.rs b/fractal-gtk/src/app/connect/send.rs
index 480d459f..c76d216c 100644
--- a/fractal-gtk/src/app/connect/send.rs
+++ b/fractal-gtk/src/app/connect/send.rs
@@ -33,7 +33,7 @@ impl App {
.expect("Can't find autocomplete_popover in ui file.");
msg_entry.connect_key_press_event(move |_, key| match key.get_keyval() {
- gdk::enums::key::Return | gdk::enums::key::KP_Enter
+ gdk::keys::constants::Return | gdk::keys::constants::KP_Enter
if !key.get_state().contains(gdk::ModifierType::SHIFT_MASK)
&& !autocomplete_popover.is_visible() =>
{
@@ -45,7 +45,7 @@ impl App {
let mut op = self.op.clone();
msg_entry.connect_key_release_event(move |_, ev| {
- if gdk::keyval_to_unicode(ev.get_keyval()).is_some() {
+ if gdk::keyval_to_unicode(*ev.get_keyval()).is_some() {
op.lock().unwrap().send_typing();
}
Inhibit(false)
diff --git a/fractal-gtk/src/widgets/autocomplete.rs b/fractal-gtk/src/widgets/autocomplete.rs
index 697da8ab..c68eb40e 100644
--- a/fractal-gtk/src/widgets/autocomplete.rs
+++ b/fractal-gtk/src/widgets/autocomplete.rs
@@ -136,7 +136,7 @@ impl Autocomplete {
let own = this.clone();
this.borrow().entry.connect_key_release_event(move |_, k| {
- if let gdk::enums::key::Escape = k.get_keyval() {
+ if let gdk::keys::constants::Escape = k.get_keyval() {
if own.borrow().popover_position.is_some() {
own.borrow_mut().autocomplete_enter();
return Inhibit(true);
@@ -148,7 +148,7 @@ impl Autocomplete {
let own = this.clone();
this.borrow().entry.connect_key_press_event(move |w, ev| {
match ev.get_keyval() {
- gdk::enums::key::BackSpace => {
+ gdk::keys::constants::BackSpace => {
if let Some(buffer) = w.get_buffer() {
let start = buffer.get_start_iter();
let end = buffer.get_end_iter();
@@ -167,7 +167,7 @@ impl Autocomplete {
return glib::signal::Inhibit(false);
}
/* Tab and Enter key */
- gdk::enums::key::Tab | gdk::enums::key::Return => {
+ gdk::keys::constants::Tab | gdk::keys::constants::Return => {
if own.borrow().popover_position.is_some() {
let widget = {
own.borrow_mut().popover_closing = true;
@@ -177,12 +177,12 @@ impl Autocomplete {
let ev: &gdk::Event = ev;
let _ = w.emit("button-press-event", &[ev]);
}
- } else if ev.get_keyval() != gdk::enums::key::Tab {
+ } else if ev.get_keyval() != gdk::keys::constants::Tab {
return glib::signal::Inhibit(false);
}
}
/* Arrow key */
- gdk::enums::key::Up => {
+ gdk::keys::constants::Up => {
if own.borrow().popover_position.is_none() {
return glib::signal::Inhibit(false);
}
@@ -194,7 +194,7 @@ impl Autocomplete {
}
}
/* Arrow key */
- gdk::enums::key::Down => {
+ gdk::keys::constants::Down => {
if own.borrow().popover_position.is_none() {
return glib::signal::Inhibit(false);
}
@@ -214,7 +214,7 @@ impl Autocomplete {
let own = this.clone();
this.borrow().entry.connect_key_release_event(move |e, ev| {
if let Some(buffer) = e.get_buffer() {
- let is_tab = ev.get_keyval() == gdk::enums::key::Tab;
+ let is_tab = ev.get_keyval() == gdk::keys::constants::Tab;
let start = buffer.get_start_iter();
let end = buffer.get_end_iter();
@@ -243,8 +243,8 @@ impl Autocomplete {
/* update the popover when closed and tab is released
* don't update the popover the arrow keys are pressed */
if (is_tab && own.borrow().popover_position.is_none())
- || (ev.get_keyval() != gdk::enums::key::Up
- && ev.get_keyval() != gdk::enums::key::Down)
+ || (ev.get_keyval() != gdk::keys::constants::Up
+ && ev.get_keyval() != gdk::keys::constants::Down)
{
own.borrow_mut().popover_search = text.clone();
if let Some(buffer) = e.get_buffer() {
@@ -295,8 +295,8 @@ impl Autocomplete {
.unwrap()
};
/* Submit on enter */
- if ev.get_keyval() == gdk::enums::key::Return
- || ev.get_keyval() == gdk::enums::key::Tab
+ if ev.get_keyval() == gdk::keys::constants::Return
+ || ev.get_keyval() == gdk::keys::constants::Tab
{
own.borrow_mut().autocomplete_enter();
}
diff --git a/fractal-gtk/src/widgets/avatar.rs b/fractal-gtk/src/widgets/avatar.rs
index 3bb03f1e..1f0e992a 100644
--- a/fractal-gtk/src/widgets/avatar.rs
+++ b/fractal-gtk/src/widgets/avatar.rs
@@ -109,7 +109,6 @@ impl AvatarExt for gtk::Overlay {
/* This function should never fail */
let fallback = letter_avatar::generate::new(id.clone(), username, size as f64)
.expect("this function should never fail");
-
// Power level badge setup
let has_badge = badge_color.is_some();
let badge_size = badge_size.unwrap_or(size / 3);
diff --git a/fractal-gtk/src/widgets/kicked_dialog.rs b/fractal-gtk/src/widgets/kicked_dialog.rs
index c761f335..e89b02cb 100644
--- a/fractal-gtk/src/widgets/kicked_dialog.rs
+++ b/fractal-gtk/src/widgets/kicked_dialog.rs
@@ -74,7 +74,7 @@ impl KickedDialog {
self.widgets
.msg_kicked_window
.connect_key_press_event(|w, k| {
- if k.get_keyval() == gdk::enums::key::Escape {
+ if k.get_keyval() == gdk::keys::constants::Escape {
w.close();
}
diff --git a/fractal-gtk/src/widgets/media_viewer.rs b/fractal-gtk/src/widgets/media_viewer.rs
index 34c51a87..abb7b137 100644
--- a/fractal-gtk/src/widgets/media_viewer.rs
+++ b/fractal-gtk/src/widgets/media_viewer.rs
@@ -463,7 +463,7 @@ impl Data {
@weak player
=> @default-return Inhibit(false), move |_, k| {
if player.get_video_widget().get_mapped() {
- if let gdk::enums::key::space = k.get_keyval() {
+ if let gdk::keys::constants::space = k.get_keyval() {
if player.is_playing() {
control_revealer.set_reveal_child(true);
} else {
@@ -926,7 +926,7 @@ impl MediaViewer {
.main_window
.connect_key_press_event(move |w, k| {
match k.get_keyval() {
- gdk::enums::key::Escape => {
+ gdk::keys::constants::Escape => {
// leave full screen only if we're currently in fullscreen
if let Some(win) = w.get_window() {
if win.get_state().contains(gdk::WindowState::FULLSCREEN) {
@@ -937,11 +937,11 @@ impl MediaViewer {
Inhibit(false)
}
- gdk::enums::key::Left => {
+ gdk::keys::constants::Left => {
previous_media_button.clicked();
Inhibit(true)
}
- gdk::enums::key::Right => {
+ gdk::keys::constants::Right => {
next_media_button.clicked();
Inhibit(true)
}
diff --git a/fractal-gtk/src/widgets/source_dialog.rs b/fractal-gtk/src/widgets/source_dialog.rs
index c8c34d96..92184d4f 100644
--- a/fractal-gtk/src/widgets/source_dialog.rs
+++ b/fractal-gtk/src/widgets/source_dialog.rs
@@ -89,7 +89,7 @@ impl SourceDialog {
/* Close the window when the user preses ESC */
self.widgets.msg_src_window.connect_key_press_event(|w, k| {
- if k.get_keyval() == gdk::enums::key::Escape {
+ if k.get_keyval() == gdk::keys::constants::Escape {
w.close();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]