diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2018-06-27 20:11:40 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2018-06-28 14:01:14 +0200 |
commit | 13f7a3f3caff20494af5cfe0162972624be8109c (patch) | |
tree | d8bffb21eeedcc5fcca8bdfd8cc8150ff311045f | |
parent | 9207dfa3a813a9bc8d0175701dd8bd592f2a1a42 (diff) | |
download | network-manager-applet-lr/fixes.tar.gz |
editor/trivial: move utils_fake_return_key() to editorlr/fixes
It relies on Gdk trickery that will not be possible in future.
Has no place in libnma.
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | src/connection-editor/ce-utils.c | 38 | ||||
-rw-r--r-- | src/connection-editor/ce-utils.h | 28 | ||||
-rw-r--r-- | src/connection-editor/ip4-routes-dialog.c | 1 | ||||
-rw-r--r-- | src/connection-editor/ip6-routes-dialog.c | 1 | ||||
-rw-r--r-- | src/connection-editor/meson.build | 1 | ||||
-rw-r--r-- | src/connection-editor/page-ip4.c | 1 | ||||
-rw-r--r-- | src/connection-editor/page-ip6.c | 1 | ||||
-rw-r--r-- | src/utils/utils.c | 16 | ||||
-rw-r--r-- | src/utils/utils.h | 2 |
10 files changed, 73 insertions, 18 deletions
diff --git a/Makefile.am b/Makefile.am index 2019adb2..3ad1af9a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/src/connection-editor/ce-utils.c b/src/connection-editor/ce-utils.c new file mode 100644 index 00000000..038f2175 --- /dev/null +++ b/src/connection-editor/ce-utils.c @@ -0,0 +1,38 @@ +/* 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); +} diff --git a/src/connection-editor/ce-utils.h b/src/connection-editor/ce-utils.h new file mode 100644 index 00000000..f24f6c80 --- /dev/null +++ b/src/connection-editor/ce-utils.h @@ -0,0 +1,28 @@ +/* -*- 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__ */ diff --git a/src/connection-editor/ip4-routes-dialog.c b/src/connection-editor/ip4-routes-dialog.c index 4b10552e..e574f3c8 100644 --- a/src/connection-editor/ip4-routes-dialog.c +++ b/src/connection-editor/ip4-routes-dialog.c @@ -34,6 +34,7 @@ #include "ip4-routes-dialog.h" #include "utils.h" +#include "ce-utils.h" #define COL_ADDRESS 0 #define COL_PREFIX 1 diff --git a/src/connection-editor/ip6-routes-dialog.c b/src/connection-editor/ip6-routes-dialog.c index 35bb6586..270dba16 100644 --- a/src/connection-editor/ip6-routes-dialog.c +++ b/src/connection-editor/ip6-routes-dialog.c @@ -36,6 +36,7 @@ #include "ip6-routes-dialog.h" #include "utils.h" +#include "ce-utils.h" #define COL_ADDRESS 0 #define COL_PREFIX 1 diff --git a/src/connection-editor/meson.build b/src/connection-editor/meson.build index ef2657bb..8ab39a91 100644 --- a/src/connection-editor/meson.build +++ b/src/connection-editor/meson.build @@ -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', diff --git a/src/connection-editor/page-ip4.c b/src/connection-editor/page-ip4.c index 94519ab8..a09be7a6 100644 --- a/src/connection-editor/page-ip4.c +++ b/src/connection-editor/page-ip4.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) diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c index b12966fa..0c82b33d 100644 --- a/src/connection-editor/page-ip6.c +++ b/src/connection-editor/page-ip6.c @@ -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) diff --git a/src/utils/utils.c b/src/utils/utils.c index 20ea93ce..694c521a 100644 --- a/src/utils/utils.c +++ b/src/utils/utils.c @@ -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) { diff --git a/src/utils/utils.h b/src/utils/utils.h index ccc653f8..4425789a 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -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); |