Exemple #1
0
static gboolean
on_item_list_view_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer data) 
{
	if ((event->type == GDK_KEY_PRESS) && (event->state == 0)
	    && (event->keyval == GDK_KEY(Delete)))
		on_remove_item_activate(NULL, NULL);

	return FALSE;
}
Exemple #2
0
void
on_popup_remove_selected (void)
{
	on_remove_item_activate (NULL, NULL);
}
Exemple #3
0
static gboolean
on_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer data)
{
	gboolean	modifier_matches = FALSE;
	guint		default_modifiers;
	const gchar	*type;
	GtkWidget	*focusw;
	gint		browse_key_setting;

	if (event->type == GDK_KEY_PRESS) {
		default_modifiers = gtk_accelerator_get_default_mod_mask ();

		/* handle [<modifier>+]<Space> headline skimming hotkey */
		switch (event->keyval) {
			case GDK_KEY_space:
				conf_get_int_value (BROWSE_KEY_SETTING, &browse_key_setting);
				switch (browse_key_setting) {
					default:
					case 0:
						modifier_matches = ((event->state & default_modifiers) == 0);
						/* Hack to make space handled in the module. This is necessary
						   because the HTML widget code must be able to catch spaces
						   for input fields.
						   
						   By ignoring the space here it will be passed to the HTML
						   widget which in turn will pass it back if it is not eaten by
						   any input field currently focussed. */
						return FALSE;
					case 1:
						modifier_matches = ((event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK);
						break;
					case 2:
						modifier_matches = ((event->state & GDK_MOD1_MASK) == GDK_MOD1_MASK);
						break;
				}
				
				if (modifier_matches) {
					itemview_scroll ();
					return TRUE;
				}
				break;
		}
		
		/* some <Ctrl> hotkeys that overrule the HTML view */
		if ((event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK) {
			switch (event->keyval) {
				case GDK_KEY_KP_Add:
				case GDK_KEY_equal:
				case GDK_KEY_plus:
					liferea_shell_do_zoom (TRUE);
					return TRUE;
					break;
				case GDK_KEY_KP_Subtract:
				case GDK_KEY_minus:
					liferea_shell_do_zoom (FALSE);
					return TRUE;
					break;
			}
		}

		/* prevent usage of navigation keys in entries */
		focusw = gtk_window_get_focus (GTK_WINDOW (widget));
		if (!focusw || GTK_IS_ENTRY (focusw))
			return FALSE;

		/* prevent usage of navigation keys in HTML view */
		type = g_type_name (G_OBJECT_TYPE (focusw));
		if (type && (g_str_equal (type, "WebKitWebView")))
			return FALSE;
		
		/* check for treeview navigation */
		if (0 == (event->state & default_modifiers)) {
			switch (event->keyval) {
				case GDK_KEY_KP_Delete:
				case GDK_KEY_Delete:
					if (focusw == GTK_WIDGET (shell->priv->feedlistView))
						return FALSE;	/* to be handled in feed_list_view_key_press_cb() */
						
					on_remove_item_activate (NULL, NULL);
					return TRUE;
					break;
				case GDK_KEY_n:
					on_next_unread_item_activate (NULL, NULL);
					return TRUE;
					break;
				case GDK_KEY_f:
					itemview_move_cursor (1);
					return TRUE;
					break;
				case GDK_KEY_b:
					itemview_move_cursor (-1);
					return TRUE;
					break;
				case GDK_KEY_u:
					ui_common_treeview_move_cursor (shell->priv->feedlistView, -1);
					itemview_move_cursor_to_first ();
					return TRUE;
					break;
				case GDK_KEY_d:
					ui_common_treeview_move_cursor (shell->priv->feedlistView, 1);
					itemview_move_cursor_to_first ();
					return TRUE;
					break;
			}
		}
	}
	
	return FALSE;
}