annotate src/hotkey/gui.c @ 3203:f5456241bff9 default tip

changed include path from audacious to audlegacy.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 10 Nov 2009 05:19:25 +0900
parents 3134a0987162
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
1 /*
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
2 * This file is part of audacious-hotkey plugin for audacious
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
3 *
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
4 * Copyright (c) 2007 - 2008 Sascha Hlusiak <contact@saschahlusiak.de>
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
5 * Name: gui.c
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
6 * Description: gui.c
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
7 *
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
8 * Part of this code is from itouch-ctrl plugin.
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
9 * Authors of itouch-ctrl are listed below:
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
10 *
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
11 * Copyright (c) 2006 - 2007 Vladimir Paskov <vlado.paskov@gmail.com>
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
12 *
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
13 * Part of this code are from xmms-itouch plugin.
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
14 * Authors of xmms-itouch are listed below:
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
15 *
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
16 * Copyright (C) 2000-2002 Ville Syrjälä <syrjala@sci.fi>
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
17 * Bryn Davies <curious@ihug.com.au>
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
18 * Jonathan A. Davis <davis@jdhouse.org>
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
19 * Jeremy Tan <nsx@nsx.homeip.net>
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
20 *
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
21 * audacious-hotkey is free software; you can redistribute it and/or modify
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
22 * it under the terms of the GNU General Public License as published by
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
23 * the Free Software Foundation; either version 2 of the License, or
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
24 * (at your option) any later version.
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
25 *
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
26 * audacious-hotkey is distributed in the hope that it will be useful,
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
29 * GNU General Public License for more details.
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
30 *
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
31 * You should have received a copy of the GNU General Public License
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
32 * along with audacious-hotkey; if not, write to the Free Software
2835
f1b6f1b2cdb3 fixed FSF address
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2661
diff changeset
33 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
34 */
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
35
2661
1eb29b830013 Backed out changeset c1258ae018ee
Matti Hamalainen <ccr@tnsp.org>
parents: 2660
diff changeset
36 #include <config.h>
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
37
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
38 #include <gtk/gtk.h>
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
39 #include <gdk/gdkx.h>
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
40 #include <gdk/gdkkeysyms.h>
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
41
2971
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2835
diff changeset
42 #include <audlegacy/plugin.h>
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2835
diff changeset
43 #include <audlegacy/i18n.h>
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
44
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
45 #include "plugin.h"
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
46 #include "gui.h"
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
47 #include "grab.h"
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
48
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
49 typedef struct _KeyControls {
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
50 GtkWidget *keytext;
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
51 GtkWidget *table;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
52 GtkWidget *button;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
53 GtkWidget *combobox;
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
54
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
55 HotkeyConfiguration hotkey;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
56 struct _KeyControls *next, *prev, *first;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
57 } KeyControls;
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
58
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
59
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
60 static void clear_keyboard (GtkWidget *widget, gpointer data);
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
61 static void add_callback (GtkWidget *widget, gpointer data);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
62 static void cancel_callback (GtkWidget *widget, gpointer data);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
63 static void destroy_callback (GtkWidget *widget, gpointer data);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
64 static void ok_callback (GtkWidget *widget, gpointer data);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
65
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
66
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
67 static gchar* event_desc[EVENT_MAX] = {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
68 [EVENT_PREV_TRACK] = N_("Previous Track"),
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
69 [EVENT_PLAY] = N_("Play"),
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
70 [EVENT_PAUSE] = N_("Pause/Resume"),
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
71 [EVENT_STOP] = N_("Stop"),
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
72 [EVENT_NEXT_TRACK] = N_("Next Track"),
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
73 [EVENT_FORWARD] = N_("Forward 5 Seconds"),
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
74 [EVENT_BACKWARD] = N_("Rewind 5 Seconds"),
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
75 [EVENT_MUTE] = N_("Mute"),
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
76 [EVENT_VOL_UP] = N_("Volume Up"),
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
77 [EVENT_VOL_DOWN] = N_("Volume Down"),
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
78 [EVENT_JUMP_TO_FILE] = N_("Jump to File"),
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
79 [EVENT_TOGGLE_WIN] = N_("Toggle Player Windows"),
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
80 [EVENT_SHOW_AOSD] = N_("Show On-Screen-Display")
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
81 };
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
82
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
83
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
84 static void set_keytext (GtkWidget *entry, gint key, gint mask, gint type)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
85 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
86 gchar *text = NULL;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
87
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
88 if (key == 0 && mask == 0)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
89 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
90 text = g_strdup(_("(none)"));
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
91 } else {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
92 static char *modifier_string[] = { "Control", "Shift", "Alt", "Mod2", "Mod3", "Super", "Mod5" };
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
93 static unsigned int modifiers[] = { ControlMask, ShiftMask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask };
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
94 gchar *strings[9];
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
95 gchar *keytext = NULL;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
96 int i, j;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
97 if (type == TYPE_KEY)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
98 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
99 KeySym keysym;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
100 keysym = XKeycodeToKeysym(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), key, 0);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
101 if (keysym == 0 || keysym == NoSymbol)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
102 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
103 keytext = g_strdup_printf("#%d", key);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
104 } else {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
105 keytext = g_strdup(XKeysymToString(keysym));
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
106 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
107 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
108 if (type == TYPE_MOUSE)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
109 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
110 keytext = g_strdup_printf("Button%d", key);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
111 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
112
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
113 for (i = 0, j=0; j<7; j++)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
114 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
115 if (mask & modifiers[j])
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
116 strings[i++] = modifier_string[j];
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
117 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
118 if (key != 0) strings[i++] = keytext;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
119 strings[i] = NULL;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
120
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
121 text = g_strjoinv(" + ", strings);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
122 g_free(keytext);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
123 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
124
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
125 gtk_entry_set_text(GTK_ENTRY(entry), text);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
126 gtk_editable_set_position(GTK_EDITABLE(entry), -1);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
127 if (text) g_free(text);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
128 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
129
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
130 static gboolean
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
131 on_entry_key_press_event(GtkWidget * widget,
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
132 GdkEventKey * event,
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
133 gpointer user_data)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
134 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
135 KeyControls *controls = (KeyControls*) user_data;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
136 int is_mod;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
137 int mod;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
138
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
139 if (event->keyval == GDK_Tab) return FALSE;
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
140 if (event->keyval == GDK_Escape && ((event->state & ~GDK_LOCK_MASK) == 0)) return FALSE;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
141 if (event->keyval == GDK_Return && ((event->state & ~GDK_LOCK_MASK) == 0)) return FALSE;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
142 if (event->keyval == GDK_ISO_Left_Tab)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
143 {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
144 set_keytext(controls->keytext, controls->hotkey.key, controls->hotkey.mask, controls->hotkey.type);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
145 return FALSE;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
146 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
147 if (event->keyval == GDK_Up && ((event->state & ~GDK_LOCK_MASK) == 0)) return FALSE;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
148 if (event->keyval == GDK_Down && ((event->state & ~GDK_LOCK_MASK) == 0)) return FALSE;
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
149
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
150 mod = 0;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
151 is_mod = 0;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
152
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
153 if ((event->state & GDK_CONTROL_MASK) | (!is_mod && (is_mod = (event->keyval == GDK_Control_L || event->keyval == GDK_Control_R))))
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
154 mod |= ControlMask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
155
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
156 if ((event->state & GDK_MOD1_MASK) | (!is_mod && (is_mod = (event->keyval == GDK_Alt_L || event->keyval == GDK_Alt_R))))
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
157 mod |= Mod1Mask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
158
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
159 if ((event->state & GDK_SHIFT_MASK) | (!is_mod && (is_mod = (event->keyval == GDK_Shift_L || event->keyval == GDK_Shift_R))))
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
160 mod |= ShiftMask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
161
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
162 if ((event->state & GDK_MOD5_MASK) | (!is_mod && (is_mod = (event->keyval == GDK_ISO_Level3_Shift))))
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
163 mod |= Mod5Mask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
164
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
165 if ((event->state & GDK_MOD4_MASK) | (!is_mod && (is_mod = (event->keyval == GDK_Super_L || event->keyval == GDK_Super_R))))
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
166 mod |= Mod4Mask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
167
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
168 if (!is_mod) {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
169 controls->hotkey.key = event->hardware_keycode;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
170 controls->hotkey.mask = mod;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
171 controls->hotkey.type = TYPE_KEY;
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
172 if (controls->next == NULL)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
173 add_callback (NULL, (gpointer) controls);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
174 else gtk_widget_grab_focus(GTK_WIDGET(controls->next->keytext));
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
175 }
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
176
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
177 set_keytext(controls->keytext, is_mod ? 0 : event->hardware_keycode, mod, TYPE_KEY);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
178 return TRUE;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
179 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
180
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
181 static gboolean
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
182 on_entry_key_release_event(GtkWidget * widget,
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
183 GdkEventKey * event,
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
184 gpointer user_data)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
185 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
186 KeyControls *controls = (KeyControls*) user_data;
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
187 if (!gtk_widget_is_focus(widget)) return FALSE;
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
188 set_keytext(controls->keytext, controls->hotkey.key, controls->hotkey.mask, controls->hotkey.type);
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
189
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
190 return TRUE;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
191 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
192
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
193 static gboolean
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
194 on_entry_button_press_event(GtkWidget * widget,
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
195 GdkEventButton * event,
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
196 gpointer user_data)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
197 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
198 KeyControls *controls = (KeyControls*) user_data;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
199 int mod;
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
200
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
201 if (!gtk_widget_is_focus(widget)) return FALSE;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
202
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
203 mod = 0;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
204 if (event->state & GDK_CONTROL_MASK)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
205 mod |= ControlMask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
206
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
207 if (event->state & GDK_MOD1_MASK)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
208 mod |= Mod1Mask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
209
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
210 if (event->state & GDK_SHIFT_MASK)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
211 mod |= ShiftMask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
212
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
213 if (event->state & GDK_MOD5_MASK)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
214 mod |= Mod5Mask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
215
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
216 if (event->state & GDK_MOD4_MASK)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
217 mod |= Mod4Mask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
218
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
219 if ((event->button <= 3) && (mod == 0))
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
220 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
221 GtkWidget* dialog;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
222 GtkResponseType response;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
223 dialog = gtk_message_dialog_new (GTK_WINDOW(gtk_widget_get_toplevel(widget)),
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
224 GTK_DIALOG_MODAL,
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
225 GTK_MESSAGE_WARNING,
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
226 GTK_BUTTONS_YES_NO,
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
227 _("It is not recommended to bind the primary mouse buttons without modificators.\n\n"
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
228 "Do you want to continue?"));
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
229 gtk_window_set_title(GTK_WINDOW(dialog), _("Binding mouse buttons"));
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
230 response = gtk_dialog_run(GTK_DIALOG(dialog));
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
231 gtk_widget_destroy (dialog);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
232 if (response != GTK_RESPONSE_YES) return TRUE;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
233 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
234
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
235 controls->hotkey.key = event->button;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
236 controls->hotkey.mask = mod;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
237 controls->hotkey.type = TYPE_MOUSE;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
238 set_keytext(controls->keytext, controls->hotkey.key, controls->hotkey.mask, controls->hotkey.type);
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
239 if (controls->next == NULL)
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
240 add_callback (NULL, (gpointer) controls);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
241
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
242 return TRUE;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
243 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
244
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
245 static gboolean
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
246 on_entry_scroll_event(GtkWidget * widget,
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
247 GdkEventScroll * event,
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
248 gpointer user_data)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
249 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
250 KeyControls *controls = (KeyControls*) user_data;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
251 int mod;
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
252
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
253 if (!gtk_widget_is_focus(widget)) return FALSE;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
254
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
255 mod = 0;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
256 if (event->state & GDK_CONTROL_MASK)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
257 mod |= ControlMask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
258
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
259 if (event->state & GDK_MOD1_MASK)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
260 mod |= Mod1Mask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
261
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
262 if (event->state & GDK_SHIFT_MASK)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
263 mod |= ShiftMask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
264
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
265 if (event->state & GDK_MOD5_MASK)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
266 mod |= Mod5Mask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
267
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
268 if (event->state & GDK_MOD4_MASK)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
269 mod |= Mod4Mask;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
270
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
271 if (event->direction == GDK_SCROLL_UP)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
272 controls->hotkey.key = 4;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
273 else if (event->direction == GDK_SCROLL_DOWN)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
274 controls->hotkey.key = 5;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
275 else if (event->direction == GDK_SCROLL_LEFT)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
276 controls->hotkey.key = 6;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
277 else if (event->direction == GDK_SCROLL_RIGHT)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
278 controls->hotkey.key = 7;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
279 else return FALSE;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
280
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
281 controls->hotkey.mask = mod;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
282 controls->hotkey.type = TYPE_MOUSE;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
283 set_keytext(controls->keytext, controls->hotkey.key, controls->hotkey.mask, controls->hotkey.type);
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
284 if (controls->next == NULL)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
285 add_callback (NULL, (gpointer) controls);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
286 return TRUE;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
287 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
288
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
289 KeyControls* add_event_controls(KeyControls* list,
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
290 GtkWidget *table,
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
291 int row,
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
292 HotkeyConfiguration *hotkey)
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
293 {
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
294 KeyControls *controls;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
295 int i;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
296
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
297 controls = (KeyControls*) g_malloc(sizeof(KeyControls));
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
298 controls->next = NULL;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
299 controls->prev = list;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
300 controls->first = list->first;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
301 controls->table = table;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
302 list->next = controls;
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
303
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
304 if (hotkey)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
305 {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
306 controls->hotkey.key = hotkey->key;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
307 controls->hotkey.mask = hotkey->mask;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
308 controls->hotkey.type = hotkey->type;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
309 controls->hotkey.event = hotkey->event;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
310 if (controls->hotkey.key == 0)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
311 controls->hotkey.mask = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
312 } else {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
313 controls->hotkey.key = 0;
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
314 controls->hotkey.mask = 0;
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
315 controls->hotkey.type = TYPE_KEY;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
316 controls->hotkey.event = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
317 }
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
318
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
319 controls->combobox = gtk_combo_box_new_text();
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
320 for (i=0;i<EVENT_MAX;i++)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
321 {
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
322 gtk_combo_box_append_text( GTK_COMBO_BOX(controls->combobox), _(event_desc[i]) );
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
323 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
324 gtk_combo_box_set_active( GTK_COMBO_BOX(controls->combobox), controls->hotkey.event);
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
325 gtk_table_attach (GTK_TABLE (table), controls->combobox, 0, 1, row, row+1,
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
326 (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
327
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
328
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
329 controls->keytext = gtk_entry_new ();
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
330 gtk_table_attach (GTK_TABLE (table), controls->keytext, 1, 2, row, row+1,
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
331 (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
332 gtk_entry_set_editable (GTK_ENTRY (controls->keytext), FALSE);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
333
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
334
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
335 set_keytext(controls->keytext, controls->hotkey.key, controls->hotkey.mask, controls->hotkey.type);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
336 g_signal_connect((gpointer)controls->keytext, "key_press_event",
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
337 G_CALLBACK(on_entry_key_press_event), controls);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
338 g_signal_connect((gpointer)controls->keytext, "key_release_event",
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
339 G_CALLBACK(on_entry_key_release_event), controls);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
340 g_signal_connect((gpointer)controls->keytext, "button_press_event",
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
341 G_CALLBACK(on_entry_button_press_event), controls);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
342 g_signal_connect((gpointer)controls->keytext, "scroll_event",
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
343 G_CALLBACK(on_entry_scroll_event), controls);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
344
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
345
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
346 controls->button = gtk_button_new();
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
347 gtk_button_set_image( GTK_BUTTON(controls->button),
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
348 gtk_image_new_from_stock( GTK_STOCK_DELETE , GTK_ICON_SIZE_BUTTON));
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
349 gtk_table_attach (GTK_TABLE (table), controls->button, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
350 g_signal_connect (G_OBJECT (controls->button), "clicked",
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
351 G_CALLBACK (clear_keyboard), controls);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
352
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
353 gtk_widget_grab_focus(GTK_WIDGET(controls->keytext));
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
354 return controls;
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
355 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
356
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
357 void show_configure ()
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
358 {
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
359 KeyControls *first_controls, *current_controls;
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
360 GtkWidget *window;
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
361 GtkWidget *main_vbox, *hbox;
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
362 GtkWidget *alignment;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
363 GtkWidget *frame;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
364 GtkWidget *label;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
365 GtkWidget *image;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
366 GtkWidget *table;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
367 GtkWidget *button_box, *button;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
368 PluginConfig* plugin_cfg;
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
369 HotkeyConfiguration *hotkey, temphotkey;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
370 int i;
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
371
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
372 load_config ( );
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
373
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
374 plugin_cfg = get_config();
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
375
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
376 ungrab_keys();
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
377
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
378 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
379 gtk_window_set_title (GTK_WINDOW (window), _("Global Hotkey Plugin Configuration"));
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
380 gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
381 gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DIALOG);
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
382 gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
383 gtk_container_set_border_width (GTK_CONTAINER (window), 5);
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
384
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
385 main_vbox = gtk_vbox_new (FALSE, 4);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
386 gtk_container_add (GTK_CONTAINER (window), main_vbox);
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
387
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
388 alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
389 gtk_box_pack_start (GTK_BOX (main_vbox), alignment, FALSE, TRUE, 0);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
390 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 4, 0, 0, 0);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
391 hbox = gtk_hbox_new (FALSE, 2);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
392 gtk_container_add (GTK_CONTAINER (alignment), hbox);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
393 image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
394 gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, TRUE, 0);
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
395 label = gtk_label_new (_("Press a key combination inside a text field.\nYou can also bind mouse buttons."));
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
396 gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
397 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
398
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
399 label = gtk_label_new (NULL);
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
400 gtk_label_set_markup (GTK_LABEL (label), _("Hotkeys:"));
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
401 frame = gtk_frame_new (NULL);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
402 gtk_frame_set_label_widget (GTK_FRAME (frame), label);
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
403 gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 0);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
404 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
405 alignment = gtk_alignment_new (0, 0, 1, 0);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
406 gtk_container_add (GTK_CONTAINER (frame), alignment);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
407 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 3, 3, 3, 3);
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
408
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
409 table = gtk_table_new (1, 3, FALSE);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
410 gtk_container_add (GTK_CONTAINER (alignment), table);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
411
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
412 gtk_table_set_col_spacings (GTK_TABLE (table), 2);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
413 gtk_table_set_row_spacings (GTK_TABLE (table), 0);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
414
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
415 label = gtk_label_new (NULL);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
416 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
417 gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
418 gtk_label_set_markup (GTK_LABEL (label),
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
419 _("<b>Action:</b>"));
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
420 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
421 (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
422
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
423 label = gtk_label_new (NULL);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
424 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
425 gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
426 gtk_label_set_markup (GTK_LABEL (label),
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
427 _("<b>Key Binding:</b>"));
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
428 gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1,
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
429 (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
430
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
431
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
432 hotkey = &(plugin_cfg->first);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
433 i = 1;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
434 first_controls = (KeyControls*) g_malloc(sizeof(KeyControls));
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
435 first_controls->next = NULL;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
436 first_controls->prev = NULL;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
437 first_controls->table = table;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
438 first_controls->button = NULL;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
439 first_controls->combobox = NULL;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
440 first_controls->keytext = NULL;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
441 first_controls->first = first_controls;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
442 first_controls->hotkey.key = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
443 first_controls->hotkey.mask = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
444 first_controls->hotkey.event = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
445 first_controls->hotkey.type = TYPE_KEY;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
446 current_controls = first_controls;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
447 if (hotkey -> key != 0)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
448 {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
449 while (hotkey)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
450 {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
451 current_controls = add_event_controls(current_controls, table, i, hotkey);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
452 hotkey = hotkey->next;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
453 i++;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
454 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
455 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
456 temphotkey.key = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
457 temphotkey.mask = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
458 temphotkey.type = TYPE_KEY;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
459 if (current_controls != first_controls)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
460 temphotkey.event = current_controls->hotkey.event+1;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
461 else temphotkey.event = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
462 if (temphotkey.event >= EVENT_MAX) temphotkey.event = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
463 add_event_controls(current_controls, table, i, &temphotkey);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
464
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
465
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
466
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
467 hbox = gtk_hbox_new(FALSE, 0);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
468 gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, TRUE, 0);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
469
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
470 button_box = gtk_hbutton_box_new ( );
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
471 gtk_box_pack_start (GTK_BOX (hbox), button_box, FALSE, TRUE, 0);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
472 gtk_button_box_set_layout (GTK_BUTTON_BOX (button_box), GTK_BUTTONBOX_START);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
473 gtk_box_set_spacing (GTK_BOX (button_box), 4);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
474
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
475 button = gtk_button_new_from_stock (GTK_STOCK_ADD);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
476 gtk_container_add (GTK_CONTAINER (button_box), button);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
477 g_signal_connect (G_OBJECT (button), "clicked",
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
478 G_CALLBACK (add_callback), first_controls);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
479
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
480 button_box = gtk_hbutton_box_new ( );
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
481 gtk_box_pack_start (GTK_BOX (hbox), button_box, TRUE, TRUE, 0);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
482 gtk_button_box_set_layout (GTK_BUTTON_BOX (button_box), GTK_BUTTONBOX_END);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
483 gtk_box_set_spacing (GTK_BOX (button_box), 4);
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
484
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
485 button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
486 gtk_container_add (GTK_CONTAINER (button_box), button);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
487 g_signal_connect (G_OBJECT (button), "clicked",
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
488 G_CALLBACK (cancel_callback), NULL);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
489
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
490 button = gtk_button_new_from_stock (GTK_STOCK_OK);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
491 gtk_container_add (GTK_CONTAINER (button_box), button);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
492 g_signal_connect (G_OBJECT (button), "clicked",
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
493 G_CALLBACK (ok_callback), first_controls);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
494
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
495 g_signal_connect (G_OBJECT (window), "destroy",
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
496 G_CALLBACK (destroy_callback), first_controls);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
497
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
498 gtk_widget_show_all (GTK_WIDGET (window));
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
499 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
500
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
501 static void clear_keyboard (GtkWidget *widget, gpointer data)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
502 {
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
503 KeyControls *controls= (KeyControls*)data;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
504 if ((controls->next == NULL) && (controls->prev->keytext == NULL))
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
505 {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
506 controls->hotkey.key = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
507 controls->hotkey.mask = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
508 controls->hotkey.type = TYPE_KEY;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
509 set_keytext(controls->keytext, 0, 0, TYPE_KEY);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
510 gtk_combo_box_set_active( GTK_COMBO_BOX(controls->combobox), 0);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
511 return;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
512 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
513
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
514 if (controls->prev)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
515 {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
516 KeyControls* c;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
517 GtkWidget* table;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
518 int row;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
519
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
520 gtk_widget_destroy(GTK_WIDGET(controls->button));
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
521 gtk_widget_destroy(GTK_WIDGET(controls->keytext));
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
522 gtk_widget_destroy(GTK_WIDGET(controls->combobox));
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
523
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
524 row=0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
525 c = controls->first;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
526 while (c) {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
527 if (c == controls) break;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
528 row++;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
529 c = c->next;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
530 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
531 c = controls->next;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
532 controls->prev->next = controls->next;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
533 if (controls->next)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
534 controls->next->prev = controls->prev;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
535 g_free(controls);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
536 if (c) table = c->table; else table = NULL;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
537 while (c)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
538 {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
539 g_object_ref(c->combobox);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
540 g_object_ref(c->keytext);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
541 g_object_ref(c->button);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
542
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
543 gtk_container_remove( GTK_CONTAINER(c->table) , c->combobox);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
544 gtk_container_remove( GTK_CONTAINER(c->table) , c->keytext);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
545 gtk_container_remove( GTK_CONTAINER(c->table) , c->button);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
546
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
547 gtk_table_attach (GTK_TABLE (c->table), c->combobox, 0, 1, row, row+1,
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
548 (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
549 gtk_table_attach (GTK_TABLE (c->table), c->keytext, 1, 2, row, row+1,
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
550 (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (GTK_EXPAND), 0, 0);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
551 gtk_table_attach (GTK_TABLE (c->table), c->button, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
552
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
553 g_object_unref(c->combobox);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
554 g_object_unref(c->keytext);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
555 g_object_unref(c->button);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
556
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
557 c = c->next;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
558 row++;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
559 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
560 if (table)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
561 gtk_widget_show_all (GTK_WIDGET (table));
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
562
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
563 return;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
564 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
565 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
566
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
567 void add_callback (GtkWidget *widget, gpointer data)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
568 {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
569 KeyControls* controls = (KeyControls*)data;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
570 HotkeyConfiguration temphotkey;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
571 int count;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
572 if (controls == NULL) return;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
573 if ((controls->next == NULL)&&(controls->hotkey.event+1 == EVENT_MAX)) return;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
574 controls = controls->first;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
575 if (controls == NULL) return;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
576 count = 1;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
577 while (controls->next) {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
578 controls = controls->next;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
579 count = count + 1;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
580 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
581 temphotkey.key = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
582 temphotkey.mask = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
583 temphotkey.type = TYPE_KEY;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
584 temphotkey.event = controls->hotkey.event+1;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
585 if (temphotkey.event >= EVENT_MAX) temphotkey.event = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
586 gtk_table_resize(GTK_TABLE(controls->table), count, 3);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
587 add_event_controls(controls, controls->table, count, &temphotkey);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
588 gtk_widget_show_all (GTK_WIDGET (controls->table));
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
589 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
590
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
591 void destroy_callback (GtkWidget *widget, gpointer data)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
592 {
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
593 KeyControls* controls = (KeyControls*)data;
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
594 if (is_loaded())
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
595 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
596 grab_keys ();
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
597 }
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
598 while (controls) {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
599 KeyControls *old;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
600 old = controls;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
601 controls = controls->next;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
602 g_free(old);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
603 }
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
604 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
605
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
606 void cancel_callback (GtkWidget *widget, gpointer data)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
607 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
608 gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (widget)));
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
609 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
610
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
611 void ok_callback (GtkWidget *widget, gpointer data)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
612 {
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
613 KeyControls *controls = (KeyControls*)data;
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
614 PluginConfig* plugin_cfg = get_config();
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
615 HotkeyConfiguration *hotkey;
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
616
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
617 hotkey = &(plugin_cfg->first);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
618 hotkey = hotkey->next;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
619 while (hotkey)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
620 {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
621 HotkeyConfiguration * old;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
622 old = hotkey;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
623 hotkey = hotkey->next;
2577
0db1da71c90c Fix some plugins after the cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 2576
diff changeset
624 g_free(old);
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
625 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
626 plugin_cfg->first.next = NULL;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
627 plugin_cfg->first.key = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
628 plugin_cfg->first.event = 0;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
629 plugin_cfg->first.mask = 0;
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
630
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
631 hotkey = &(plugin_cfg->first);
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
632 while (controls)
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
633 {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
634 if (controls->hotkey.key) {
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
635 if (hotkey->key) {
2577
0db1da71c90c Fix some plugins after the cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 2576
diff changeset
636 hotkey->next = g_new(HotkeyConfiguration, 1);
2336
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
637 hotkey = hotkey->next;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
638 hotkey->next = NULL;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
639 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
640 hotkey->key = controls->hotkey.key;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
641 hotkey->mask = controls->hotkey.mask;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
642 hotkey->event = gtk_combo_box_get_active( GTK_COMBO_BOX(controls->combobox) );
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
643 hotkey->type = controls->hotkey.type;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
644 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
645 controls = controls->next;
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
646 }
ad45d65e9ae7 Hotkey Plugin: Complete GUI rework. Ability to use more than one binding for the same action.
Sascha Hlusiak <contact@saschahlusiak.de>
parents: 2330
diff changeset
647
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
648 save_config ( );
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
649
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
650 gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (widget)));
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
651 }
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
652
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
653
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
654
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
655 void show_about (void)
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
656 {
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
657 static GtkWidget *dialog;
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
658
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
659 dialog = audacious_info_dialog (_("About Global Hotkey Plugin"),
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
660 _("Global Hotkey Plugin\n"
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
661 "Control the player with global key combinations or multimedia keys.\n\n"
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
662 "Copyright (C) 2007-2008 Sascha Hlusiak <contact@saschahlusiak.de>\n\n"
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
663 "Contributers include:\n"
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
664 "Copyright (C) 2006-2007 Vladimir Paskov <vlado.paskov@gmail.com>\n"
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
665 "Copyright (C) 2000-2002 Ville Syrjälä <syrjala@sci.fi>\n"
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
666 " Bryn Davies <curious@ihug.com.au>\n"
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
667 " Jonathan A. Davis <davis@jdhouse.org>\n"
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
668 " Jeremy Tan <nsx@nsx.homeip.net>\n\n"
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
669 ),
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
670 _("OK"), TRUE, NULL, NULL);
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
671
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
672 gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
2365
8326592d3d35 Updated French translation.
Stany HENRY <StrassBoy@gmail.com>
parents: 2336
diff changeset
673 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog);
2330
0be42d832217 Splitted core/gui/grabbing sources; Fixed memory leak when closing configuration dialog.
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff changeset
674 }