Ejemplo n.º 1
0
static char *
get_script_shortcut (GthScript *script)
{
	guint        keyval;
	char        *shortcut;

	keyval = gth_script_get_shortcut (script);
	if ((keyval >= GDK_KEY_KP_0) && (keyval <= GDK_KEY_KP_9))
		shortcut = g_strdup_printf ("%c", '0' + (keyval - GDK_KEY_KP_0));
	else
		shortcut = g_strdup ("");

	return shortcut;
}
Ejemplo n.º 2
0
gpointer
list_tools__gth_browser_file_list_key_press_cb (GthBrowser  *browser,
						GdkEventKey *event)
{
	gpointer  result = NULL;
	GList    *script_list;
	GList    *scan;

	script_list = gth_script_file_get_scripts (gth_script_file_get ());
	for (scan = script_list; scan; scan = scan->next) {
		GthScript *script = scan->data;

		if (gth_script_get_shortcut (script) == event->keyval) {
			gth_browser_exec_script (browser, script);
			result = GINT_TO_POINTER (1);
			break;
		}
	}

	_g_object_list_unref (script_list);

	return result;
}