lib: Move keyval parsing into lib/
I'll eventually add in checks for keypad vs top row number keys. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
80bed8b956
commit
76f0b7b55f
|
@ -50,21 +50,16 @@ static void on_cursor_changed()
|
||||||
cd_chooser(colmgr :: get_path(path));
|
cd_chooser(colmgr :: get_path(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_delete()
|
|
||||||
{
|
|
||||||
Gtk::TreePath path;
|
|
||||||
if (find_cur_path(path))
|
|
||||||
colmgr :: del_path(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool on_key_pressed(GdkEventKey *event)
|
static bool on_key_pressed(GdkEventKey *event)
|
||||||
{
|
{
|
||||||
std::string key = gdk_keyval_name(event->keyval);
|
Gtk::TreePath path;
|
||||||
if (key == "Delete") {
|
|
||||||
on_delete();
|
if (lib :: key_name(event) != "Delete")
|
||||||
return true;
|
return false;
|
||||||
}
|
|
||||||
return false;
|
if (find_cur_path(path))
|
||||||
|
colmgr :: del_path(path);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_toggled(const Glib::ustring &path)
|
static void on_toggled(const Glib::ustring &path)
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace lib
|
||||||
void init(int *, char ***, const std::string &);
|
void init(int *, char ***, const std::string &);
|
||||||
const std::string share_file(const std::string &);
|
const std::string share_file(const std::string &);
|
||||||
Glib::RefPtr<Gtk::Builder> &get_builder();
|
Glib::RefPtr<Gtk::Builder> &get_builder();
|
||||||
|
const std::string key_name(GdkEventKey *);
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static inline T *get_widget(const std::string &name)
|
static inline T *get_widget(const std::string &name)
|
||||||
|
|
|
@ -45,3 +45,9 @@ Glib::RefPtr<Gtk::Builder> &lib :: get_builder()
|
||||||
{
|
{
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string lib :: key_name(GdkEventKey *event)
|
||||||
|
{
|
||||||
|
std::string key = gdk_keyval_name(event->keyval);
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue