Commit 928af271 authored by Antenore Gatta's avatar Antenore Gatta

WIP: Adding accelerator to catch CTRL+Q and CTRL+P

parent e1e7964b
......@@ -71,7 +71,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<property name="halign">start</property>
<property name="image">image_new</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="remmina_main_on_action_connections_new" swapped="no"/>
<signal name="clicked" handler="remmina_main_on_action_connection_new" swapped="no"/>
</object>
</child>
<child>
......@@ -294,6 +294,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<property name="visible">True</property>
<property name="app_paintable">True</property>
<property name="can_focus">False</property>
<property name="accel_group">accelgroup_shortcuts</property>
<child>
<object class="GtkMenuItem" id="menuitem_tools_import">
<property name="visible">True</property>
......@@ -364,8 +365,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<property name="app_paintable">True</property>
<property name="can_focus">False</property>
<property name="action_name">main.preferences</property>
<property name="label" translatable="yes">Preferences</property>
<property name="label" translatable="yes">_Preferences</property>
<property name="use_underline">True</property>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
......@@ -437,7 +439,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<property name="app_paintable">True</property>
<property name="can_focus">False</property>
<property name="action_name">main.quit</property>
<property name="label" translatable="yes">Quit</property>
<property name="label" translatable="yes">_Quit</property>
<property name="use_underline">True</property>
</object>
</child>
......
......@@ -1213,6 +1213,9 @@ void remmina_main_on_click_ustat_no(GtkWidget *w, gpointer user_data)
GtkWidget* remmina_main_new(void)
{
TRACE_CALL(__func__);
GSimpleActionGroup *actions;
GtkAccelGroup *accel_group = NULL;
remminamain = g_new0(RemminaMain, 1);
remminamain->priv = g_new0(RemminaMainPriv, 1);
/* Assign UI widgets to the private members */
......@@ -1239,6 +1242,7 @@ GtkWidget* remmina_main_new(void)
gtk_widget_set_sensitive(GTK_WIDGET(remminamain->menu_popup_full), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(remminamain->menu_header_button), FALSE);
}
remminamain->menuitem_connection_quit = GTK_MENU_ITEM(GET_OBJECT("menuitem_connection_quit"));
/* View mode radios */
remminamain->menuitem_view_mode_list = GTK_RADIO_MENU_ITEM(GET_OBJECT("menuitem_view_mode_list"));
remminamain->menuitem_view_mode_tree = GTK_RADIO_MENU_ITEM(GET_OBJECT("menuitem_view_mode_tree"));
......@@ -1256,14 +1260,17 @@ GtkWidget* remmina_main_new(void)
remminamain->box_ustat = GTK_BOX(GET_OBJECT("box_ustat"));
/* Non widget objects */
remminamain->accelgroup_shortcuts = GTK_ACCEL_GROUP(GET_OBJECT("accelgroup_shortcuts"));
GSimpleActionGroup *actions;
actions = g_simple_action_group_new();
g_action_map_add_action_entries(G_ACTION_MAP(actions), main_actions, G_N_ELEMENTS(main_actions), remminamain->window);
gtk_widget_insert_action_group(GTK_WIDGET(remminamain->window), "main", G_ACTION_GROUP(actions));
g_object_unref(actions);
accel_group = gtk_accel_group_new();
gtk_window_add_accel_group(remminamain->window, accel_group);
gtk_widget_add_accelerator(remminamain->menuitem_connection_quit, "activate", accel_group, GDK_KEY_q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
/* Connect signals */
gtk_builder_connect_signals(remminamain->builder, NULL);
g_signal_connect(G_OBJECT(remminamain->menuitem_connection_quit), "activate", G_CALLBACK(remmina_main_on_action_application_quit), NULL);
/* Initialize the window and load the preferences */
remmina_main_init();
return GTK_WIDGET(remminamain->window);
......
......@@ -51,6 +51,7 @@ typedef struct _RemminaMain {
GtkMenu *menu_popup_full;
GtkRadioMenuItem *menuitem_view_mode_list;
GtkRadioMenuItem *menuitem_view_mode_tree;
GtkMenuItem *menuitem_connection_quit;
/* Button new */
GtkButton *button_new;
/* Search bar objects */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment