-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract record context menu into an own module
- Loading branch information
Showing
3 changed files
with
49 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use crate::primary_accel; | ||
use crate::utils::menu_builder::*; | ||
use gtk::{gio, prelude::*}; | ||
|
||
const ACTION_COPY_NAME: &str = "copy-name"; | ||
const ACTION_COPY_PASSWORD: &str = "copy-password"; | ||
const ACTION_MOVE: &str = "move"; | ||
const ACTION_EDIT: &str = "edit"; | ||
const ACTION_DELETE: &str = "delete"; | ||
|
||
pub fn record_context_menu() -> gio::MenuModel { | ||
gio::Menu::new() | ||
.section( | ||
gio::Menu::new() | ||
.item( | ||
gio::MenuItem::create() | ||
.action(ACTION_COPY_NAME) | ||
.label("Copy _name") | ||
.accel(primary_accel!("c")), | ||
) | ||
.item( | ||
gio::MenuItem::create() | ||
.action(ACTION_COPY_PASSWORD) | ||
.label("Copy pass_word") | ||
.accel(primary_accel!("<Shift>c")), | ||
), | ||
) | ||
.section( | ||
gio::Menu::new().item( | ||
gio::MenuItem::create() | ||
.action(ACTION_MOVE) | ||
.label("_Move to..."), | ||
), | ||
) | ||
.section( | ||
gio::Menu::new() | ||
.item(gio::MenuItem::create().action(ACTION_EDIT).label("_Edit")) | ||
.item( | ||
gio::MenuItem::create() | ||
.action(ACTION_DELETE) | ||
.label("_Delete"), | ||
), | ||
) | ||
.upcast() | ||
} |