Commit 536655b8 authored by Lubomir Rintel's avatar Lubomir Rintel

editor/trivial: move utils_fake_return_key() to editor

It relies on Gdk trickery that will not be possible in future.
Has no place in libnma.
parent 1d0ca3c0
......@@ -696,6 +696,8 @@ connection_editor_hc_real = \
src/connection-editor/ce-polkit-button.h \
src/connection-editor/ce-polkit.c \
src/connection-editor/ce-polkit.h \
src/connection-editor/ce-utils.c \
src/connection-editor/ce-utils.h \
src/connection-editor/connection-helpers.c \
src/connection-editor/connection-helpers.h
......
/* NetworkManager Applet -- allow user control over networking
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright 2015, 2018 Red Hat, Inc.
*/
#include "nm-default.h"
#include "ce-utils.h"
/* Change key in @event to 'Enter' key. */
void
utils_fake_return_key (GdkEventKey *event)
{
GdkKeymapKey *keys = NULL;
gint n_keys;
/* Get hardware keycode for GDK_KEY_Return */
if (gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (), GDK_KEY_Return, &keys, &n_keys)) {
event->keyval = GDK_KEY_Return;
event->hardware_keycode = keys[0].keycode;
event->state = 0;
}
g_free (keys);
}
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager Applet -- allow user control over networking
*
* Dan Williams <dcbw@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright 2007 - 2015 Red Hat, Inc.
*/
#ifndef __CE_UTILS_H__
#define __CE_UTILS_H__
void utils_fake_return_key (GdkEventKey *event);
#endif /* __CE_UTILS_H__ */
......@@ -34,6 +34,7 @@
#include "ip4-routes-dialog.h"
#include "utils.h"
#include "ce-utils.h"
#define COL_ADDRESS 0
#define COL_PREFIX 1
......
......@@ -36,6 +36,7 @@
#include "ip6-routes-dialog.h"
#include "utils.h"
#include "ce-utils.h"
#define COL_ADDRESS 0
#define COL_PREFIX 1
......
......@@ -2,6 +2,7 @@ sources = files(
'ce-page.c',
'ce-polkit-button.c',
'ce-polkit.c',
'ce-utils.c',
'connection-helpers.c',
'ip4-routes-dialog.c',
'ip6-routes-dialog.c',
......
......@@ -33,6 +33,7 @@
#include "page-ip4.h"
#include "ip4-routes-dialog.h"
#include "connection-helpers.h"
#include "ce-utils.h"
G_DEFINE_TYPE (CEPageIP4, ce_page_ip4, CE_TYPE_PAGE)
......
......@@ -32,6 +32,7 @@
#include "page-ip6.h"
#include "ip6-routes-dialog.h"
#include "ce-utils.h"
G_DEFINE_TYPE (CEPageIP6, ce_page_ip6, CE_TYPE_PAGE)
......
......@@ -361,22 +361,6 @@ utils_set_cell_background (GtkCellRenderer *cell,
g_object_set (G_OBJECT (cell), "cell-background-set", FALSE, NULL);
}
/* Change key in @event to 'Enter' key. */
void
utils_fake_return_key (GdkEventKey *event)
{
GdkKeymapKey *keys = NULL;
gint n_keys;
/* Get hardware keycode for GDK_KEY_Return */
if (gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (), GDK_KEY_Return, &keys, &n_keys)) {
event->keyval = GDK_KEY_Return;
event->hardware_keycode = keys[0].keycode;
event->state = 0;
}
g_free (keys);
}
void
widget_set_error (GtkWidget *widget)
{
......
......@@ -79,8 +79,6 @@ void utils_set_cell_background (GtkCellRenderer *cell,
const char *color,
const char *value);
void utils_fake_return_key (GdkEventKey *event);
void widget_set_error (GtkWidget *widget);
void widget_unset_error (GtkWidget *widget);
......
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